Tag: cocoa touch

Creating a drop down list

I want to make a drop-down list from scratch. Can anyone please tell me how to do so?

Xcode4 templates now use underscore on iVars?

I have noticed that with Xcode4 Apple has updated the application templates to include underscores before instance variables. // Xcode4 @property (nonatomic, retain) IBOutlet UIWindow *window; @synthesize window = _window; . // Xcode3 @property (nonatomic, retain) IBOutlet UIWindow *window; @synthesize window; I know there are differing opinions on the usefulness of this but I was […]

ivars in XCode templates prefixed with one or two underscores

Does anybody know why there are in XCode templates (at least in XCode 4.3.2) prefixed some ivars with two underscore and some with only one? For example the Master-Detail application template contains file MasterViewController.m, where one can find: @synthesize detailViewController = _detailViewController; @synthesize fetchedResultsController = __fetchedResultsController; @synthesize managedObjectContext = __managedObjectContext; Thanks.

Receiving data from UDP server on iOS app is not working from Linux server, but works from macbook pro

BACKGROUND: I made an IPhone socket application based on UDP. It works as a client and server while it communicates with a Linux [Ubuntu] server. I’m using a GCDAsyncUdpSocket to send and receive data. I also have a back-up server/client application on my Macbook to test/verify the socket communication application. It simply acts like the […]

UITextField settext not working

This is frustrating the hell out of me. I am a beginner programmer and cannot figure out why the text is not being changed. Here is my method which is supposed to set the text of a UITextField: -(void)updateDays:(NSInteger)days { NSString* daysString = [[NSString alloc] initWithFormat:@”%d”, days]; [daysTextField setText:daysString]; [daysString release]; } For whatever reason […]

How to dismiss popovers in iOS 5?

I have a PatientTableViewController in the master side of the iPad that has a button for Adding a new patient. It transitions to this NewPatientViewController via a popover segue. In the NewPatientViewController I have a Done button that delegates back to the PatientTableViewController: – (void)newPatientViewController:(NewPatientViewController *)sender withZipCode:(NSNumber *)zipCode andFirstName:(NSString *)firstName andLastName:(NSString *)lastName { [self dismissViewControllerAnimated:YES […]

Better way to select view controller using popToViewController: animated:

Consider: [self.navigationController popToViewController:[[self.navigationController viewControllers]objectAtIndex:1] animated:YES]; Is there a better way to get index of the view controller to pop to? This way if I do something to the nav stack, I don’t have to go back and edit this. I was thinking of maybe storing it in a ivar on the VC or using #define […]

Drawing a sketchy-looking line, programmatically

I would like to know if you guys have any idea of how I could possibly draw a sketchy-looking line on an iOS app. Currently I am drawing thanks to a UIBezierPath which I then render into a bitmap graphics context. How could I make the line look sketchy? // Produce and add points to […]

Get month number from month name?

Quick question, I have a list of months by name i.e. “Jan” “Feb” “Mar” “Apr” … etc. that I want to convert into 1,2,3,4 … etc. I have written some simple code to do this but was just curious if anyone knew a way to do this using any of the APIs.

Subclassing UIWindow

I am simply trying to subclass UIWindow so that I can intercept some notifications. Along with the code listed below I also go into MainWindow.xib and update the UIWindow object to my sub class. It loads up fine, problem is the tabs on my tab bar are unresponsive (in the example below I only added […]