zoukankan      html  css  js  c++  java
  • 验证码UIButton状态UIButtonTypeSystem时候一闪闪UIButtonTypeCustom不闪

    修改UIButton状态,注释NSLog(@"text1%@",_btn.titleLabel.text);这段结果很不可思议

    _btn.titleLabel.text = [NSString stringWithFormat:@"aaaaaa%i",i];

    NSLog(@"text1%@",_btn.titleLabel.text);

    NSLog(@"text3%@",[_btn titleForState:UIControlStateNormal]);

     

    UIButtonTypeSystem

    2015-05-21 11:16:10.363 test[6137:504267] text1aaaaaa4

    2015-05-21 11:16:10.363 test[6137:504267] text3Button111

    2015-05-21 11:16:13.368 test[6137:504267] text1aaaaaa5

    2015-05-21 11:16:13.368 test[6137:504267] text3Button111

    UIButtonTypeCustom

    2015-05-21 11:17:48.471 test[6260:520944] text1Button111

    2015-05-21 11:17:48.472 test[6260:520944] text3Button111

    2015-05-21 11:17:51.475 test[6260:520944] text1Button111

    2015-05-21 11:17:51.476 test[6260:520944] text3Button111

     

    UIButtonTypeSystem下面就不闪了,断点情况下会出现原始值

    [[_btn class] setAnimationsEnabled:NO];

    _btn.titleLabel.text = [NSString stringWithFormat:@"aaaaaa%i",i];

    [[_btn class] setAnimationsEnabled:YES];

     

    个人小结论:在引用titleLabel.text的时候 其实会对本身进行一次赋值,默认本身状态下所对应的title值

  • 相关阅读:
    CCF 认证
    ZOJ Light Bulb
    codeforce 605BE. Freelancer's Dreams
    HDU2546——背包DP——饭卡
    转载DD大神背包九讲
    背包九讲
    zstu4186——线段树——表白计划(未完成)
    zstu4189——后缀表达式——逻辑运算
    蛇形矩阵
    zs深入浅出学算法022——DFS———汉诺塔问题II
  • 原文地址:https://www.cnblogs.com/Leetvin/p/4519904.html
Copyright © 2011-2022 走看看