cocoa-touch

Pickerview with two components.

I had used the below code to get the row index of the picker view with two components. But there is two warnings saying "Local declaration of pickerView hides the instance variable. Anyone please help. (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { int pos1 = [pickerView sele...

Can a method return an NSRange?

I have a method that returns an NSRange. When I call this method from outside the class I get a compile error. NSRange tmpRange; tmpRange = [phrase rangeInString:searchString forString:theLetter goingForward:YES]; return tmpRange.location == -1; in the .h file: #import <Foundation/Foundation.h> @interface Phrase : NSObject { } - (...

Speed Problem - Animating Height Change in UITableView

So I have a huge UITableView, between 1000 and 3000 rows. Each row needs to, when selected, expand to include several buttons. I do this by rendering the buttons below the cell, enabling clipping on the cells, and then just animating a change in height when they're selected. So I have heightForRowAtIndex checking if the row is selecte...

Serialize state data from NSUndoManager on iPhone

I've got undo/redo set up in my iphone app, and now I'm looking at saving state, so when the user exits the app and then starts it up again, everything is in the same state, including the undo/redo stack. I don't see any obvious way to serialize the NSUndoManager. Is there a good way to accomplish this? ...

Does iPhone support "greying out" inactive controls?

I have a control that goes inactive under some conditions in my iPhone app. I can [setUserInteractionEnabled: NO] on it and it doesn't respond to touches. Its appearance does not change however. Other environments I am familiar with "grey out" inactive controls. I wonder what is the idiomatic way to hint to the user that the control is i...

UIKeyboardTypeNumberPad on iPad

UIKeyboardTypeNumberPad doesn't display a number pad on the iPad. Instead, it shows the UIKeyboardTypeNumbersAndPunctuation keyboard. Is there something I'm missing, or has this been removed from the iPad OS? Thanks for your guidance! ...

key value coding-compliant for NSObject class?

I've created a singleton class that loads a plist. I keep getting this error when I try to set a value: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key test.' I have one key in the plist file. The key is named "test" and has no value associated with it. I set the value like this: [[PlistManag...

initializer element is not constant error.

i am declaring cg-point or rect as const it giving above error any one help this,, #import "newViewController.h" #import "first.h" const CGPoint point=CGPointMake(50,50); ...

How to set probability for the sprite in shooting game ?

My game is a small shooting game in cocos2d. The enemy generates the bullets to shoot player at intervals of time. I have created a random y , so that bullets touch the opposite edge at random heights. If the bullet touches the player the enemy wins. But, I need to set probability for the enemy accuracy. If the probability of enemy is gi...

How to get the play list of song in iphone programmatically

How to get the play list of song currently playing in iphone programmatically? I could use the following code to get the song's artist: [currentItem valueForProperty: MPMediaItemPropertyArtist] I couldn't find the property for the song's playlist. ...

Problem with UINavigationController

Hi all! I'm creating an game in which I need to provide this facility of being able to come to the first screen from any level, and go to any level from first screen(in case of RESUME), for which I'm using a navigation controller. The problem I'm facing is I dont want this pushing to look animated so I wrote [self.naviga...

How do you load a view on top of another view in the iPad

How do you load a view on top of another view in the iPad like in the wordpress app when it asks you to setup your blog. Can you show or post me some sample code. I have an NSUSerdefaults setup so it will display this on the first launch. I would like this view to look like this http://uplr.me/files/p45064.png See how it has the shaddow...

Is it possible to make a for on a NSDictionary object?

Hi, the question explains it all. For instance, if I have a NSDictionary like this first = ("a", "b", "c"), second = ("d", "e", "f") third = ("g", "h", "i") And I'd like to loop on them to make some operations. Is it possible? Thanks ...

Where should I put some code for loading application data?

I have a tab-bar and navigation controller application (like Youtube app or Contacts app). Where is the correct place to have the code for loading some data from the web? These data are necessary for all the tabs of the Tab Controller and the app can't display anything before all data are downloaded and parsed from the app (except a loa...

self.clearsSelectionOnViewWillAppear will not compile

This bit of code comes with new classes that are subclasses of UITableViewController... - (void)viewDidLoad { [super viewDidLoad]; // Uncomment the following line to preserve selection between presentations. self.clearsSelectionOnViewWillAppear = NO; // Uncomment the following line to display an Edit button in the navi...

Force scope bar below UISearchBar

I have a UISearchBar and UISearchDisplayController, everything works great but my scope selector displays beside the text field instead of below it. I know that this is the expected action when the device is in landscape, but since I have the UISearchBar in the master view of a UISplitViewController it ends up looking like this http://cl...

Adding a button inside an image.

CGRect frame = CGRectMake(round((self.view.bounds.size.width - kImageWidth) / 2.0), kTopPlacement, kImageWidth, kImageHeight); self.containerView = [[[UIView alloc] initWithFrame:frame] autorelease]; [self.view addSubview:self.containerView]; // create the initial image view frame = CGRectMake(0.0, ...

Best way to show a loading screen in an iPhone app?

I'm building what is essentially a web app. Every piece of data has to be fetched from a web API. So, every UITableView that I show takes some amount of time to fill with data and I'm struggling to find a good way to show the user a loading screen. Right now I'm popping up an action sheet, but that just seems a bit wrong. Ideally, I'd p...

UIView animation -- horizontal page curl... like a book?

I'm pretty sure I've run across this animation at some point, but I can't remember where or how to do it! I want the equivalent of UIViewAnimationTransitionCurlDown but a full page horizontal curl. Does anybody have code that does this? Thanks! ...

Count string value?

Hey, Im a newbie in cocoa and I have a string and I am trying to count how long it is. I have been searching through Apples docs but I can't find anything. NSString *word = @"word"; How would I figure out how many characters is in a string? Thanks ...