Tag: cocoa touch

Autocomplete UITextField

I want to auto complete a text field from a custom value Having researched Google and SO here UITextField Autocomplete – iPhone SDK I tried this: – (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { if ([string isEqualToString:@”Fac”]) { _clientField.text = @”Factory”; } return YES; } Problem is I get no predicted value entered Factory, just the […]

Accurate time on iPhone

Is there an way to get a time very precisely in iPhone.? Currently i am trying with the ios NTp client Here . I am getting almost 600 milliseconds difference while comparing with different divices . Even i am not worrying about the accurate time like ntp , I want to show same time with […]

CAScrollLayer doesn't scroll!

Maybe it’s because it’s late. Whatever the reason I can’t figure out why I’m having trouble with a simple CSScrollLayer example I’m trying. I add a 50 pixel Eclipse icon to a view based project and in my initialize method (called from initWithNibName:bundle:) I have this: -(void) initialize { CAScrollLayer *scrollLayer = [CAScrollLayer layer]; scrollLayer.backgroundColor […]

Blocking communication with ios accessory

It appears that Apple recommends using runloops for data communications with an external accessory. However, unless I am missing something, runloops are not very suitable for certain types of communications. We have an -experimental- accessory, to which we need to send an arbitrary number of bytes (up to, say 1024), which is followed by the […]

Make UITableView selection before view appears

I’m building a detail view for a UITableView. The detail view contains a UITableView which has two rows, and I want the first one to be selected when the detail view is opened. I have tried to use the method [selectRowAtIndexPath:animated:scrollPosition] in [viewWillAppear]: – (void) viewWillAppear:(BOOL)animated { [[self tableView] selectRowAtIndexPath:[NSIndexPath indexPathForRow:kStartDateRow inSection:kSection] animated:NO scrollPosition:UITableViewScrollPositionNone]; } […]

Make UITextView react to tap event. (iphone)

I’m trying to implemet a scrollable Text view (not editable) that display some help information etc. and when the user is done with it all he has to do is tap it and it will disapear/hidden and the user will be back in the main screen. The UITextview not reacting to tap event (or i’m […]

How can i associate an IBAction event with an image?

I have a application which contains a moving image and i want to animate the image using a my custom animation. How can i associate an IBAction event with the image? How can i detect the coordinates on screen where the user touched the image? Please Give Your Suggestions. Thanks in advance and Your Suggestions […]

detect one subview on top of another subview

I am trying to detect one subview when dragged on top of another subview to see if it collides. What is a good way to do that? I am using UIPanGestureRecognizer for dragging the elements. thanks

How to save SKProduct object locally?

I have tried to save a SKProduct object with archiving it with the class NSKeyedArchiver but it generates an error as -[SKProduct encodeWithCoder:]: unrecognized selector sent to instance. + (void)saveProduct:(SKProduct *)product { NSData *data = [NSKeyedArchiver archivedDataWithRootObject:product]; [[NSUserDefaults standardUserDefaults] setValue:data forKey:PRODUCT]; [[NSUserDefaults standardUserDefaults] synchronize]; } Is there a way to save an instance of SKProduct […]

Make app start and remain in landscape mode

How can I start my app in landscape mode, and keep the screen rotation that way?