Getting cursor position in a UITextView on the iPhone?

Like drewh said, you can use UITextView’s selectedRange to return the insertion point. The length of this range is always zero. The example below shows how to it. NSString *contentsToAdd = @”some string”; NSRange cursorPosition = [tf selectedRange]; NSMutableString *tfContent = [[NSMutableString alloc] initWithString:[tf text]]; [tfContent insertString:contentsToAdd atIndex:cursorPosition.location]; [theTextField setText:tfContent]; [tfContent release];

problem using tel: URL to initiate a call

The iphone will dial a number using either of the formats listed below. But, it will do nothing if you are in the simulator. It took me 30 minutes of banging my head to figure this out. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”tel://15415551234″]]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”tel:15415551234″]]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”tel:1-541-555-1234″]]; Link for Apple documentation on the … Read more

GLKView set drawable properties

If you want to get kEAGLDrawablePropertyRetainedBacking in a GLKView, add the following category to your project. @interface CAEAGLLayer (Retained) @end @implementation CAEAGLLayer (Retained) – (NSDictionary*) drawableProperties { return @{kEAGLDrawablePropertyRetainedBacking : @(YES)}; } @end Setting the drawableProperties on the CAEAGLLayer maintained by the GLKView doesn’t work because the GLKView overwrites those properties when it binds its … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)