1 UIButton *tempBtn = [UIButton buttonWithType: UIButtonTypeCustom]; 2 tempBtn.frame = CGRectMake(50, 250, 80, 40); 3 4 NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"忘记密码"]; 5 NSRange strRange = {0,[str length]}; 6 [str addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:strRange]; 7 [tempBtn setAttributedTitle:str forState:UIControlStateNormal]; 8 9 tempBtn.titleLabel.textColor = [UIColor blueColor]; 10 [self.view addSubview: tempBtn];
时间: 2024-10-03 16:50:04