iphone

How to set a property of a UIKit class or subclass for all future instantians?

What sort of Objective-C runtime magic do I need to use to make it so a property for an object is always set to a value than its normal default. For example, UIImageView's userInteractionEnabled is always false, but I want to my own UIImageview subclass to always have userInteractionEnabled set to true. Is the same thing achievable wit...

iPhone + Facebook API: how to detect when need to ask for "extended permissions"?

i just started using Facebook Connect for iPhone. I've been able to create a login/logout button, initiate and resume sessions, and update the Facebook status. However one thing I can't figure out how to do is detect when I need to ask for extended permission (such as is required for updating user status). Once this is done once for m...

Portrait UITabBarController on one view, Landscape view on another UIView, not working.

Hello guys, and heres the deal. Im trying to get a few of my views to play nicely together, but unfortunately i must be missing something. heres the over view i have Application Delegate UIViewController containing a tabbarcontroller UiViewController containing an OpenGL view (needs to be landscape) The application Delgate handles ...

Compile error on action for iPhone app: "error:expected ')' before ';' token"

I'm working through the tutorials in the "Beginning iPhone Development" book. I'm on chapter 4 and I'm getting the following compile error on the "if (segment == kShowSegmentIndex)" line: error:expected ')' before ';' token Here's my code: - (IBAction)toggleShowHide:(id)sender{ UISegmentedControl *segmentedControl = (UISegmentedC...

Reading data from a plist file

I'm trying to implement a Save State for my iPhone App. I've got a plist file called SaveData.plist and I can read it in via the following NSString *pListPath2 = [bundle pathForResource:@"SaveData" ofType:@"plist"]; NSDictionary *dictionary2 = [[NSDictionary alloc] initWithContentsOfFile:pListPath2]; self.SaveData = dictionary2; [dict...

MFMailComposeViewController address book picker customization

Is it possible to customise the behavior of how the ABPeoplePickerNavigationController is displayed modally from the MFMailComposeViewController whenever a user presses the '+' icon in the 'To:' and 'Cc/Bcc:' fields? I want to wrap the ABPeoplePickerNavigationController inside of another view controller before it is being presented moda...

Where is a good place to place Category in Obj-c?

I've addeda category to NSString. I've tried to place the code in my appDelegate.h and it works. However, I've tried placing it in another .h file that I included from .pch file so that this category can be used project wide. However I kept getting the following error: ld: duplicate symbol .objc_category_name_NSString_StringTrim in .......

NSMutableDictionary throws a doesNotRecognizeSelector to objectForKey?

I'm a total noob to iPhone programming, and I've run into an exception being thrown that I just can't wrap my head around. Background: The error is happening in a custom subview, and occurs immediately upon loading the program. I'm getting an exception thrown in the overridden drawRect method. The code throwing the error follows: - (vo...

iPhone SDK2.0 vs SDK3.0 discrepancies

the following code yield a standard animation when user selects between tabs on sdk2.0 through 2.2, on sdk3.0 devices it does not. I'm still compiling against 2.0 or 2.2 sdk but running on a device that runs 3.0 version of the OS. descrepcincies code: - (void)tabBarController:(UITabBarController *)controller didSelectViewController:(...

UIActivityIndicator not showing up

I have a login for in which i need an activityindicator to be shown just after i press login button. In the button action i am calling my method to login a user (i have called [sratAnimating] in the top of the method). But issue is that, when i press login, after excecuting the logic only its showing activity indicator. Why is this ? a...

Converting & to & in Objective-C

Hi All, I have a URL string in the following format. http://myserver.com/_layouts/feed.aspx?xsl=4&web=%2F&page=dda3fd10-c776-4d69-8c55-2f1c74b343e2&wp=476f174a-82df-4611-a3df-e13255d97533 I want to replace & with & in the above URL. My result should be: http://myserver.com/_layouts/feed.aspx?xsl=4&a...

how to Clear the iPhone app cache

Hi All, I am trying to browse a webpage using NSURLCOnnection. Everytime it is using cached data,its not getting latest webpage. How to clear the iPhone app cache. Thanks ...

iPhone - notification posted twice after memory warning

Hi I am using notifications to pass data from a detail view controller to the rootviewcontroller in my app. The methods work fine until there is a memory warning. The notification is handled twice after any memory warnings. I pass data back to the rootviewcontroller when the user selects a row in the DetailViewController. The didSelec...

Why OpenGLES stretch my 3D Model?

I created a simple 3D model in Blender, and imported this into OpenGLES for the iPhone SDK. The model imported with no problems for the most part but as you can see from the included photo links (photobucket), OpenGL is stretching the model beyond its intended proportions. The circular cylinders are made ovular, the squat rectangular bod...

Default.png shows in simulator but not on real device iphone?

i have added a splash screen to my application by adding Default.png. the splash screen works fine in the simulator but not showing on real device ...

How do I position a control created in UIKit quickly?

Is there a quick way to position a ui control (such as bottom center or top center)? Right now I routinely set the frame of the UIcontrol or UIView subclass to position them but would like to know if I can avoid doing calculation just to centralize a control. ...

resignFirstResponder for numberpad

There is a text field to enter PIN in my login form. When i press "login" button i call the following method: * (IBAction) loginBeforeAction:(id) sender { [pin resignFirstResponder]; [progressView performSelectorInBackground:@selector(startAnimating) withObject:nil]; [self login]; } but i the number pad is not hi...

Xcode: What's up with the .NIB -> .XIB?

Hi, What's up with the NIB->XIB change somewhere between Xcode 3.0 to 3.1? Is there any difference with this name change that I should know while I go through tutorials that mention nothing but the .nib file? ...

Find whether user is running iPhone OS 2.x or 3.0

Hi Is there any way I can find out in my app if the user is running it on a device with OS 2.x or 3.0? I tried adding a tag like the iPhone project templates do, but it doesn't seem to work. #ifndef __IPHONE_3_0 //MY CODE FOR 3.0 GOES HERE #else //2.x CODE HERE #endif Thanks. ...

Random number function is misfiring

I have a very simple iPhone app that requires a random integer from 1-100. I have a button that calls the random number function then displays it. -(IBAction)buttonReleased; { srandom(time(NULL)); int theNum = random() % 100 + 1; numberDisplay.text = [NSString stringWithFormat:@"%d", theNum]; } The problem is, if I press...