cocoa-touch

iPhone keyboard popup problem in UIAlertView

I want to accept password using an alert view. Following is the code I am using. But I am unable to figure out why does the keyboard pop out two times instead of once? Any ideas? UIAlertView *passwordAlert = [[UIAlertView alloc] initWithTitle:@"Enter Password" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherBu...

Can an iPhone xcode application read cookies previously stored by Safari Mobile?

Can an iPhone application read cookies previously stored by Safari Mobile? ...

How to dissallow certain characters in a UITextview

I have a uitextview that is editable but there are certain characters I would like to be disallowed from being typed. How can I do that? ...

How to cancel a touch sequence

I have an UIImage view that responds to touch events. I want to cancel the touch sequence if the touch goes outside of certain bounds. How can I do that? I know that I can inspect the coordinates of the touch object, what I don't know is how to cancel the sequence. I don't see any event in the API that allows for that. ...

Is there a way to avoid errors when releasing an object while code is still running?

I have a UIView subclass that draws itself when -drawRect: is called. It only takes a moment, but under extreme circumstances, such as low memory and deletion of the instance when going to another view controller, the draw function doesn't complete before the the object is deallocated. How am I supposed to deal with this issue? The de...

How rotate view to landscape in a tabbar app

I have a tabbar based app. I build 2 views, one in portrait and another in landscape mode in the Interface Builder. Now, I wanna something like the iPod App. I wanna the landscape view to be fullscreen, and hide the tabbar & the status bar. I make to work the basic of this: - (void)willRotateToInterfaceOrientation:(UIInterfaceOrienta...

iPhone Simulator - set HTTP proxy

I'm coding an iPhone app that needs to make small HTTP requests to the Internet. Within our corp LAN, all HTTP traffic has to go through Squid. The simulator is clearly capable of using a proxy - since Mobile Safari works. But, how do I get/set the proxy settings in code? A bunch of the headers are commented out for the simulator. Fo...

How to add NSDebug.h and use NSZombie in iPhone SDK

I want to enable NSZombies for my iPhone app. I have read several articles online and I am still unsure of the exact procedure. I know I have to set the Environment Variables, which I have done: NSZombieEnabled = YES NSDebugEnabled = YES NSDeallocateZombies = NO I think (I'm not sure), I have to import NSDebug.h. When I check the head...

UIPicker sizing in landscape mode

I am trying to develop an app with a UIPicker in landscape mode, taking up (almost) the entire width of the screen (with 5 or 6 components). Can you please tell me how to set the size of UIPicker. Thank you very much for your help. ...

Two Asynchronous NSURLRequests using Cocoa Touch

I am using the example shown here - listing's 1-5 to request the content of a URL and everything is working perfectly. Now my problem is, while the first request is sent off, I want to request content from a second web page, my problem is, even if I duplicate everything there for a second request and connection, and create another variab...

Can you put a button in the Preferences for your iPhone app?

I'm building an iphone app, and I wanna use the iPhone's built in Preferences stuff. It looks like I put options in there, but I'm interested in putting a Reset button in the Prefs. I see that Apple's built-in apps like Safari have buttons in their prefs (Clear History, Clear Cookies, etc). I don't see a way to do this for SDK apps. H...

How to change image and disable UIBarButtonItem

I have a NavigationBar app with two views: a parent and a sub view. In the sub view I'm adding a button to the right corner as follows: - (void)viewDidLoad { UIBarButtonItem *tempButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"lock-unlocked.png"] style:UIBarButtonItemStylePlain target:self action:@selector(lock...

Storing custom objects in an NSMutableArray in NSUserDefaults

I've recently been trying to store the search results of my iPhone app in the NSUserDefaults collection. I also use this to save user registration info successfully, but for some reason trying to store my NSMutableArray of custom Location classes always comes back empty. I tried converting the NSMutableArray to a NSData element as of th...

Changing Device Orientation for a particular UIViewController subclass

Hi, I want to change the device orientation when a particular view appears. I got much information on the action to be taken when the orientation changes but I am not getting how do I change the device orientation itself programatically. Note that my other views must remain in the default orientation. ...

How to message superview in Objective C

Hello. I am new to Objective C and Cocoa. I just don't get it how to message the superview of an UIView. I can't get it work. Here is what i tried so far: In my MainView i have a method named resetDrawType: - (void) resetDrawType { self.drawType = foo; } Also in the MainView i create a subview and add it to MainView: mySubView *m...

UIImagePickerController camera preview is portrait in landscape app

In my landscape-only iPhone application, I launch a UIImagePickerController to take a photo, but the live image displayed from the camera is in portrait orientation, with blank space around it. The image is rotated. Once the camera button is pressed, the preview is very messy, with most of the preview off screen, and views not correctly...

Memory management. Is this single line of code correct?

Do I have a leak with this statement? //Pass the copy onto the child controller self.childController.theFoodFacilityCopy = [self.theFoodFacility copy]; My property is set to: @property (nonatomic, retain) FoodFacility *theFoodFacilityCopy; The reason I think I have a leak is because copy retains the value and then my dot syntax prop...

iPhone: one nib, different assets. Bundles?

I have an iPhone application that comes in differently skinned flavors, with different art assets and sounds, but all the same code. I've got things set up with multiple targets, but the problem I'm having is I have to have a different set of UIBuilder nib files, one per view per target, set up to point to the correct art for that targe...

Whats the best way to add variations of the same character to a view in Cocoa

I am confused about how to go adding objects (images,etc) into an app. I will keep my example very basic so I can get a grasp on this. Let's say I want simple objects in an app. Say they are the smilies like the ones that are available in this forum software. If you wanted to add a bunch (like 4 not 400) to a view, is it better to just a...

MGTwitterEngine - Status updates

I find that randomly I get a EXC_BAD_ACCESS error on the iPhone when updating the status. This occurs pretty randomly. Anyone have any idea to how this make be fixed? #import "TwitterViewController.h" NSString *_testUID = nil; NSString *sImageName; @implementation TwitterViewController //Turns NSLogs into comments //#define NSLog //...