cocoa-touch

One UITableView - Multiple DataSource, best design pattern?

This seems like a typical problem, but I have a UITableView that has identical behavior for two separate data sources. What is the best way of going about designing the class hierarchy to have as little duplication and if/else conditions? The view controller is going to do the same exact thing to both data sources, they're just unique in...

Manipulating textfield values in an iPhone app

How do I manipulate textfield variables within an iPhone app? I want to have three text fields, formatted to numbers only, and be able to manipulate the data when I press different buttons. Any help would be appreciated! ...

UIPickerView added to uitableviewcontroller.view won't rotate

Hello folks. I have a UIPickerView as subview in a UITableViewController, which I want to slide up in place when a certain row is clicked. I have implemented the necessary dataSource and delegate methods, but the pickerview acts weirdly. It acts as if it were mechanically jammed, it cannot rotate properly, it just moves a little. If I tr...

How do I get -[NSString sizeWithFont:forWidth:lineBreakMode:] to work?

I updated my question "Sizing a UILabel (in the iPhone SDK) to fit?" with a description of my problem with a suggested solution, but didn't get an answer. Perhaps I'll have better results by asking a new question... I set a breakpoint after the following code: NSString *theText = @"When in the Course of human events, it becomes necess...

Have a reloadData for a UITableView animate when changing

Hi everyone. I have a UITableView that has two modes. When we switch between the modes I have a different number of sections and cells per section. Ideally, it would do some cool animation when the table grows or shrinks. Here is the code I tried, but it doesn't do anything: CGContextRef context = UIGraphicsGetCurrentContext(); [UI...

How do I pan the image inside a UIImageView?

I have a UIImageView that is displaying an image that is wider and taller than the UIImageView is. I would like to pan the image within the view using an animation (so that the pan is nice and smooth). It seems to me that I should be able to just adjust the bounds.origin of the UIImageView, and the image should move (because the image s...

Parsing XML from an HTTPS URL using NSXMLParser?

I'm trying to parse XML directly from an HTTPS URL, as follows: NSString *const URL = @"https://some/HTTPS/url"; NSURL* url = [NSURL URLWithString:URL]; NSXMLParser* parser = [[NSXMLParser alloc] initWithContentsOfURL:url]; [parser setDelegate:self]; [parser parse]; I have the following delegate method for the parser: - (void) parser...

Larger alternative to default UITextfield font that looks GOOD

Hey there everyone. In interface builder i've created a UITextfield within a subclass of a UITableViewCell. The default font is just too small. If I make it bigger in interface builder it looks a bit ugly. Not as crisply rendered. I'd like a font similar to that used in the addressBook application when you edit a contact. The text thei...

Memory management when using UIImage

Hi My application heavily uses the UIImage object to change images on a single UIImageView based on user input and the previous image which was set. I use [UIImage imageNamed:] to create my UIImage objects. I guess this is not the best way to use UIImage coz my memory usage keeps increasing with time and never drops. (Got to know this ...

Should I use NSDecimalNumber to deal with money?

As I started coding my first app I used NSNumber for money values without thinking twice. Then I thought that maybe c types were enough to deal with my values. Yet, I was advised in the iPhone SDK forum to use NSDecimalNumber, because of its excellent rounding capabilities. Not being a mathematician by temperament, I thought that the m...

Animating Tab Bar page switching

Hi, I'm quite confused with the whole animation stuff in iPhone SDK. I tried to study throught the SDK documentation, this website or tried googling it out without success. I'm unable to get my scenario work. I have single XIB file, with tab bar and a 4 tabs. In a special event i want to switch from one page to another "in code", so I...

Gradients on UIView and UILabels On iPhone

My application needs to display text in either a View or Label but the back ground must be a gradient as opposed to a true color. Using a graphics program to create desired look is no good as the text may vary depending on data returned from a server. Does anyone know the quickest way to tackle this? Your thoughts are greatly appreciate...

Starting a Horizontal UIScrollView at a random Page

I have a horizontal UIScrollView with a bunch of various pages on it. I would like to programatically show a certain page per a user selection. At the moment, I can't figure out how to start showing it in the middle of the page. Does anyone have any experience with this? Any help would be greatly appreciated. Thanks. Edit: I think I c...

How do I set the font size in an iPhone text field?

I have a UITextField in a view (on an iPhone) but the input text appears very small. I don't see an option in Interface Builder to set the size. Is there a way to set it declaratively or do I have to resort to code? ...

How do I store program variables in an iPhone application that will survive a program exit?

I need to keep program variable values in an iPhone application when the application is exited. Does the SDK give the programmer any non volitile memory to use? How much is available? Will it be kept thru a power cycle? Through sleep mode? Through a hard reset? ...

How to log SQLite queries on iPhone

Hi, I'm doing an iPhone application, and I'm using SQLite. The problem is that I had some issues with the query (I did bad binding) so, this is my question: How can I log in my iPhone application the effective SQL query/statement with the bindings that SQLite receives? Thanks. ...

Suggestions for an embeddable scripting language for iPhone and Java app?

I'm developing an app for iPhone with a Java desktop companion that it synchs to over the network. I'd like to embed a scripting language into both apps so that end users can write scripts that add new behaviours and interact with the object model, and so that I can more rapidly develop some features. Any suggestions for this, or anyone...

What type of reference does NSNotificationCenter keep for 'observer's & 'object's?

Can anyone clarify/elucidate the situation with respect to -[NSNotificationCenter addObserver:selector:name:object:]? What types of references are kept by the notification center of the 'observer' and 'object' arguments? What are the best practices for removing observers from the notification center? What are the special concerns for m...

How can I render a custom view in a UIScrollView at varying zoom levels without distorting the view?

The scenario: I have a custom view (a subclass of UIView) that draws a game board. To enable the ability to zoom into, and pan around, the board I added my view as a subview of UIScrollView. This kind of works, but the game board is being rendered incorrectly. Everything is kind of fuzzy, and nothing looks right. The question: How can...

Is there an iPhone UI component equivalent to the Cocoa NSColorPicker API?

I'm looking for a way to allow the user of my iPhone application to select a color for marking items. I know I could just use a standard picker with the color text names but if something already exist like the NSColorPicker API in Cocoa, I'd rather use it. Thanks! ...