Code:    

    UIButton *btnSignOn = [UIButtonbuttonWithType:UIButtonTypeCustom];

    btnSignOn.frame = CGRectMake(100, 100, 150, 150);

    btnSignOn.center = CGPointMake(175, 175);

    [btnSignOn addTarget:selfaction:@selector(buttonSignOn:) forControlEvents:UIControlEventTouchUpInside];

    btnSignOn.backgroundColor = [UIColorbrownColor];

    [btnSignOn setTitle:@"GOOD"forState:UIControlStateNormal];    //button上CurrenTitle显示为GOOD

//    btnSignOn.titleLabel.text = @"btnSignOn";                            //

//    btnSignOn.titleLabel

//    btnSignOn.titleLabel.textColor = [UIColorredColor];

    btnSignOn.tintColor = [UIColorgreenColor];

    [self.view addSubview:btnSignOn];

    [btnSignOn release];

currentTitle 和titlelabel 不一样。按钮上显示的是CurrnetTitle,而不是titlelabel。

http://sandfly.net.nz/blog/2010/02/uibutton-titlelabel-is-not-as-useful-as-it-looks/

相关文章:

  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
猜你喜欢
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案