Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void) addUnderlineToLabel:(UILabel*) label {
- int lineThickness = 1; //change these to customize the line
- UIColor *lineColor = [UIColor lightGrayColor];
- NSString *string = label.text;
- CGSize stringSize = [string sizeWithFont:label.font];
- CGRect buttonFrame = label.frame;
- CGRect labelFrame = CGRectMake(buttonFrame.origin.x + buttonFrame.size.width - stringSize.width, buttonFrame.origin.y + stringSize.height + 1, stringSize.width, lineThickness);
- UILabel *lineLabel = [[UILabel alloc] initWithFrame:labelFrame];
- lineLabel.backgroundColor = lineColor;
- [label.superview addSubview:lineLabel];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement