iphone

iphone: caching and updating xml fields

Thanks for your help. Here I have another question. I get the data through XMLParsing, now I want to store it in iphone's cache, and the XML Fields are updates every 12 hours.how can i check that XML Fields are change or not? and how can I store the data in iphone's cache memory so that evry it does not has to interact with web. Can anyb...

Toll free bridges

As a newcomer to iPhone development and Objective-C in general over the last few weeks I have come across numerous mentions of 'Toll free bridges' between CF and NS frameworks. One particular example would be CFStream and NSStream. Does a resource exists documenting all of these bridges and how to use them ? Is it just as simple as cas...

Is there anything like 'getStreamsToHost' on real iPhone device?

I want to write an NSOutputStream to a server with apple's sample code: NSURL *website = [NSURL URLWithString:str_IP]; NSHost *host = [NSHost hostWithName:[website host]]; [NSStream getStreamsToHost:host port:1100 inputStream:nil outputStream: [oStream retain]; [oStream setDelegate:self]; [oStream scheduleInRunLoop:[NSRunLoop currentRu...

Interface Builder's "Simulate Interface" and "Build and Go in Xcode" menu commands

How does one turn the "Simulate Interface" and the "Build and Go in Xcode" menu items into something usable for iPhone development? Right now the Simulate command brings up the Simulator with a black screen and the Build & Go gives a "No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=i386, VALID_ARCHS=armv6)." error. T...

is it possible to set the UILabel distance between the line?

is it possible to set a UILabel's distance between the line, as i had a UILabel contain 3 lines,and linebreakmode is wordwrap ...

iPhone - Most memory effecient way to initialize an image?

Hi I've read that imageNamed: is bad when trying to initialize images. But then what is the best way? I am using imageWithContentsOfFile: and passing the path of an image in my resources folder [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imageName ofType:@"jpg"] This call is made some 30 times in a for loo...

iPhone UITextField in Landscape mode

How do you get the keyboard (for editing a UITextField) to come up in the correct orientation if you are in Landscape mode? I'm doing a game in openGL in landscape mode. I add a UITextField when it's time for the user to enter their name for a high score. I can rotate the UITextField (with a CGAffineTransformMakeRotation thanks) but ...

What's with [UITableView reloadData]?

I have an application that has a UITableView. This UITableView is populated by an NSMutableArray being held (as a property) in the appDelegate. You can think of this as an email window. It lists messages in a subclassed UITableViewCell. When a new message appears, I have all the code done which downloads the message, adds the data to the...

Captured which subview is touched in UiScrollView but cannot access it in another function.

I have UIScrollView which has subviews (pictures) added do it. each time a user touches the a picture in the scrollview, it toggles a checkmark ontop of it. NSMutableIndexSet *picturesArray; <- declared in .h (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event { if (!self.dragging) { [self.nextResponder touchesEnded: ...

Memory Leak Issue with NSMutableArray

I wrote this function in a Helper class for reading a table from my database, and returning it to my controller. On my viewdidload, i cache this result into a class variable (retain property set) and trying to use that inside a picker view control's delegate method. (titleForRow) Somehow, I get a EXC_BAD_ACCESS when I try to access the...

JSON - Framework on iPhone SDK error

I'm getting an error when I run any project with the JSON-Framework installed: Xcode could not locate source file: NSString+SBJSON.m (line: 50) I assumed this means it can't find the sdk, the strange this is that the project builds and runs up until I make my first JSON call: NSArray *data = [responseString JSONValue]; The JSON fold...

UITableView and didSelectRowAtIndexPath issue

I have a UITableView populated with a location-based datasource. I'm calling [self updateView]; to manually refresh the view after the location is found which works fine...but for some reason the didSelectRowAtIndexPath method isn't getting called. Any ideas of why it's not working? Code snippet: http://pastie.org/464300 ...

Include an HTML img tag inside a mailto: URL on an iPhone

I'm trying to include an image in an email, which is being sent using a mailto: URL in an iPhone app. The image shows up on the sender's mail app, but after being sent, the tag seems to be stripped out entirely. Here's a snippet, which has been escaped by hand: [mailUrl appendString:@"&body=%3Cimg%20src%3D%22http%3A//stackoverflow.com/c...

How do I apply a stylesheet just to the iPhone (and not IE), without browser sniffing?

I’d like to apply a stylesheet exclusively to the iPhone, without doing browser sniffing (via the user-agent string) on the server or via JavaScript. I particularly don’t want Internet Explorer to apply the stylesheet. Apple’s suggested code for applying an iPhone-specific stylesheet, i.e.: <link media="only screen and (max-device-widt...

When do you use encodeWithCoder: and initWithCoder: on the iPhone?

As my question in the subject above states, what requirements do you typically have to meet in order to say "Ok, I need encodeWithCoder: and initWithCoder: instantiation for this"? Typically you can write object state to NSUserDefaults, so I'm curious when do you experts decide to use one vs the other? ...

Navigation controller crashing on second time

I am using one navigation controller in my application. I am having one main view (with main view controller) and few options views. Options views are viewed by navigation controller when a button clicked on main view's toolbar. Everything works as expected for first time. When I came back to main view from navigation controller and tri...

Loading a view controller & view hierarchy programatically in Cocoa Touch without xib

It seems like all of the Cocoa Touch templates are set up to load a nib. If I want to start a new project that's going to use a view controller, and load its view(hierarchy) programatically, not from a nib/xib, what are the steps to setting that up or adjusting a template. I though all I had to do was implement -loadView, but I have t...

Issues with setting idleTimerDisabled = YES when screen is locked.

Hi, I'm writing a mapping application that is required to run even when the iphone is locked. so, in my application's applicationDidFinishLaunching method I call, application.idleTimerDisabled = YES; and revert it back when application exits. But there seems to be a lot of issues with this. When the iPhone is tethered and the app is s...

Releasing UIViewController when its view is removed via removeFromSuperview

I have a main view that manually creates a UIViewController (not a UINavigationController) and adds that controller's view as a subview. The subview then dismisses itself via [self removeFromSuperview]. I understand this releases the view, so that is good, however I now want to get also get rid of the UIViewController I alloc'ed immedia...

iPhone - Why am I getting this error when the view mapping is correct?

Hi My iPhone app was running fine. I added a component to my xib file (an activity indicator). I have created my own init method and am using the XIB name in the init method. Now I get this error when I do a pushViewController Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loa...