uikit

How to provide additional custom implementation of accessor methods when using @synthesize?

I want to fire some code when a property is accessed and changed. I use @property... and @synthesze... in my code for my ivars. The properties are retained, so I'd like to keep that memory management stuff automatically generated by @synthesize. However, I assume that @synthesize tells the compiler to generate the accessor methods code ...

Is iPhone OS 64 bit or 32 bit?

Anyone knows if iPhone OS is based on 32-bit or 64-bit architecture? ...

How much does it matter if I create a NSMutableArray with capacity=3 instead of capacity=50?

I wonder if this affects performance or memory consumption a lot. I need an NSMutableArray, and at the beginning I can only guess how many objects will be added. About 3 to 5 maybe. So I create it like this: NSMutableArray *arr = [[NSMutableArray alloc] initWithCapacity:3]; What happens here exactly, when creating it with a capacity o...

UIButton image and background image, which one to use for custom image?

I am customizing my UIButton and I can either set image or background image. They both work fine but how do I decide which one to use? Are these two methods for when people have image that are broken up into foreground and background so they can layer them? ...

Recommended Apple iPhone Audio Recording Settings and what file extension to use

I would like to get your recommendation on what settings to use for audio recording using AVAudioRecorder. Below is the settings I am using currently. Also, what file extension should I save it as so users on Mac or Windows can play it without difficulties? Right now I am saving the file out as .caf [settings setValue:[NSNumber n...

Would NSMutableArray -removeObject: also remove a NSString if it has a different memory adress?

Example: I add some NSString objects to an NSMutableArray: @"Foo", @"Bar", @“FooBar". Now somewhere else I access that array again, and I want to delete @"Foo". So I create a new NSString @"Foo", and pass it to -removeObject:. The documentation does not state on what criteria -removeObject works. I think that it looks only for the memory...

How to make the "hot area" of a UIControl bigger?

Or: How to expand the sensitive area for a UIControl without just making the view bigger? I have a pretty small button image (a little arrow), which is just 10 x 10 pixels. Too small for touching. I want the "hot area" to be 50 x 50 around that. For learning, I want to know how to do it manually, even if I could use some of the provided...

How can a covered UIControl or UIView still know about if a touch ended over it or not?

I have a UIControl (or UIView, could have either of them, doesnt matter), and this is covered by another UIControl. The other UIControl reacts nicely on touches. But the underlying UIControl also needs to know about the touch and if the touch was actually "on it" or not (from the user's perspective). The covering UIControl is partially t...

How can a UIControl pass all touch events on to the next object in the responder chain?

That's tricky. I have a small button over a very big one. When the small button on that big button is pressed, the small button does something. But the big one does nothing. Of course. But now I want that the big button also does something, no matter if the small button was tapped or not. So the small button has to forward all touch even...

How to Rotate a UIImage 90 degrees?

I have a UIImage that is UIImageOrientationUp (portrait) that I would like to rotate counter-clockwise by 90 degrees (to landscape). I don't want to use a CGAffineTransform. I want the pixels of the UIImage to actually shift position. I am using a block of code (shown below) originally intended to resize a UIImage to do this. I set a tar...

How to cancel an animation for a specific context and animationID?

I have an animation which I kick off like this: [UIView beginAnimations:@"doThis" context:self]; [UIView setAnimationDuration:1.5f]; [UIView setAnimationDelay:2.5f]; Now, the problem is that this animation is told to start in 2.5 seconds. But in the meantime, something may happen and I don't want the animation anymore. However, CA wil...

How to do antialiasing on a rotated view?

when a UIView is rotated, it's borders look incredible ugly. There's no antialiasing happening at all. Also if it's a UIImageView, no antialiasing happens when rotating the transform matrix. Is there a way to achieve smooth edges and smooth rotation of images? ...

Lazy loading makes iPhone app less responsive first time around, can I prefetch images?

Due to the lazy loading nature of view controllers in iPhone, my app is a bit slow in response the first time when you go to the various screens, which has a rich graphics elements (custom graphics assets) in it. Will preloading the app images ahead of time, that is, by calling [UIImage imageNamed: ...] ahead of time so the next time it...

How do I resize the UITableView's height dynamically?

In my app, I would like to resize the tableview's height when it's in edit mode vs when it's not (in order to make room for editing controls below the table view) How should this be done? ...

What's the point of kCAAnimationDiscrete and kCAAnimationPaced?

The documentation is very poor on this. What's the effect of these? The only thing that seems to work as expected is kCAAnimationLinear. What can I do with the others, for example? ...

What is the fastest way to implement a UIView background?

Hi, I have an UIView which I want to give a gradient background and I'm wondering how to implement that as efficient as possible. I am considering three options: Create an UIImageView as subview and give it an image of the gradient to display. Draw the gradient image in drawRect: of the original UIView. Draw the gradient in drawRect:...

What happens behind-the-scenes when I create a new UIImage by assignment?

I am getting errors of type EXC-BAD-ACCESS where I create a new UIImage instance by assigning the value of a pre-existing UIImage (as below) and I am trying to figure out what the problem is. There is a heap of code to sort through and I am not sure where to start so I won't bother posting source -- but it might help me in my investigati...

How to compare if two objects are really the same object?

I want to compare if an variable A represents the same object as variable B does. Could I do that with the == operator? Or what else is this exactly looking at? I think I need to check for the memory adress of the object where the variable is pointing to, right? ...

Are there any APIs added for Spotlight Search for iPhone 3.0?

Apple has added Spotlight to OS3.0 release. I am having problem finding any API for third party apps to work with Spotlight Search. Is such a thing available? ...

How to print a float value nicely?

Example: I have a float value like 1294322.0000000, and I want to print it out in a label, like that: 1.294.322 So at every thousands-position one point inbetween. I bet you know what I mean. Don't know the exact english words for that. Or, for example, I have a float like that: 15.29, then it should look like "15,29". Or a float li...