cocoa-touch

How do I select a UITableViewCell by default?

I have created a UITableView and would like a specific UITableViewCell to appear selected (blue) when the view is loaded. ...

How to fit a String into a rectangle?

I have an NSString and want to fit it into a rectangle. The rectangle has a specified size, lets say width=150 and height=30. When the String is short and has only one character, it can be as high as the rectangle. More specific: It can have a big font size. But if the string has too much characters and would exceed the bounds of the rec...

Which iPhone system fonts can I use safely and which are recommended for what kind of display purpose?

Fonts are like a coin lost in the forrest: You're never sure where to look first. Had to say that ;-) Ok, so the problem: I come from the web dev world and my mind is screwed up completely regarding fonts. There is a UIFont class that can be used to specify how text in a label should look like. Unfortunately it seems I have to know a lo...

How to change color of label text?

In UIFont, I couldn't find a color property. What's the trick to make a font appear green, for example? ...

Accessing NSString properties of a Core Data entity

I'm moving my initial steps in the Core Data realm (and I'm quite new to iPhone development, too) and I found a behavior I cannot explain. I declared a subclass of a NSManagedObject and defined a few properties, some of them of type NSString *, MyObject.h is something like: @interface MyObject : NSManagedObject { } @property (nonatomi...

Storing iphone application data on low memory

I have some data structures in my app that I need to persist upon receiving 'didReceiveMemoryWarning' notification. The data is kind of a running log of all of the actions the user has performed with the app (which is a game) The data I have may not be a small amount (possible > few hundred KB) so plists don't seem to be the right solut...

How to let the text in a UILabel appear blurry?

Is there a way to achieve a blurry or glowing effect for the text? Or would I have to fetch the graphics context of the layer and then apply some kind of gauss algorithm on the pixels? I searched the documentation on this but it appears that shadows don't draw blurry and there's no method in NSString, UIFont or UILabel that could help to...

[iPhone SDK]How to create a "To:"-Field like in mail?

Hello, does anyone know, how I can create a Textfield, like the "To" Field in Mail? I mean a field, where you can start typing the contacts name and all possible contacts appear in a List under your textfield. And when you select an entry, the entry is entered in your Textfield and shown as some sort of bubble. Has anyone an idea how to...

How to provide easy multilanguage text in iphone app?

I have some short text that I want to ship in the currently active language. What's the most easy way to do it? Example: I have the text "the cat", but when someone from spain uses the app, he/she wants to read "el gato". Is there a standard way to do it easily with UIKit? They're pretty simple texts only. I can imagine some kind of prop...

How to calculate the width of a text string of a specific font and font-size?

I have a UILabel that displays some chars. Like "x", "y" or "rpm". How can I calculate the width of the text in the label (it does not ues the whole available space)? This is for automatic layouting, where another view will have a bigger frame rectangle if that UILabel has a smaller text inside. Are there methods to calculate that width ...

CoreData: Checking for Null

I have a CoreData entity (waypoint) with a foreign key to another entity (track). When the foreign key is set, or if it is not set, this if statement works fine: if ([wp track]) { thirdLabel.text = [NSString stringWithFormat:@"Part of Track: %@", [[wp track] title]]; } However, if the track that the waypoint is keyed to has been del...

UITabBarController View Position and Size

I have a UITabBarController that adds a viewController, but the positioning is off. There is about a 20px gap at the top of the screen and the bottom of the loaded viewController is hidden. How do I move resize the loaded viewController? viewController = [[FlashCardViewController alloc] initWithNibName:@"FlashCardViewController" bun...

Trouble with Core Data dates...

I've got a Core Data model set up, with two entities in a one-to-many relationship (Items, and for each item, there can be multiple ResetDates). I'm pretty confident the model is set up correctly. I can add new Items, and when doing so, add a new ResetDate (using the current date, with [NSDate date]). I can retrieve and display Items. W...

Remove white space from ABPersonRecord iPhone

After weeks of frustration I was advised that the problem with my iPhone App was white spaces in the stored phone numbers. My XCode app phone dialer would only dial 7 digit numbers. ig; 555-1212. My question today is, is there a way to remove the white spaces? My iPhone's Contact Book and revealed that my 10 digit numbers were automa...

Why can't I set my button's shadow colour?

I'm trying to set the shadow colour on a UIButton, but all I seem to be able to get is a mid grey. UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(20, 20, 200, 100); [button setTitle:@"a" forState:UIControlStateNormal]; [button addTarget:self action:@selector(buttonPressed:) for...

Debugger Error

Hi All, I have a problem On 3GS Iphone.When i deploying a application on phone then it exited with following error. "The Debugger has exited due to signal 11 (SIGSEGV).The Debugger has exited due to signal 11 (SIGSEGV)." After that application not started & it installed on phone but when phone disconnected then it works. So Pls. h...

Where can I get the source code from apple's GLImageProcessing example?

I was reading on a blog that there's a GLImageProcessing example from apple. I couldn't find it on apple's site. Does anyone know where it is? ...

How to add a naked CALayer as "subview" to a UIView?

I think that adding a CALayer as "subview", somehow, does save a lot of memory. A UIView always comes with 3 copies of it's content bitmap (presentation layer, render tree and another one, plus the view itself, so every pixel is saved 4 times). But how could that be done? ...

How would you parse the integer out of this XML response in Obj C?

I am working with an API where I get a response back this this, and I want to parse the integer ID out of it: <?xml version="1.0"?> <trip>328925</trip> How would you parse this? I have some really fragile code I want to get rid of, and I'd appreciate some advice: if ([[response substringWithRange:NSMakeRange(0, 21)] isEqualToStr...

How can I make the keyboard disappear?

Is there a way to make a keyboard disappear without resignFirstResponder? I have a UITextField, and I'd like it to be able to accept new text and still have the insertion point (flashing cursor) visible without the keyboard being on screen. When I perform a [textField resignFirstResponder] I can still insert text, by appending to the t...