cocoa-touch

Is there an easy to understand guide (new to Cocoa, Xcode, etc) for Interface Builder that talks about proxy objects?

Back in the day of C/C++, the part of the language that really hung me up was pointers. I understand them now, of course. Now, Interface Builder Proxy Objects or more importantly, how to use Interface Builder and what to put in the .XIB window (window that contains the File's Owner, First Responder, etc...) for a given XIB. I've gone t...

How to get a list of the playlists and songs in an iPhone/iPod Touch?

Can I get a list of the playlists and songs in each playlist in an iPhone? This is for a legal app. so hidden APIs/jailbroken solutions don't apply. ...

iPhone - how to save user settings from application?

Hi, What is the easiest way to save a couple of variables in an iPhone application in a long-term memory? I have an application that works with different sqlite databases and I want after exiting from an application to save last active database name in order to open last database when user enters an application again. It's a little bi...

Where is the TickCount() call?

Where is the TickCount() call? I have seen several threads on the web that recommend using the TickCount() call for iphone development. What do i need to "#include" to use this call? What framework is it in? If not TickCount() what should I use to get milliseconds elapsed since the cpu started? ...

How to output frame positions in debugger?

I have a UIIMageView and want to output values such as: myobject.center.y myobject.frame Basically, position and size information. I'm using both "po" in the console and breakpoint actions with @@ but neither works. I always end up with an error such as "There is no member named center". How do I output these values in both the de...

iPhone raw touchscreen data

Hello, I know in my iPhone app I can get touch events. But these touch events are filtered for me. If I press the device against my face, it filters out these touch events because it can detect its not a finger. How would I get the raw touch events, not filtered in any way? Thanks. ...

Why don't I have to release these objects?

Here's an sample code, where only the "string" object is released. NSString *nameOfFile = ... ; NSError *error; NSString *string = [[NSString alloc] initWithContentsOfFile:nameOfFile encoding:NSUTF8StringEncoding error:&error]; if (string == nil) { // handle error } [string release]; I understand why the error object is not releas...

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 ...

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. ...

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...

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...

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 cancel a text field edit in a UIWebView?

I'm working on an application with an embedded UIWebView. The user has the ability to enter a location in a text field in the web view but an effort is also made to discover the current location using Core Location. If Core Location comes up with an accurate answer and the user is currently editing the location I'd like to cancel the e...

What does CGColorGetComponents() return?

CGFloat* colors = CGColorGetComponents(hsbaColor.CGColor); Does this return a float, or an array of floats? It looks like the asterisk is shorthand for creating an array. Is that correct? When I call this function on the CGColor property of an HSB UIColor object does it convert the values to RGB? ...

How can I make a weak reference to a parent object when using properties?

I am not sure about it. Would I do that this way? @property(nonatomic) MyParentObject *parentObject; Note that I just left out the retain Keyword. Or would I have to write the Setter by myself? ...

Will the -dealloc method be called upon application quit?

Apple says, that in Cocoa -dealloc will not be called neccessarily when the application quits. Does this also apply to the iPhone? ...

iPhone UITextField: how to insert new line by the return key?

Hi, I want to get a carriage return/new line by hitting the return key on an UITextField's keyboard. I've found out, that textFieldShouldReturn gets called. But how do I insert a carriage return in the text field? ...