I have an app with various views. The main menu does not have any sounds, but the next views play sounds using the AVAudioPlayer Class.
So when someone launches the app and is in the main menu, if he changes the volume on his device, he actually changes the "Ringer" volume. If he proceeds to the other views (where we have sound), when h...
There are two runtimes for Cocoa/Objective-C: the legacy runtime and the "modern" runtime (that's what Apple calls it).
According to Apple's documentation, "iPhone applications and 64-bit programs on Mac OS X v10.5 and later use the modern version of the runtime".
So far so good.
Now, the "modern" runtime supports a feature called "sy...
I am currently using the following code in the AppDelegate to make a UIBarButtonItem act as a switch and adjusts a BOOL variable in the RootViewController Class:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
...
toggleSwitch = [[UIBarButtonItem alloc] initWithTitle:@"English" style:UIBarButtonItemStylePlain ta...
I was wondering how do you remove objects from an NSMutableArray, cause right now I use [astroids removeFromSuperview]; but it just gets rid of the image on screen but the instance itself is still present even when removed.
...
I have Week model that has Day as child objects. There is "days" relation property in Week model to access all associated Day objects. Day model has duration property.
How can I figure out sum of day's durations for specified Week object? It would be great to have code example how to create a predicate object with @sum function.
Also i...
2009-07-21 12:47:14.458 FlashCards[1328:20b] * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (0) beyond bounds (0)'
...
I have a fairly simple question concerning NSString however it doesn't seem to do what I want.
this is what i have
NSString *title = [NSString stringWithformat: character.name, @"is the character"];
This is a line in my parser takes the charactername and inserts in into a plist , however it doesn't insert the @"is the character" ...
I am fairly new to Objective-C and was wondering what the best way to manage collections of tuples was. In C I would use a 2D array or a struct.
Should I be creating objects to contain these tuples? It seems like overkill for just sorting lists or is there no real extra load generated by object initialisation?
...
I'm trying to display text in a UITableView that's a response from a JSON containing something like "Congratulations you just won a prize!", and when I display it in a UITableView the first 9 characters are "corrupted" and display weird symbols.
When I do an NSLog("%@", jsonString); I see the text correctly.
Is there some type of UTF8...
I wonder what the -(void)viewDidUnload is good for. Could I not just relase everything in -dealloc? If view did unload, wouldn't -dealloc be called anyways?
...
Firstly, the platform is iPhone and label.text changes the label displayed. Consider this scenario:
I've an array of integers. And I want to display it on the screen.
Here's my take on it:
-(IBAction) updateText: (id)sender {
int a[2];
a[0]=1;
a[1]=2;
a[2]=3;
for (int i=0; i<=10;i++)
label.text = [NSString stringB...
Hi there,
I'm currently building an iPhone app that will display data from an NSMutableArray called "stories". The array structure looks like so (via NSLog):
2009-07-20 12:38:30.541 testapp[4797:20b] (
{
link = "http://www.testing.com";
message = "testing";
username = "test";
},
{
link = "http://www.testing...
Hello all,
Though I've done some development in Java and and a little in C(++), I'm totally new to Apple's Objective C and XCode.
Thus, I'm totally stumped by the following error message:
Building target “BatteryApp” of project “BatteryApp” with configuration “Debug” — (1 error)
cd /Users/soren/Documents/BatteryApp
setenv ...
Hello all,
I have created a NSMutableDictionary with the necessary strings and id 's
it looks a bit like this
Root
| |
Rows
|| -
Item1 (consists of key Exercise and a string:testing + a key ID and a string:OIK74 )
|| -
Item2 (consists of key Exercise and a string:testing3 + a key ID and a string:424RE)
|| - Item3 (cons...
OK So here's the plan. The XML I'm getting data from allows non-numeric text in phone number fields (for descriptions or contact names, etc). I am trying to extract only the numbers and call the tel: URL with them to initiate a call. Here's whats NOT working:
NSCharacterSet *charset = [[NSCharacterSet decimalDigitCharacterSet] invertedS...
what are the differences between implementating a @property with @dynamic or @synthesize??
thanks.
...
In my program I'm moving things based on rotation, but I'm not rotating the entire view. I'm Using :
static UIDeviceOrientation previousOrientation = UIDeviceOrientationPortrait;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[window addSubview:viewController.view];
[window makeKeyAndVisible];
[...
Here is my header file
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <PolygonShape.h>
@interface Controller : NSObject {
IBOutlet UIButton *decreaseButton;
IBOutlet UIButton *increaseButton;
IBOutlet UILabel *numberOfSidesLabel;
//IBOutlet PolygonShape *shape;
}
- (IBAction)decrease;
- (IBAction)incr...
I'm currently enumerating through NSMutableArray (or NSMutableSet) elements to find duplicates and remove them.
For example, if array/set has values [@"a", @"b", @"b", @"c"], the end result should be [@"a", @"b", @"c"].
Since I'm comparing NSStrings, I'm using isEqualTo: method to check if strings are equal.
Is there a more efficient...
I would like to subtract 4 hours from a date. I read the date string into an NSDate object use the following code:
NSDateFormatter * dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
NSDate * mydate = [dateFormatter dateFromString:[dict objectForKey:@"published"]];
W...