cocoa-touch

Best way to display a game score on iPhone with cocos2d?

I am looking to persistently display a game score in an iPhone app using cocos2d. Going off the code that cocos2d shows the FPS the app is running at: -(void) showFPS { frames++; accumDt += dt; if ( accumDt > 0.1) { frameRate = frames/accumDt; frames = 0; accumDt = 0; } NSString *str = [NSString st...

COMET (server push to client) on iPhone

I'm looking to establish some kind of socket/COMET type functionality from my server(s) to my iPhone application. Essentially, anytime a user manages to set an arbitrary object 'dirty' on the server, by say, updating their Address.. the feedback should be pushed from the server to any clients keeping a live poll to the server. The buzzwo...

NSString's initWithData:encoding: return type issue

I have a couple of lines of trivial code such as the following: NSData *dataReply; NSString *stringReply; dataReply = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; stringReply = [[NSString alloc] initWithData:dataReply encoding:NSUTF8StringEncoding]; The problem here is, initWithData:encodi...

iPhone proper usage of Application Delegate

I'm looking to be able to reference certain state/objects through anywhere in my application. For instance, a user logs in to their application, I need to call a web service and retrieve the users information. Then I want to be able to access this information from anywhere in the application with something like the following: myAppDeleg...

Can the iPhone SDK obtain the Wi-Fi SSID currently connected to?

In the iPhone SDK I don't see the same SCDynamicStore used on Mac OS X to get the SSID name that your wireless network is currently connected to isn't available. Is there a way to get the SSID name that the iPhone is currently connected to? I see some apps do it (Easy Wi-Fi for AT&T for one) but I can't find hide nor hair of how it's do...

Passing object from controller to a view

I'm following iPhone dev courses from Stanford Open-University, and I've been blocked for 2 days on assignment3, maybe someone can help me here? The tasks are: Create a custom UIView subclass that will display your PolygonShape object Give your view class access to the PolygonShape object so that it can retrieve the details of the po...

Settings-style grouped table

So it's trivial to create a Settings style table on the iPhone. The problem is, they add a great deal of code as your Settings have a gamut of options/styled cells. One section might have a check list, another might have cells with accessory disclosures to drill down further, another might be labels with UITextFields. My question here i...

Best way to determine that a UIViewController has been loaded, and has a valid view?

When the view property of a UIViewController is accessed, it first checks to see if it's got an existing view, and returns that. If not, it loads its nib or calls -loadView. When a controller receives a -didReceiveMemoryWarning message, the default behavior is to remove that cached view (assuming it's not in use at the time). If I ov...

How can we combine images and get image object from this two images in iphone apps

Hi, How can we combine two images means i have two images and one small and another is big one. i want to combine small image into big one image at a specific CGPoint and i need object of UIImage. I have tried with CGCreateImageFromMask like that thats spread small image to whole portion of big image. Plsssss anyone help me..... Than...

Radio dial type functionality as seen on Where To? App

Straight forward question. I'm trying to understand UI design more and how to make it work with code. In particular there used to be an app that went through several design sessions, named Where To? by Tap Tap Tap. They had a table which they turned into a radio dial, screenshot: My question is, is this nothing more than 22 or so imag...

How to resize a tableHeaderView of a UITableView?

Hi, I'm having trouble resizing a tableHeaderView. It simple doesn't work. 1) Create a UITableView and UIView (100 x 320 px); 2) Set the UIView as tableHeaderView of the UITableView; 3) Build and Go. Everything is ok. Now, I want to resizing the tableHeaderView, so I add this code in viewDidLoad: self.tableView.autoresizesSubviews ...

UITextField in UITableViewCell's and proper usage

I have a complex settings style table where individual cells represent different aspects of a data model class. Users can click into a cell and edit individual attributes, such as say if I have a user class, a name, date of birth, etc. My question is, do I need to have an instance of UITextField for each unique cell? Can I just create on...

Accessing the iPhone's Call log with the iPhone SDK

I am building application that required some data from iPhone's Call log(read only). The call log is a sqlite db located at "*/User/Library/CallHistory/call_history.db*". I used a jailbroken device to extract the log. However trying to open this location using the *sqlite_open3()* command I get a *SQLITE_ERROR* error, which according to ...

What's the best way to validate currency input in UITextField?

My application allows the user to enter a numeric value (currency) in a UITextField control, but the keyboard layout that I wish was available is unfortunately not one of the built-in options, so I had to choose the "Numbers & Punctuation" option in Interface Builder. Here's the corresponding dialog window in IB: So when my applicatio...

Better way of handling UITableViewCell

I have a table which has roughly 10 cells, 4 different types. I subclassed UITextViewCell because I wanted to have an IBOutlet to a label and to a UITextField. Not sure if that was the best way of handling it, but it works thus far. Next, I had a cell for gender, so I figured instead of subclassing UITableViewCell, I took my already subc...

How would you implement an UITableView that detects horizontal swipes in order to allow paging?

I'd like to implement a UITableView which displays say 20 rows at a time. But given the fact that I might actually have say 120 items to present, I'd like to handle this using some sort of paging: Populate table with first 20 items. When the user does a right-to-left swipe, reload the UITableView with the next 20 items. A left-to-right ...

Application crashes on iPhone OS 2.2, works fine on 2.1.

This is the trace of my app,when I updated my device to 2.2. any idea to get rid of this leak? because I think that's the culprit who keep crashing my application. This is trace when I run my application in os2.2,see the image which show the part which might be generating leak,and if you can give me some hints to resolve it, will be gre...

Why isn't the navigationItem.titleView working?

I'd like to put in an UIButton in the center of the navigation bar. Based on the document, it appears I need to set title view, and make sure the leftBarButtonItem is nil. But it is not work for me. Here is the code. UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [btn setTitle:@"List" forState:UIControlStateNormal]; ...

UIButton to cover a UITableViewCell

I'd like one of my table rows to be a button that takes up an entire row of my UITableView. I figured the best way to go about this is to instantiate a UIButton, and give it the same frame size as an instance of UITableViewCell, and add that as a subview to the cell. I'm almost there, but quite a few pixels off to not get that perfect to...

Is it possible to cache resources loaded in an iPhone UIWebView?

I have a simple app loading a site optimized for the iPhone in a UIWebView. Problem is, caching does not seem to work: [webView loadRequest: [NSURLRequest requestWithURL: [NSURL URLWithString: url] cachePolicy: NSURLRequestUseProtocolCachePolicy timeoutInterval: ...