iphone

How to parse an ISO-8601 duration in Objective C?

I'm looking for an easy way to parse a string that contains an ISO-8601 duration in Objective C. The result should be something usable like a NSTimeInterval. An example of an ISO-8601 duration: P1DT13H24M17S, which means 1 day, 13 hours, 24 minutes and 17 seconds. ...

Intertesting problem with UITableViewCell and UITableView, Any solution?

I have a class inherited from UITableViewController and this is also the root class. This tableView contains three custom UITableViewCells (loaded from NIB file and not subclassed) and each UITableViewCell has one UITextField. Now when I implement delegate method - (BOOL)textField:(UITextField *)textField shouldChangeCharactersI...

RegExKitLite Expression Question

I'm having trouble coming up with an RegExKitLite expression that will match. I'm parsing a string and I want it to grab everything till it comes upon the first occurrence of a colon What would be the expression in RegExKitLite to do that? Thanks! ...

How to get UIMenuController work for a custom view?

I'm trying to get the following code work: UIMenuController * menu = [UIMenuController sharedMenuController]; [menu setTargetRect: CGRectMake(100, 100, 100, 100) inView: self.view]; [menu setMenuVisible: YES animated: YES]; The menu instance is ready but it doesn't show - the width is always zero. Or is there some sample code on this...

Objective-C run loop to stop and re-start method?

I used to think I was a reasonably intelligent person. apple's "threading programming guide", has shattered my ego sustaining self deception. I have a method I want to run repeatedly on a secondary thread, in the example below I've called this doStuff: I want to be able to repeatedly stop and start the repeated calling of this method. ...

How do I get the Twitter API to respect the callback parameter with OAuth?

I'm working on an iPhone app that ideally uses OAuth to communicate with Twitter. I know a lot of people are doing the OAuth workflow inside of their apps using a UIWebView, but I don't agree with that and am going with the Pownce approach. The problem is, Twitter has this whole scheme for working with desktop apps, using a pin number. ...

Is it possible to embed an inline image in HTML email using MFMailComposeViewController?

Is it possible to embed a reference to an image in an HTML email sent via MFMailComposeViewController on iPhone OS 3.0? (void)addAttachmentData:(NSData*)attachment mimeType:(NSString*)mimeType fileName:(NSString*)filename doesn't seem to provide any way of either setting or reading the Content-ID header for an attachment, but is there...

Why can't I write files to my app's Document directory?

I have found several snippets of code describing how to write data to a user's application Documents folder. However, when I try this out in the iPhone simulator, no files get created. I called [NSFileManager isWritbleAtPath:<my document folder>] and it returned 0 (false). Do I need to make this folder explicitly writable, and if so,...

Does iPhone OS consume more memory when I display 5 times the same UIImage inside multiple UIImageViews?

I didn't notice much performance lost by doing this. So I wonder if it doesn't hurt when I re-use the same UIImage multiple times at the same time inside multiple UIImageViews? ...

GCC 4.2.1 darwin Avoid duplicate symbols.

I'm building application for iPhone OS 3.0 Due to bug in GCC 4.2.1 I'm adding -all_load flag to linker, to build it on iPhone OS 3.0 But then I get duplicate symbol _fill_fopen_filefunc in /Users/TMC2/Programming/Client/test/build/Debug-iphoneos/test.a(ioapi.o) and /Users/TMC2/Programming/Client/test/build/Debug-iphoneos/test.a(ioapi.o)...

Replacing occurences of strings

Hello, I'm fetching data from a sqlite database in my iPhone program. What I get from the DB is then placed in a UITextView. An example of text that is fetched is: "Hello this is a example. It has "" double quotes "" and ends with simple" I want to eliminate the single one, and replace the double by singles. But It's not working. Here...

UITableViewCell - set it to be selected/highlighted... and stay selected/highlighted

Hello, I would like to have a UITableViewCell stay lit (blue) after i call cell.selected = yes. is this possible? do i have to go another way about it (as in not cell.selected) thanks! ...

Disable all program sounds

I would like to have a setting to disable all sounds coming from my program. I know I can set a global ivar and write if statements for each sound but I was hoping there was a something I could set in the appdelegate to disable all program sounds. I have played a couple of games that allow you to turn game sounds off. I am using AVAud...

"Flip" events in non-Safari webkit mobile browsers?

A recent Ajaxian post title "Swipe away, then quickly flip with simple jQuery plugins" tells us about flip events on the iPhone Safari browser and I wanted to use them on another webkit browser, the Android Browser. $('.swipe').swipe({ swipeLeft: function() { $('#someDiv').fadeIn() }, swipeRight: function() { $('#someDiv')....

3D Graphics Tutorials

I want to start writing simple iphone apps to simulate in 3D things like rolling dice, playing billiards, dropping objects from a certain height, throwing a ball, etc. Just basic motion simulation in 3D. I've searched and searched for a tutorial that would get me started here without success. A perfect intro tutorial for me would be a...

Any techniques to draw path animated?

Is there a way to simulate handwriting using quartz? I mean there is a path between points A, B and C. I want path to come out of point A and go animated to point B and then C. What comes to mind is two options to do it: Ugly- Create path then mask it and move mask around to reveal a path. Takes a lot of time to create and unrelia...

Debugging independent unit test bundle for iPhone?

I created an independent 'LogicTest' bundle as described in Apple's latest and greatest instructions for iPhone projects. I've successfully set up and debugged dependent test bundles on Mac OS, just fine. However I have not worked with independent bundles nor test bundles for iPhone before. The test bundle builds and executes tests ju...

Categories in static library for iPhone device 3.0

I have categories in my static library. Any application developer should set -ObjC flag to "Other Linker Flags" to use my static library properly. It works fine for iPhone device/iPhone Simulator 2.x and iPhone Simulator 3.0. But it crashes for iPhone device 3.0. As written in this article it is new linker bug. They suggest to use one mo...

UIWebView loading parsed html string

Hello, i'm building an app that will display some newsletters to the users. the newsletters are displayed in a uiWebView. I'm reading the url's for the newsletters from an rss feed. I parse the xml, and in a table view i have all the newsletters. When a cell is clicked the uiWebView is pushed and the newsletter is loaded. Because the uiW...

ABPersonSetImageData doesn't display image

Hello, I use ABUnknownPersonViewController to display a contact view. I try to set an image with: NSData *dataRef = UIImagePNGRepresentation([UIImage imageNamed:@"contact3.png"]); ABPersonSetImageData(newPersonViewController.displayedPerson, (CFDataRef)dataRef, nil); It doesn't work and I don't know why. Any ideas? ...