【发布时间】:2010-07-20 07:07:32
【问题描述】:
我有问题。我使用按钮作为BarButtonItem。到目前为止它工作得很好,但我的背景色只有在我点击我的按钮时才有效。我怎样才能让它每次都设置我的背景色?
UIButton *redEmergencyButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
redEmergencyButton.frame = CGRectMake(100, 100, 100, 50);
redEmergencyButton.backgroundColor = [UIColor colorWithRed:0.8
green:0.898039215686274509803
blue:1.0
alpha:1.0];
[redEmergencyButton setTitle:@"Emergency"
forState:UIControlStateNormal];
[redEmergencyButton addTarget:self
action:@selector(doEmergency)
forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *rButton = [[UIBarButtonItem alloc]
initWithCustomView:redEmergencyButton];
【问题讨论】:
-
比 1 蓝 5 倍! :)
-
那是一种非常特殊的绿色阴影......
-
@Jasarien:那是229/255。
标签: ios iphone objective-c uibutton uibarbuttonitem