cocoa-touch

[super init] and loading NIB / XIB files?

I am a little curious, I have a view controller class and an NIB/XIB (both are named "MapViewController") If I do the following it loads the NIB with the matching name. -(id)init { self = [super initWithNibName:@"MapViewController" bundle:nil]; if(self) { do things ... } return self; } if on the other hand I ju...

Create object from NSString of class name in Objective-C

I was wondering if i could create a object of some class if i have the name of the class in a NSString. I know this is possible in other languages like ActionScript, C# and PHP... Something like this: NSString *className = @"AwesomeViewController"; UIViewController *object = [[className alloc] initWithNibName:className bundle:nil]; ...

Problem adding UITableViewCell manually

I am trying to add a UITableViewCell at the very bottom of my UITableView programatically. I am getting an index out of bounds error, which I am not sure how to resolve: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [items count]+1; ...

UITableViewCell is 1px shorter in didSelectRowAtIndexPath than cellForRowAtIndexPath

I have a UITableViewCell that I create in tableView:cellForRowAtIndexPath:. In that method I call: UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease]; NSLog(@"Cell height: %f", cell.contentView.frame.size.height); This gives me a return value of 44.000000. Then...

i cannot set the title for my navigationBar

here's my problem. i couldn't set the name for my navigationBar.. below are some i have tried but to no avail. - (void)viewDidLload { [super viewDidLoad]; self.title = @"Food"; } - (void)viewDidLload { [super viewDidLoad]; [self.setTitle:@"Food"]; } - (void)viewDidLload { [super viewDidLoad]; MyTableViewController *myTab...

iPhone noob - setting NSMutableDictionary entry inside Singleton?

Yet another iPhone/Objective-C noob question. I'm using a singleton to store app state information. I'm including the singleton in a Utilities class that holds it (and eventually other stuff). This utilities class is in turn included and used from various view controllers, etc. The utilities class is set up like this: // Utilities.h...

Shake based application

hi frnz, i am developing an application which deletes rows from a table view when the user shakes the iPhone.i have created a navigation based project. now when the user shakes the iPhone i want that the title of navigation bar should change to "DELETE" and a delete button should appear on the navigation bar on the same view (but th...

Simple ViewController / View, remove white bar?

I am just looking at setting up a simple viewController programatically, I have a ViewController.xib file that I have set the background color to RED in interface builder. I have also added the following to my AppDelegate.m @implementation syntax_MapViewAppDelegate @synthesize window; -(BOOL)application:(UIApplication *)application did...

How to page-scroll on a uiscrollview?

If I've got a uiscrollview which is five pages wide, what code would tell me what page I am on, when I scroll to a new page? Also, what code would scroll to a specific page? Thanks! ...

@property, ok in this situation?

I am still finding my feet with objective-c and was wondering if its acceptable to use @property on the two objects below. #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface MapViewController : UIViewController <MKMapViewDelegate, CLLocationManagerDelegate> { CLLocationManager *locationManager; IBOutlet MKMapView *goo...

Protecting from crashes (beyond bounds) with [object objectAtIndex:]

Hi! I'd like to know if there's a way to verify if an index exists before getting it. So it'd be way to protect my code against: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (2) beyond bounds (0)' Like in PHP you can do: isset($object[10]); and it'll return true if...

Changing UIBarButtonItem colors

Hi! This is a pretty simple question and I really can't find the answer! So okay, by default if I set the tintColor of a UIToolbar, the UIBarButtonItem's colors will be the same. I only want to change the colors of my UIBarButtonItems and also change their text's colors. Is there anybody out there having an idea on how to do so? I r...

NSManagedObject How To Reload

I have a view that consists of a table of existing objects and an Add button, which allows the user to create a new object. When the user presses Add, the object is created in the list view controller, so that the object will be part of that managed object context (via the NSEntityDescription insertNewObjectForEntityForName: method)....

Non-fullscreen UINavigationController

Is it possible to use a UINavigationController in such a way that it doesn't use the full window? I've tried setting it's view's frame as well as adding it's view to another (non-fullscreen) view instead of the window, and neither seems to work. ...

Possible to alert server to iphone settings change?

I'm working on giving our users context-specific PUSH notification settings, similar to what Facebook has in their settings menu. As far as I can tell though, there's no way to actually notify our server of these changes until the user actually launches the app. Is this correct? Is there any mechanism provided for immediately alerting...

UITableViewCell is transparent when not supposed to be

My UITableViewCell is being transparent when it's not supposed to be. My table view has a background color and it shows through the table cell, even though they're supposed to be opaque. I'm not sure why this is. Relevant code: UITableViewCell *cell = [table dequeueReusableCellWithIdentifier:emptyIdentifier]; if (cell == nil) {...

iPhone "Quick Start" tutorial question.

Newbie at coca touch/xcode and the iPhone. Within the "Quick Start" tutorial, I would like to extract the StreetKey. ...

Microphone question in iPhone SDK

I am trying to do an app, to where when it launches, it will detect audio, and then play it back automatically. NO BUTTONS, nothing to press. Just a picture of something then, it listens for audio, then plays it back. Similar to the Talking Carl app in the App Store. Any ideas/help? Would appreciate it, if i could use the code with IB. ...

Can't resignFirstResponder with UITextView

I have a UITextView. I implemented a navigationBar UIBarButtonItem to respond to a touch and resign the firstResponder for my UITextView. But, when the selector method is called, the keyboard doesn't get dismissed. I checked the UITextView's responder status with isFirstResponder and it returns YES. I also checked it with canResignFirs...

How can I remove UISwitch drawing glitchiness?

My app has a lot of switches, that I create programatically, and sometimes they draw really weirdly. The right or left end is all open and the text is weird. I thought that this was an issue on on the simulator, but I have just got my iPad, and they're appearing sometimes there. I have not customised these switches via any private APIs. ...