当前位置:   article > 正文

uibutton点击按钮时title变大 松开时变小_uinib button 点击之后自动放大了

uinib button 点击之后自动放大了

结合   NSMutableAttributedString的各种属性可以做很多事情

下面只是一种小情况


UIButton *button = [UIButton buttonWithType:(UIButtonTypeCustom)];

    button.frame = CGRectMake(100, 100, 100, 30);
    button.backgroundColor = [UIColor redColor];
    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"压缩图片"];
    [str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12.0] range:NSMakeRange(0, 4)];
    [button setAttributedTitle:str forState:(UIControlStateNormal)];
    
    
    NSMutableAttributedString *str1 = [[NSMutableAttributedString alloc] initWithString:@"压缩图片"];
    [str1 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:20.0] range:NSMakeRange(0, 4)];
    [button setAttributedTitle:str1 forState:(UIControlStateHighlighted)];
    [self.view addSubview:button];
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号