cocoa-touch

Simplifying a complicated Cocoa-Touch View Controller

As I wire up my first fairly complicated Cocoa-Touch view I feel like I'm inadvertently slipping back into old procedural patterns and finding it difficult to shake them off...Though fully aware of many of the Cocoa (OO) design patterns I'm afraid I may be subverting them. As such this view in question is quickly becoming unmanageable a...

Cocoa KVC question: "class is not key value coding-compliant"

I'm trying to update some properties with KVC. The properties have been synthesized. This line works: myObject.value = intValue; This doesn't work: [self setValue:[NSNumber numberWithInt:intValue] forKey:@"myObject.value"]; And blows up with: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:f...

Ignore touches to background (super) view

How should I be handling, or rather NOT handling (ignoring), touches to my background view? It happens to be the view of my View Controller which has subviews (objects) that I DO want to respond to touch events. Setting userInteractionEnabled = NO for the view seems to turn off ALL interaction for the subviews as well. I'm currently te...

Is there a more concise way to concatenate these strings in Cocoa?

NSString *latitude = [[NSString alloc] initWithFormat:@"%g°", coordinate.latitude]; NSString *longitude = [[NSString alloc] initWithFormat:@"%g°", coordinate.longitude]; self.pointLabel.text = [latitude stringByAppendingString:@", "]; self.pointLabel.text = [self.pointLabel.text stringByAppendingString:longitude]; ...

Displaying MFMailComposeViewController in landscape

My app is landscape based. I'd like to use MFMailComposeViewController in landscape but can't find anything to notifiy it about orientation. In landscape, MFMailComposeViewController displays only the top part of the mail compose window, coming in from the left side, when in landscape. Basically it covers half of the landscape screen....

Customizing UISlider appearance

I want to set the thumb image of a slider for a normal state, but still use the default track images. So i do this: [theSlider setThumbImage:[UIImage imageNamed:@"my_thumb.png"] forState: UIControlStateNormal]; and I get my image appear as thumb, but then default track images disappear. Can't you just customize the thumb image and ...

Switching CABasicAnimation on the position property mid animation causes a flicker

I have some code that uses CALayers to have bubbles flowing bottom to top. If the user touches the screen I have some code that replaces the currently running animation with one that has a toPoint where the finger touched down. When the animation switches it causes a flicker on the device (not on the simulator). Any tips on eliminating t...

How do I make UILabel display outlined text?

All I want is a one pixel black border around my white UILabel text. I got as far as subclassing UILabel with the code below, which I clumsily cobbled together from a few tangentially related online examples. And it works but it's very, very slow (except on the simulator) and I couldn't get it to center the text vertically either (so I...

Do I still have to test with older iPhone OS versions when using 3.0?

I wonder if that's needed...who knows? EDIT: Oh sorry ppl, I made a big mistake here. I want to develop for iPod touch users as well, and they are not likely upgrading so much to 3.0 like the privileged iPhone users do. So for that reason I want to keep developing for 2.2, but Apple is now forcing all developers to test on 3.0. But with...

Which should be the first responder: my view or UIDatePicker?

I'm creating sibling of UITextField, but with UIDatePicker instead of a keyboard. I want multiple such controls to play nicely with each other and also standard UITextField (i.e. swap keyboard for date picker when my control is activated, and hide date picker when a text field is activated). One thing that confuses me is handling of f...

Can I subclass a view built with Interface Builder?

I have a view which I built in Interface builder with a tableview and associated outlets etc, to display a list of items. Clicking on an item brings up the detail of that item. I now want to build a very similar view with a list of the same kinds of items and some additional controls and different behavior on cell selection. In this cas...

HTML character decoding in Objective-C / Cocoa Touch

First of all, I found this: http://stackoverflow.com/questions/659602/objective-c-html-escape-unescape, but it doesn't work for me. My encoded characters (come from a RSS feed, btw) look like this: & I searched all over the net and found related discussions, but no fix for my particular encoding, I think they are called hexadecima...

Deactivate UIScrollView decelerating

Is there a way to deactivate the decelerating of a UIScrollView? I want to allow the user to scroll the canvas, but I don't want that the canvas continues scrolling after the user lifted the finger. ...

How can I animate a sequence of 10 Images in iPhone OS?

I have 10 small images that have to be shown quickly one after another in order to make an animation effect. Is there an easy way to do that, or must I implement an routine by myself? ...

Custom draw a UITableViewCell

I am trying to create a UITableViewCell which overrides the complete drawing of the contents. I have overridden drawRect, which is being called, but it still draws the default contents. How do I get it to stop drawing the default contents and how do I replace it with my own rendering? - (id)initWithStyle:(UITableViewCellStyle)style ...

Objective C - Making UILabel update as user types text in UITextField

How would I make a UILabel update as a user enters text in a UITextField. In my case, I have a quadratic equation solver for the iPhone and as the user enters the values of a b & c, I want a UILabel to update with the numbers given by the user. ...

How do I set up a view controller as a delegate for two things (such as the LocationManager and the Accelerometer)?

I'm sorry if my question title seems fundamentally uninformed. Let me explain what I am trying to do. I have defined the following UIViewController subclass, which fires up LocationManager, and has a Start Recording button to save a GPS track. Now I would like to also fire up the accelerometer and allow the user to record that as well....

Can I retain a View while releasing its ViewController?

I'm trying to load a new view into an existing view controller, but I want to load that view from a xib file. My plan was to create a second viewController (viewController1 in the code below), then retain its view and release that viewController that I just created. I was hoping that the viewController would be released and the view woul...

Cocoa-Touch: Quick way to sum a property in all objects within an NSSet?

I may very well be confusing this with the Cocoa (Mac OS X) side of things so it may not exist in Cocoa-Touch...but I thought there was a way to quickly ask a NSSet to poll its members and return a sum of say an NSInteger property in each of its objects? Closest I can find is objectEnumerator whereby I suppose I could rifle through each...

Search Bar in iPhone 3.0's Built-in Notes.app

If you drag down list of your notes, search bar will come down. But if you keep dragging it, search bar still stays there right below navigation bar, creating "gutter" between search bar and the first row. Any idea how to do this? Thanks Check out the screenshot here: http://img39.imageshack.us/img39/8094/searchbar6420.jpg ...