cocoa-touch

Disable Magnifying Glass in UITextField

Is there a way to prevent the user from moving the cursor in a UITextField? I'd like it to stay at the end of the string. ...

Info button vanishes from view

I have a view xib that contains an info button. I'm doing animation on the UIView by adding CALayer objects to the view's layer and animating these layers. I'm careful to place these layers behind the info button by moving their zPosition. The problem is that on a real iPod touch the info button does not show in the view, even though it'...

How can I obtain clean alpha channel information from an PNG image in iPhone OS?

I have created an context like this (simplified): CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate (bitmapData, pixWide, pixHeigh, 8, // bits per component bitmapBytesPerRow, colorSpace, kCGImageAlphaPremultipliedFirst); Now, when I try to extract the data for the fi...

How does the coordinate system in an CGContextRef look like?

I assume that the origin is on the bottom left, and the y-axis expands up, starting from 0. The x-axis expands to the right, starting from 0. I just ask because I get very weird results from my drawing code... want to make sure that I didn't get this part wrong. ...

How can I make a set of constants, to improve the usabilty of my methods?

I've written an method that does some graphics calculations. There, you can specify a start-direction like "from left", "from right", "from bottom", "from top". Now I don't want the user of my method to pass confusing values like 1, 2, 3 or 4 or even strings. Nothing like that. Instead, I would like to create constants like: kFromLeft,...

Using a custom image for a UITableViewCell's accessoryView and having it respond to UITableViewDelegate

Hi everyone, I'm using a custom drawn UITableViewCell, including the same for the cell's accessoryView. My setup for the accessoryView happens by the way of something like this: UIImage *accessoryImage = [UIImage imageNamed:@"accessoryDisclosure.png"]; UIImageView *accImageView = [[UIImageView alloc] initWithImage:accessoryImage]; accI...

Releasing Core Foundation object references

Do I need to release a Core Foundation objects to clear up memory? And if so, how? For example, in the code: ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef peopleArray = ABAddressBookCopyArrayOfAllPeople(addressBook); do I need to release peopleArray? What about addressBook? ...

Cocoa: Why is my table view blank?

Why is my table view blank? It was fine until I added "initWithStyle" Here is what it looks like: And here is what my code looks like: Here is my .h: #import <UIKit/UIKit.h> @interface TableViewController : UITableViewController { NSMutableArray *jokes; IBOutlet UITableView *jokeTableView; } @property (nonatomic, retain) NSM...

Is it possible to have more then one animation delegates at the same time?

I'm concerned that this is impossible, because +setAnimationDelegate: of UIView is a class method. But maybe I am wrong with that? Background: The problem is, that I have many objects of the same class, and I want to implement a method which does some nice animations specially for that object. Those animations are a little complex and c...

What kind of value can I set in the context parameter for UIView +beginAnimations:context:?

I don't understand this: + (void)beginAnimations:(NSString *)animationID context:(void *)context (void *) ----> what kind of data can I provide here? ...

perfomSelector: withObject: afterDelay: can I ask for a low priority?

Is there some way when sending this message to specify that I rather have my selector performed after all pending UI events, if any? Ie. give my aterDelay timer a lower priority in the event queue. ...

Three20 TTTableViewController with a TTThumbsTableViewCell

It seems that you must use the TTThumbsViewController to accomplish this. However, in the example code, TTThumbsViewController is only ever used to manage a scrollview of thumbs. How do you configure it to display cells instead? _______Original Question_______ Has anyone used the Three20 source and made a tableview (not Fields)? I am ...

Saving reference to UITableViewCell

I have 5 cells in a tableview that are all custom. Meaning, I've created a xib with a tableviewcell and created a corresponding cellController. The xib has two labels named name and size. The user taps a row, triggering didSelectRowAtIndexPath. From there a timer is started. At some point the timer finishes. Here I need to assign te...

How can I reset a layer transformation to the original state after I did some animations and transformations?

I have a image that rotates around a few times by random and then disappears. After it appears again, I want it to be in the original state. Not rotated. I would keep track of how many rotations I applied randomly and then calculate how many radians I have to re-do that. But I slightly remember from the big docs that there was some ident...

Best way to make a UITextField "appear"

I'd like a UITextField to appear when a button is pressed. Unfortunately, I can't hide it in Interface Builder and then set the hidden property to NO later because "ibtool fails with exit code 5" if you try to hide a UITextField. I'll try to do this in code but wondering if I may be missing something or making a grave UI error by attem...

How can I recognize a tap on a UIImageView-subclass inside a UIScrollView?

I tried it with this code in my UIScrollView-subclass: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"he/she touched me"); } I also made sure that in the initialization of my view, this gets called: self.userInteractionEnabled = YES; But when the scroll view doesn't move and i tap on my subview a few...

Memory management and performSelectorInBackground:

Which is right? This: NSArray* foo = [[NSArray alloc] initWithObjects:@"a", @"b", nil]; [bar performSelectorInBackground:@selector(baz:) withObject:foo]; - (void)baz:(NSArray*)foo { ... [foo release]; } Or: NSArray* foo = [[[NSArray alloc] initWithObjects:@"a", @"b", nil] autorelease]; [bar performSelectorInBackground:@selec...

At which point can I securely access the frame in a UIImageView subclass?

I've subclassed an UIImageView. After self = [super initWithImage:image] I try to access the self.frame.origin.y value. But it is always 0.0. One moment later, in a method that gets called from the outside, the property is fully there with a nice 100.0. I also tried to override -(id)initWithFrame:(CGRect)aRect, but the result is the...

Touch Handling Handoff to Subview

I have a table view that is placed in front of a scroll view. When the user drags vertically I want the table to scroll up and down and when they drag horizontally I want the scroll view behind to scroll its image. I understand how to check the touches using the UIResponder delegate methods to sense whether the user is scrolling horizon...

How can I get a notification on every frame in Core Animation?

I have an iPhone program that consists of a number of UIViews that are sitting on top of another UIView, and that can be moved around. I am drawing connections between the UIViews using the drawRect: method in the containing UIView. It all works great. The only problem is that when I use animation to move the views around, the backgroun...