UIButtonTypeSystem不会以编程方式更改tint

时间:2014-04-29 21:49:54

标签: ios objective-c

在IOS 7中,在我的xib文件中,如果我将按钮类型设置为UIButtonTypeSystem,我可以将按钮色调颜色更改为我想要的颜色。

我可以通过编程方式执行此操作吗?我似乎无法,我在xib上尝试了相同的图像,它工作正常。

这就是我正在做的事情:

//Date picker button
            self.dateButton=[UIButton buttonWithType:UIButtonTypeSystem];
            self.dateButton.frame=CGRectMake(x, y, 30, 30);
            self.dateButton.tintColor = [UIColor colorWithRed:91.0/255.0 green:146.0/255.0 blue:213.0/255.0 alpha:1.0];
            [self.dateButton setBackgroundImage:[UIImage imageNamed:@"calendarButton.png"] forState:UIControlStateNormal];

0 个答案:

没有答案
相关问题