按鈕下自帶劃線
UIButton *button =
[UIButton buttonWithType:UIButtonTypeCustom];button.frame = frame;
NSMutableAttributedString *content = [[NSMutableAttributedStrin alloc]initWithString:text];
NSRange contentRange = {0,[content length]};
[content addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:contentRange];
button.titleLabel.attributedText=content;
計算寬度
UIFont * font = [UIFont systemFontOfSize:13];
CGSize lastSize = [str sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font,NSFontAttributeName,nil]];
CGFloat w = lastSize.width;