cocoa-touch

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

NSNumberFormatter only rounds to 3 decimal places

Hi, I'm trying to use NSNumberFormatter to round a number to 5 decimal places in an iPhone app, but [formatter stringFromNumber:] always returns strings rounded to 0.001 (3 decimal places). What am I doing wrong??? Many thanks. formatter = [[NSNumberFormatter alloc] init]; [formatter setNumberStyle:NSNumberFormatterDecimalStyle]; [forma...

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

Is it right to say that methods whoose names contain new, alloc, create or copy do not autorelease the objects they create?

As far as I know, only the "convenience" methods return created objects with an -autorelease, so that the receiver is not responsible for the memory of that object. But because Apple says that when you use a method that has a name consisting of "new", "alloc", "create" or "copy", you're responsible for releasing the object that method re...

Reading a file from a hard drive in iPhone simulator

Is it possible to read a file (from my normal file system) into a iPhone App running on the iPhone Simulator? I understand that the iPhone itself has not got a (user accessible) file system but this is simply for testing and will only ever be run in the simulator. The file will be a text file that can be edited while the application is...

What's the difference between calling self.myInstanceVariable and directly myInstanceVariable?

It's a month ago I was reading a line about that. I am not sure, but I think that if I call self.myInstanceVariable then it uses automatically getters/setters, but if I would call directly myInstanceVariable = @"Foo" for example, then I would bypass any getter/setter which would be really, really, reeeaaallly bad. Right/wrong? EDIT: I t...

UITableView Setting some cells as "unselectable"

How can I set the UITableView's cell property to be unselectable? I don't want to see that blue selection box when the user taps on the cell. ...

Why is my UITableView not occupying the bounds of the screen?

Hey all, I'm building a UITableView programmatically without NIB files here. I'm doing something silly however, as my navigationBar shows up fine, as does my UITableView. However, the UITableView is not properly fitting onto the screen. You'll see roughly 20 pixels separating the UINavigationBar and the UITableView. I set my window's ba...

Select row After UIPickerView is loaded

I have an iphone database app that loads a UIPickerView with data from a table. I want to set the selected row to a particular row from the data in another table. for example: Lets say I have a UIPickerView that is loaded with X number of names of the iPhone users friends (the number of names is variable, could be 1 or 1000 and all are...

UITableView - how to make search bar scroll with table

Hi, How can I make the search bar to scroll together with the table view? When I scroll my table view I want my search bar to go with it and disappear. I want to have done something similar to contacts app on the iPhone. ...

UITableView - change section header color

Hi, how can I change color of a section header in UITableView? Thanks. ...

Differences between Objective-C 2.0 vs. CLR in regards to memory managmenet

I've been learning to develop applications on the cocoa touch platform. I've come a long way but one piece that I can't wrap my head around is memory management. I thought I'd take a route of comparison rather than trying to start from scratch. I can't find much on the difference between the CLR (.net) and Objective-C 2.0 so I'm wonder...

How to create a frame and fill it with a segmented control??

I want to create a frame and fill it with a segmented control. How would i do this??? ...

Changing colors with CGContextStrokePath

I'm trying to draw some simples lines with the iPhone/Touch SDK. I'd like to be able to change the color of the lines, but calling CGContextSetRGBStrokeColor doesn't seem to affect the drawn lines that are made with CGContextAddLineToPoint until the actual call to CGContextStrokePath is made. So if I make multiple calls to change the ...

Web site that collects and discusses Cocoa Touch design patterns?

Does anyone know of one? If it doesn't exist, anyone interested in collaborating to create it? ...

Adding UITabBar

Hi, I have a UINavigationBar based application - only a one navigation bar that is handling all the work with views in my app. And I want to have a tab bar at a bottom part of every view that will take the user to whatever view he would like to go. What is the easiest way to add a tab bar to an application? Thank you in advance, Ilya....

Hide UITabBar?

Hi, In my app I have a tab bar. And in some views I as well have a toolbar. So when I come to those views with a toolbar it looks ugly - two bars at the bottom of the view. I thought that it would be a best solution to hide a tab bar when entering those particular views. But I just couldn't figure out how to do it in a right way. I trie...

Is it possible to use Core Animation to fade out a UIBarButtonItem?

Hey everyone, I'm curious, is it possible to somehow intertwine Core Animation to give a "fade out" of a UIBarButtonItem? I have a tableView which I represent with two different data sources. Once a particular data source gets triggered, I'd like to fade out the current UIToolBar options and fade in new ones. Thanks for pointing me in ...

Can you access application delegate from within a UITableViewDataSource function?

I'm trying to figure out the SQLite functionality for the iPhone, and I'm having some problems reading my database file from an overridden UITableViewDataSource function. I am storing the database file location in an ivar (as an NSString) in my application delegate, however when I try to access that string from an overridden UITableViewD...