iphone

Trying to create and write to file using NSFileHandle... and it doesn't seem to be working

What am I doing wrong here: NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; self.gpsFilePath = [documentsDirectory stringByAppendingString: @"/gpsReadings.txt"]; self.gpsFile = [NSFileHandle fileHandleForWritingAtPath:self.gpsFile...

How would I tint an image programatically on the iPhone?

I would like to tint an image with a color reference. The results should look like the Multiply blending mode in Photoshop, where whites would be replaced with tint: I will be changing the color value continuously. Follow up: I would put the code to do this in my ImageView's drawRect: method, right? As always, a code snippet would g...

iPhone Programming setNeedsDisplay not working

Implemented my own drawRect method and I'm trying to redraw the shape from a Controller class and I can't figure out how to correctly implement setNeedsDisplay to redraw the UIView. Please help!! I know the code is ugly, but here is the custom method: - (void)drawRect:(CGRect)rect{ // Drawing code NSArray *kyle = [self pointsForPolygo...

Instruments (Leaks) and NSDateFormatter

When I run my iPhone app with Instruments Leaks and parse a bunch of NSDates using NSDateFormatter my memory goes up about 1mb and stays even though these NSDates should be dealloc'd after the parsing (I just discard them if they aren't new). I thought the malloc (in my heaviest stack trace below) could become part of the NSDate but I a...

Launching Safari from an iPhone app using NSMutableURLRequest and OAuth

Launching a URL in Safari is easy enough in an iPhone application - UIApplication's openURL method. However, I'm doing some OAuth stuff, and want to follow the pattern that pownce used to handle OAuth. But since OAuth wants me to explicitly set the Authorization header, I don't know how to proceed. I can set headers via NSMutableURLReq...

How do you get a persons phone number from the address book?

All I want to do is let the user select a number from the address book. I found the code in this question: http://stackoverflow.com/questions/286207/how-to-get-a-phone-number-from-an-address-book-contact-iphone-sdk ABMultiValueRef container = ABRecordCopyValue(person, property); CFStringRef contactData = ABMultiValueCopyValueAtIndex(co...

Is there a HTML wrapper in Cocoa other then UIWebView?

I have a bunch of texts and images (taken from the content tag of a RSS feed item) that I want to display in my app. I've managed to extract them from the entire content tag with some regular expressions. But the thing is, in order for the texts to appear before all the images are loaded, I need to preload all the images, and even more, ...

Is it possible to connect iphone to printer via bluetooth?

I want to connect iphone to a printer via bluetooth, but I don't find any class about bluetooth in iPhone 3.0 SDK. Do I need to join "Made for iPod and Works with iPhone Licensing Program" to get the SDK? Or is it possible to do this without joining the program? ...

Is there a way find to find out if a software keyboard is shown?

My actual UITextField control is embedded many layers down in an external library. Therefore I am unable to detect if it is being edited by calling control isFirstResponder. Is there another way to detect if the software keyboard is shown? ...

UIkeyboard type

I want to use only alphabetic keyboard, how to restrict it? I've used following statement but it doesn't hide the button that converts keyboard in numeric one tempTextField.keyboardType = UIKeyboardTypeAlphabet; ...

Copying iPhone CoreData files from one project to another...

I'm trying create 2 apps, one that builds a persistent store, and another one that consumes it. So far I have built one app that uses CoreData to successfully build a database from an XML file. So this project contains the data model, the .h/.m files for the entities, etc. I'm now trying to enable the second app to read that .sqlite f...

Speech Recognition.

I need to develop an iPhone application which recognizes speech, and based on the result it performs further tasks. I know iPhone 3.0 doesn't support speech recognition and I need to implement speech recognition software on the server side. I know this thing only, since I am newbie I don't know how to deal with that. Mean Which softwar...

Refresh view in iPhone navigation based application

I am using a navigation based application for iPhone. I want to reload a view when i come back to it after pressing the back button. ANy solution? Regards ...

fb:serverfbml rendering bug in iPhone mobile Safari

Hi, I'm using fb:serverfbml to render an fb:request-form for an iPhone-based web-app, and I'm having some major rendering issues. fb:serverfbml does not seem to respect widths when rendered in mobile Safari; it renders the fb:serverfbml as if it had a width of around 1000px. This causes my pages which have a viewport size of 320 to sud...

Best practice to detect iPhone app only access for web services?

I am developing an iPhone app together with web services. The iPhone app will use GET or POST to retrieve data from the web services such as http://www.myserver.com/api/top10songs.json to get data for top ten songs for example. There is no user account and password for the iPhone app. What is the best practice to ensure that only my iPh...

NSThread exit when app terminate

I have an iphone app, it run some thread to compute search. The search is made calling a time consuming function from a library. I need to exit from the thread when the app is terminating, otherwise the thread continue to run and the search create problem when i reopen the app. I tried to subscribe in the thread [[NSNotificationCen...

Selection of random entries from a Core Data Store

Is there a way to select a fixed number of random entries from a Core Data store? I am just getting started with Core Data and have been stuck on this problem for quite some time. As a last resort, I could query a large selection of entries into memory and then randomly select a fixed number. Also, is there a way to specify custom SQL...

How do I control a camera in openGL with a gravity vector from the iPhone's accelerometer

I have a camera structure that holds location, up, and direction vectors. I'd like to update these vectors based on the gravity vector I get from the iPhone's accelerometer. The effect I'm going for is: when the top of the phone is tilted away from you, the camera looks towards the ground. In other words, the scene/geometry follows the o...

How to add marquee to a label.

I have a label at the top of my UIView.I am displaying some messages on it through array with the help of the timer.But now i want this messages to be displayed in MARQUEE style.I am not getting any way to start.Any source code,methods to use,any animation style,any different approach. Thanks in advance ...

Changing the color of a pixel ...

Hello All, i am able to read a particular pixel at given CGPoint but i have been looking to change the color of a pixel and it would be highly appreciated if anyone can help me out with a code snippet. My Code is: unsigned char* data = CGBitmapContextGetData (cgctx); if (data != NULL) { offset = 4*((w*round(point.y))+rou...