Tag: iphone

How to detect Keyboard key pressed in iphone?

I want to detect whenever the user presses any keyboard key. Any method which is called only on typing any character and not when keyboard is shown. Thanks!!

How to add line break for UILabel?

Let see that I have a string look like this: NSString *longStr = @”AAAAA\nBBBBB\nCCCCC”; How do I make it so that the UILabel display the message like this AAAAA BBBBB CCCCC I dont think \n is recognized by UILabel, so is there anything that I can put inside NSString so that UILabel knows that it […]

How can I locally detect iPhone clock advancement by a user between app runs?

A common exploit in casual games is to artificially advance the system clock to jump ahead in gameplay. How can such user clock advancement be detected by an app on an iOS device? Must not involve network communication Must not assume app is open (running or suspended) while clock is advanced Must detect clock advancement, […]

How can I use private APIs to block incoming calls in an iOS application?

I would like to be able to selectively block incoming calls in an iOS application I’m writing. This is intended for personal use, not the App Store, so I’m fine with using private APIs to accomplish this. I have recently come across the Core Telephony framework. Is there a way to use this framework to […]

why always return -1

-(void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; if([recievedData length]) [ recievedData setLength:0 ]; download_size =[response expectedContentLength]; } I have this code. download_size is NSInteger. expectedContentLenght always return: -1. Maybe someone know why? I tried use long, but effect was the same. Thanks for help.

NSURLRequest : Post data and read the posted page

In iOS (current target 5.0, Base SDK 5.1) how can I send a post request to a server, and then read the contents of the page. For example, the page takes a username and password, and then echos true or false. This is just for a better understanding of NSURLRequest. Thanks in Advance!

How can I create a big, red UIButton with the iPhone SDK?

Using the iPhone SDK, how would I go about creating a red “delete” button similar to the one used when deleting contacts on the iPhone?

Watching memory usage in iOS

Is there any way to find out how much memory is available in iOS? I know that the system will pass low memory warnings when available memory gets low. However, my App has some points where a single thread will perform a complex task and sometimes that task uses up enough memory that it is […]

scale fit mobile web content using viewport meta tag

I’m trying to figure out how to leverage the mobile viewport meta tag to automatically zoom the contents of a HTML page to fit into a web view. Constraints: The HTML may or may not have fixed size elements (ex img has a fixed width of 640). In other words I don’t want to force […]

iOS 4.2 – Return to app after phone call

I can successfully initiate a phone call within my app using the following: [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”tel://123456789″]]; However, is it possible to automatically return back to the app once the phone call has been terminated? It seems this was not possible under iPhone OS 3.0 but I am hoping it is now possible under iOS […]