uikit

How does multithreading on iPhone OS work? How do I use it?

I am curious about threads on iPhone. Are they easy to establish and to maintain? How does it work on the iPhone? Is it real multithreading? ...

Is there a way to see what's exactly going on in UIApplicationMain()?

A long time ago I came accross a piece of code from an Cocoa Touch class. I was able to see what's going on exactly. Unfortunately I dont remember where that was. I'd like to see what UIApplicationMain() exactly does. Just for interest. ...

Should I -drain or -release an autorelease pool in iPhone OS?

The doc says: In a garbage-collected environment, sending a drain message to a pool triggers garbage collection if necessary; release, however, is a no-op. In a reference-counted environment, drain has the same effect as release. Typically, therefore, you should use drain instead of release. If I get that right, they ...

Is it possible to add an object to a specific autorelease pool?

In the docs there is an addObject: method of NSAutoreleasePool. I thought about this: NSString *myString = [[NSString alloc] initWithCString:"Does this work?"]; [thePool addObject:myString]; [anotherPool addObject:myString]; Is that possible? I always read that I can only add objects to the topmost one on the autorelease pool stack. ...

Why should a self-implemented getter retain and autorelease the returned object?

Example: - (NSString*) title { return [[title retain] autorelease]; } The setter actually retained it already, right? and actually nobody should bypass the Setter... so I wonder why the getter not just returns the object? It's actually retained already. Or would this just be needed in case that in the mean time another objects get...

Is it valid to say that a Getter is the owner of the instance variable? Or who owns it?

Actually I would say: yes, the Getter is the owner. So anyone who calls the Getter is not responsible for freeing the memory. Or more precisely, the object itself is the owner, but the Getter acts as a delivery mechanism of the instance variable to others. Is that right, or did I get that wrong? ...

Which "Top-Level Objects" is Apple talking about in the Memory Management Programming Guide?

In the Memory Management Programming Guide for Cocoa Apple talks about Top-Level Objects. They say, that I need an Outlet for each of them. If there are any top-level objects you do not store in outlets, however, you must retain either the array returned by the loadNibNamed:owner:options: method or the objects inside the arra...

Why is there no need for releasing an Outlet that's set up with "assign"?

I've been reading that if I have something like this: @property (nonatomic, assign) UIView *anView; Then I don't have to care about memory management. I don't have to do [anView release] in the -dealloc method. Why? "assign" just tells the compiler: "Hey man, this property does not retain whatever anyone assigns to it". And then you...

Why should I write [anView release], anView = nil; rather than [anView release]; ?

Somewhere I was reading that - regarding low memory warnings and giving up an non-visible view with all it's subviews (= a whole nib, I think), you should do that: -(void)dealloc { [anView release], anView = nil; [someImageView release], someImageView = nil; [super dealloc]; } rather than -(void)dealloc { [anView rel...

Is "assign" the default setup of the @property compiler directive?

If I define an property and just do: @property(nonatomic) UIButton* button; then I think that it's an "assign" property. Is that correct? ...

What's the difference between @property and @synthesize?

Like I understand, @synthesize actually is generating the Getters and Setters. But what's @property then doing? Is it just setting up the parameters for that cool @synthesize magic function? ...

UIButton: Making the hit area larger than the default hit area.

Hello, I have a question dealing with UIButton and it's hit area. I am using the Info Dark button in interface builder, but I am finding that the hit area is not large enough for some people's fingers. Is there a way to increase the hit area of a button either programmatically or in Interface Builder without changing the size of the I...

UILabel: Using the userInteractionEnabled method on a label

Hello again. I am wondering if anyone has used the userInteractionEnabled method on a UILabel to allow the label to act like a button (or just to fire off a method). Any help would be greatly appreciated. Cheers! Update (4/30/09 @1:07pm) Clarification: I have a standard InfoButton and next to it I want to place a label with the text...

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

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

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

Is it possible to get Wi-Fi signal strength data for different channels in iPhone?

I assume that the iPhone Wi-Fi hardware is able to switch between channels, since my WLAN router shows me channel 1 to 13. So that WLAN spectrum must be devided up into those, I think. I would like to observe the signal strength from a specific channel within my app. Is there a way to get this data? ...

UIView scaling during animation

I've got a custom UIView to show a tiled image. - (void)drawRect:(CGRect)rect { ... CGContextRef context = UIGraphicsGetCurrentContext(); CGContextClipToRect(context, CGRectMake(0.0, 0.0, rect.size.width, rect.size.height)); CGContextDrawTiledImage(context, imageRect, ima...

Are there any good UIScrollView Tutorials on the net?

Any good links are highly appreciated! This goes to community wiki. ...

How would you implement an scrollable grid in your iPhone app?

I have about 50 images of 50 x 50 pixel size each. I want the user to pick one of them. So first I thought about an UITableView, but that's just not the right thing. It wastes a lot of screen space. Rather than putting all images one below the other, it would be better to show a grid of lets say 6 columns and n rows. I would use an UISc...