cocoa-touch

How do you change the UIControl with focus on iPhone?

I am trying to do something I thought would be simple. I have a form with two UITextFields on it. I am using the UIReturnKeyNext style on the first. The idea is that when the user fills in the first field, they click Next and I transition them to the next UITextField. I've seen other apps that do this and it works really well. But I can...

Releasing memory for objects added using Interface Builder

I have a situation where I build a view with a table and another view for table header (containing images and labels and buttons). Now I connected the table, image, labels, buttons to variables in my Controller class. Should I release the memory in -dealloc method for all those variables that I connected using Interface Builder? I believ...

iPhone Attributed String

Any ideas on how to get the functionality of an attributed string on an iPhone. Specifically, I am writing out chemical compounds and want to properly display subscripts: for example: H2O (the 2 should be a subscript) Thanks for any suggestions ...

Stay on the MPMoviePlayerController after playback finishes

I am using a tableview and when the user selects a row, I am playing the video associated with the row using an MPMoviePlayerController object. Now as soon as the playback finishes, MPMoviePlayerController is released and control goes back to the previous controller. How can I prevent this from happening? I want to take the user back to...

iPhone Development - EXC_BAD_ACCESS error with no stack trace

Here's my case: I have a table view showing contacts. Add button in the navigation bar is used to load another view for data entry. This new view has images in table header, and each table cell has either a UITextField or a UITextView. When i press Cancel, the view is popped out and memory is released. Here's my issue: When i open the ...

How to connect to a MySQL database from an iPhone?

I am trying to connect to a remote mysql database from an iPhone. I have searched many web sites but I did not find any help. If anyone has worked with this please send a solution. ...

Should i use @property for Controller Classes variables?

Question is should i use properties for my view controllers? Consider the following case: I have a view controller object in my parent class: MyViewController *myVC; I don't release this view controller in parent class's dealloc method. I use view controller like this: // Allocate and Initialize view controller myVC = [[MyViewControl...

How to reset to identity the "current transformation matrix" with some CGContext function?

I'm doing a series of translations and rotations on the CTM and at some point I need to reset it to identity before going further with transformations. I can't find any proper way to do it (obviously, there should have been a function named CGContextSetCTM or so) and since efficiency is the key, I don't want to use CGContextSaveGState/C...

Rendering a UIWebView into an ImageContext

I am trying to capture the contents of a UIWebView including that which is not visible to the user. i.e. The whole web page even though the user is only looking at the top. Looking around I found the best way to capture a UIView is to retrieve its layer and use renderInContext. However, UIWebView seems to be using its own CALayer imple...

Nested UIScrollView does not paint

I am building an application which allows the user to view and edit data on a daily basis. To accomplish this i have created a view in Interface builder which contains all of the daily data, and i "tile" this view within an appropriately sized UIScrollView to allow the user to swipe between the days. The view contains two UITextFields,...

Handling RSS Tags with NSXMLParser for iPhone

I've found the following code for parsing through RSS but it does not seem to allow for nested elements: - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ NSLog(@"ended element: %@", elementName); if ([elementName isEqualToString...

Why NSUserDefaults failed to save NSMutableDictionary in iPhone SDK?

I'd like to save an NSMutableDictionary object in NSUserDefaults. The key type in NSMutableDictionary is NSString, the value type is NSArray, which contains a list of object which implements NSCoding. Per document, NSString and NSArray both are conform to NSCoding. I am getting error : -[NSUserDefaults setObject:forKey:]: Attempt to i...

Google App Engine with ClientLogin Interface for Objective-C

I'm experiencing the same problem in this previous stackoverflow.com post. Specifically, I seem to be able to get the "Auth" token correctly, but attempts to use it in the header when I access later pages still just return me the login page's HTML. Following links related to this post, I've determined that you need to make a subsequen...

In TabBarController + NavigationController mix env, how to reset nav when tab changes?

I am building an app, which has TabBarController, and each tab view has navigation view controller. When user click tab, I'd like the relavent navigation view controller to "reset" to the root panel. In my code, I uses the following way to initialize the tab and navigation controller. viewController1 = [[MyFirstController alloc] init];...

Lower case "k" in Cocoa

I know this is a common convention, but what does the "k" in variable names signify? (i.e. kMaxImageViewSize) I looked in the Apple documentation on Variable names and found no mention of it. Thanks for answering ...

Display an alert over the lock screen?

On the iPhone, when your phone is locked and screen off, if a SMS message comes in, the screen turns on and an alert shows up. Currently I am using UIAlertView to create the alert dialog (with 2 buttons). If the phone is off/locked, nothing shows up until I turn it back on and unlock it. Is there any way to simulate the 'SMS preview' be...

What does the NS prefix mean?

Many classes in Cocoa/Cocoa Touch have the NS prefix. What does it mean? Thanks ...

What's the best way to trim whitespace from a string in Cocoa Touch?

I'm looking to determine whether a string value from a user input (UITextField) is "blank" if it's not nil. Checking if [textField.text isEqualToString:""] isn't quite enough because I want to avoid any blank/whitespace input (like say a few space characters). There does seem to be an indication of a good solution for my particular pro...

How can I test landscape view using the iPhone Simulator?

I wonder if I can test landscape view using simulator? ...

iPhone image distortion

Are there any reasons why the simulator will display UIImageViews properly, but incorrectly on the iPhone? My Process: An image in a PNG file Start a UIGraphicsBeginImageContext() Draw the PNG in a CGrect Draw text in the CGRect Create an UIImage from the context Set the image of a UIImaveView to the UIImage Set the frame of the UIImag...