What is the best way to use your time right now? What is the most profitable way to spend your time right now?
Would guess it's not something like delaying the launch of your latest greatest application just to finetune UITabBar icons by yourself. How much do you lose income in a day by doing that?
Seriously. Some people are good at design, some good at coding, some at graphics. Most are not, but still keep trying to do everything by themselves.
Showing posts with label icon. Show all posts
Showing posts with label icon. Show all posts
Friday, February 24, 2012
Quality Icons for Your Quality App
Monday, October 11, 2010
How to Find Out Width of Truncated UILabel Text
Found out my tip "How to Float an Icon after UILabel" worked only in positive scenarios. If your text string is longer than UILabel width, icon could have been pushed out of sight. In worst case nobody would ever have seen the icon!
// TitleSome measurements of different methods, just to check what is available:
label = (UILabel *)[cell viewWithTag:1];
label.text = @"This is a very long title which is too long";
// Icon
image = (UIImageView *)[cell viewWithTag:10];
image.image = [UIImage imageNamed:@"logo.png"];
CGSize frame1 = label.frame;Next icon positioning. Here you should have calculations to compensate for different icon sizes (in case all of your icons are not same size):
// 205x21
CGSize frame2 = [label sizeThatFits:label.frame.size];
// 291x19
CGSize frame3 = [label.text sizeWithFont:label.font constrainedToSize:label.frame.size];
// 163x19
CGSize frame4 = [label.text sizeWithFont:label.font constrainedToSize:label.frame.size lineBreakMode:label.lineBreakMode];
// 203x19
CGSize frame5 = [label.text sizeWithFont:label.font forWidth:label.frame.size.width lineBreakMode:label.lineBreakMode];
// 203x19
// Icon positioningOk, now that's perfect (until next defect report)!
CGSize frame = image.frame;
frame.origin.x = label.frame.origin.x + frame5.width + 4;
image.frame = frame;
Labels:
CGSize,
icon,
iphone,
sizeThatFits,
sizeWithFont,
UIImage,
UIImageView,
UILabel,
viewWithTag
Subscribe to:
Posts (Atom)