iphone

How to safely shut down a loading UIWebView in viewWillDisappear?

I have a view containing a UIWebView which is loading a google map (so lots of javascript etc). The problem I have is that if the user hits the 'back' button on the nav bar before the web view has finished loading, it is not clear to me how to tidily tell the web view to stop loading and then release it, without getting messages sent to ...

Trick to getting initWithNibFile to be invoked?

I've implemented a View Controller, and I'm trying to do some very basic initialization in initWithNibFile...which I understand to be the designated initializer for View Controller objects. I've tried to put breakpoints on the code, and have put very simple NSLog statements into it as well. Regardless...I'm not seeing it be executed (a...

delay loading of UIWebView in UITabBar app

I have an UITabBar based iPhone app with 4 different UIWebViews under every tab. Right now all the UIWebViews load on startup and it takes a little bit too long. I would like to load the default tab's UIWebView first, then load the others in the background. What is the best way to do this? I have seperate ViewControllers set up for eac...

iphone - open and close sqlite database every time I use it

I am writing an iPhone app that uses SQLite. I am use to opening and closing my connections every time I use a database. However, I do not know if that is a good practice in the iPhone/SQLite environment. I want to know if I should open the database 1 time or if it is OK to open and close the database each time I use it. Please let m...

draw path on map in iphone

I am using the Route-Me library for the iPhone. My problem is that i want to draw a path on the map for example. I am in Dallas and i want to go new york then just i will put marker on these two places and path will be drawn between this two marker. Can any body suggest me how this can be done. If any other Map rather than RouteMe th...

Are there any more methods than dataFromPropertyList:format:errorDescription: which do not follow the basic rules of the object ownership policy?

Like Apple says, the dataFromPropertyList:format:errorDescription: method does not follow the object ownership policy. The method reference describes it. I have tried to search for "need to be released by the caller", but no useful results. Here's a quote from the reference: Special Considerations Unlike the normal memory manageme...

Why should I send -autorelease to my instance variable in my setter method, rather than -release?

Apple is doing this in a setter method for an instance variable mainSprocket: – (void)setMainSprocket:(Sprocket *)newSprocket { [mainSprocket autorelease]; mainSprocket = [newSprocket retain]; return; } Why do they send -autorelease and not -release? Would a -release have a bad effect here? Actually it should not (for my u...

How to change UITabBar Selection color

Hi, I need to change the selection color of UITabBar from default blue to red. How do we do this. ...

iphone global variable

I want to open my SQLite database in my appDelegate class and reference that database in all my other classes that need the database. I have tried using : static sqlite3 *database = nil; But when I try to reference it in my other classes with appDelegate.database, I get a compile error of "error: request for member 'database' in someth...

MMX instructions for Iphone

Hi Does iphone processor ARMV6 supports MMX instructions? ...

Autorelease and "assign" properties in Objective-C? (On iPhone)

I have an instance of a UITableView, and a separate class that adheres to the delegate and datasource protocols. I'm doing this like so: SubjectTableViewHandler *handler = [[[SubjectTableViewHandler alloc] init] retain]; tv.delegate = handler; tv.dataSource = handler; [handler autorelease]; I don't want to maintain the handler as an i...

No Data Returned Using NSURLConnection Asynchronously

Hi everyone, I am having a heck of time with something that seems rather straightforward but I can't seem to get working. I am building an iPhone app that retrieves data from a web host. I am trying to establish an asynchronous connection to the host as I want to keep the device freed up during the connection. (sendSynchronousRequest fr...

canonical way to randomize an NSArray in Objective C

Is there a canonical way to randomize an array in Objective C? ...

Retain Cycles: Why is that such a bad thing?

There are two Objects A and B. A creates B and retains it. B has an instance variable that points to A, retaining it. So both retain eachother. Some people say, that this strong connection can't be broken ever again. But is that really the case? If B would release A, then A could easily release B, and so B would be deallocated. A would...

Complex iPhone tableviews, where's the trick?

I was wondering how do people fill a tableview like the one in Safari's preferences, in the iPhone simulator. I guess I have a tableview controller and then I add controls programmatically? (one by one!?) Is there any trick I'm missing? If I use a resource list or an array, could I get the same result? I mean, with a complex setup, nice...

iPhone SDK 3.0 Targetting 2.2.1 SDK

Hi Everyone, Just got the latest beta for iPhone SDK up. This is the update for the upcoming 3.0 release of the iPhone SDK. Unfortunately, I'm not getting a bunch of errors for targetting the 3.0 platform. This is nice to know for me to mark future work, but I need to get some other stuff done first. Unfortunately, the "target" fiel...

Multi Column header for a UITableView with Multiple Columns

I have created a UITableView with multiple columns to display a Football League Table. Now what I really need is a header to label each column which will ideally sit at the top of the table view. How would I do this? ...

iPhone URL Request: Add value to HTTP header field

I'm trying to add a value to the header for a URL request. Something like this works just fine: [urlRequest addValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"]; But this doesn't even show up in the header: NSString *authString = [[NSString alloc] initWithString: [defaults objectForKey:@"auth"]]; [urlRe...

How do i consolidate my xcode project files?

When I started working on my first app, i assumed dragging files into xcode put them in my project's actual directory. Not so. Apparently, xcode references them all on the desktop. Is there an easy way to copy all referenced files into the project directory? My desktop is a mess. ...

iPhone OpenGL ES 2d background texture

Hi, i have a 1024 x 1024 image I use for a texture in my game for the background. Im wondering if their is a proper way to handle drawing a large background texture. How I am doing it currently: texCoord { 0,0,1,0,0,1,1,1 } vertice { 0,0,0,height,width,0,width,height } texCoordPointer(texCoord) vertexPointer(vertice) bind the texture...