cocoa-touch

Cocoa Touch - Hypothetical Lag Comparisons

Hey all, I'm developing a rhythm game for the iPhone at the moment, just wondered if anyone had any thoughts on the best pieces to use for reaction time. I have all the coding worked out, and I've narrowed it down to about 2 ways: 1: Using instances of UIButton that bypass the UIControlEvent or whatever, in order to use touchesBegan an...

How would I add networked multiplayer support to an iPhone game?

I am looking to extend an iPhone game by adding support for networked multiplayer capabilities (preferably over WiFi). How would you suggest I add this functionality to this application? ...

Receiving errors when trying to draw with UIBezierPath

Hello, I'm trying to draw some lines inside my custom UIView. From what I can see, to save messing around with CoreGraphics, I can use UIBezierPath (i've done similar with NSBezierPath on the Mac). I have some code that tries to draw the lines but I get output errors and can't find a decent reference with some sample code to illustrate ...

Iphone: stop execution of code when alert is shown in a viewWillAppear implementation

I have a working application before the first view is loaded, i put an alert in the viewWillAppear method: - (void)viewWillAppear { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"MyAppp" message:@"Application will connect to Internet. Continue?" delegate:self cancelButto...

IPhone Memory Management: What do I need to release inside dealloc?

So say in my viewcontroller's .h file I have: @interface MyViewController : UIViewController { IBOutlet UILabel *myLabel; IBOutlet UIView *myView; IBOutlet UIImageView *myImageView; IBOutlet UIButton *myButton; NSNumber *myNumber; NSString *myString; NSMutableArray *myArray; UILabel *myCurrentLabel; SomeObject *myObject; CGPoint my...

Dismissing the keyboard using firstResponder

To dismiss the keyboard I use either one of the following: [sender dismissFirstResponder] [self dismissFirstResponder] The problem is, I have a situation where the user selects a text field, and some other text field is the first responder with the keyboard showing. I want to dismiss the keyboard when this particular text field is sel...

How to share an object between two class methods

I created an object in the method viewDidLoad:. In another method that I create, I want to access this object. One way to do it is to declare the object in the h file. Another way to do it is to pass it as a parameter. Are there any other ways? ...

[iPhone] How to write XML files?

Hi. I want to write a not so complicated but large file within my app and be able to send it by mail (using MFMailComposeViewController) Since NSXMLElement and related classes are not ported to iPhone SDK what options do I have for creating XML documents? Thanks in advance. ...

UIKeyboard extra keys.

I am looking for a way to add extra keys to a UITextView's keyboard or add a UIToolbar above it. How might I go about this? EDIT This is for an iPad app and if I was to add extra keys I would need a new row for them in the UIKeyboard. ...

Dynamic UILabel content inside of a UIScrollView

I've got a UILabel (amongst other controls) stored within a UIScrollView. I want to dynamically populate the UILabel so that it automatically expands its height to fit its contents. I'm just wondering what the best practice is with regards to resizing the UILabel while also ensuring that its parent UIScrollView will also expand its scrol...

How to recreate the animation in the Notes iPad app?

When you use the Notes iPad app (from Apple) in landscape mode, you see the list of notes to the left. If you select a note you see a nice little animation that looks like someone is marking the note with a red pencil. I already have a graphic that looks like that red circle, but how do I animate it like that? Thank you in advance. Edi...

Repeat sth every 10 seconds except NSTimer

how to repeat sth every 20 seconds ?(except NSTimer) ...

UITapGestureRecognizer Stops touchesEnded

I'm trying to make an iPhone app that is controlled by touch. I also want a powerup to be activated when the user double-taps. Here's what I have so far: UITapGestureRecognizer *powerRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(usePower)]; powerRecognizer.delaysTouchesEnded = NO; powerRecognizer.numb...

Kill a task after 10 seconds in Core Data

I have a function that sometimes takes too long to run. I want to attempt to run it for 10 seconds, and then just kill it if it's not done. How do I do this in Objective C on the iPhone? Creating the persistent store coordinator is failing for some users who have a lot of data in their database, because the object model merging takes to...

How to sort an array of objects by their NSString property

I have an array of custom objects. One of the properties of these objects is an NSString. I want to sort by that property. Because it is an NSString and not an NSNumber sorting is a little more difficult. Is there some kind of class method to help in this case? How should it be done? ...

How do I show another window in an IPhone window application

First of all, I'm new to Objective-C and IPhone programming. There is somehing I can not get to work. I have a IPhone window application and in the MainWindow I have a button. I want to show another window when I click the button. I've bind the event with my controller. I just don't know how to show my other window (otherWindow) in th...

How should I fix this code?

I'm trying to sort an array of people objects. The class looks like this. Person ------- name phone I have an NSMutableArray filled with these objects. I want to sort this array by the name of each person object. This is the code I tried. NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey: @"name" ascending: YES]; [pers...

How to make navBar's title located at center ?

Because the navigationItem.rightBarButtomItem is customized, it will occupy a big place and the title view won't be on the center. For example, I want the "OMG" is located at the center between buttoms of "Home" and "Group". How to achieve this? ...

iPhone Camera pictures from UIImagePickerController are sideways

Hi, My application supports taking pictures from iPhone in portrait mode and upload to the server. However, the pictures taken are appearing in sideways once uploaded to the server. Please help! -KC ...

warning "initialization makes pointer from integer without a cast"

NSString *titl = [database executeNonQuery:@"SELECT * FROM numberquestion"]; gives warning "initialization makes pointer from integer without a cast" What is Wrong? Table "numberquestion" contains only one string "twenty" of type TEXT Thanks in advance Ur suggestions are most welcome. ...