我需要更改 UIButton 的 alpha 值,任何人都可以建议我如何处理它。
我编写的按钮代码为:
UIView* buttonView = [[UIView alloc] initWithFrame:CGRectMake(10, 0, 100, 40)];
buttonView.backgroundColor = [UIColor clearColor];
backButton = [[UIButton alloc] initWithFrame:CGRectMake(5, 5, 100, 30)];
[backButton setBackgroundImage:[UIImage imageNamed:@"backbutton_100.png"] forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(backAction:) forControlEvents:UIControlEventTouchUpInside];
[backButton setTitle:@" All Customers" forState:UIControlStateNormal];
backButton.titleLabel.font = [UIFont boldSystemFontOfSize:12];
[buttonView addSubview:backButton];
UIBarButtonItem* leftButton = [[UIBarButtonItem alloc] initWithCustomView:buttonView];
self.navigationItem.leftBarButtonItem = leftButton;
[leftButton release];
提前致谢。
满满的。
最佳答案
[backButton setTitleColor:[UIColor colorWithRed:0.3 green:0.6 blue:0.9 alpha:0.5]
// set 'alpha' to something less than 1. -----^^^
forState:UIControlStateNormal];
关于objective-c - 如何更改 Iphone sdk 中 UIButton 标题的 alpha 值?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3171831/