How to figure out the font size of a UILabel when -adjustsFontSizeToFitWidth is set to YES?

I’m not sure if this is entirely accurate, but it should be pretty close, hopefully. It may not take truncated strings into account, or the height of the label, but that’s something you might be able to do manually. The method – (CGSize)sizeWithFont:(UIFont *)font minFontSize:(CGFloat)minFontSize actualFontSize:(CGFloat *)actualFontSize forWidth:(CGFloat)width lineBreakMode:(UILineBreakMode)lineBreakMode will return the text size, and … Read more

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

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