我想指出的是UIBarButtonItem
,通过更改特定背景的颜色可以打开或关闭特定对象。Mobile Safari使用此功能指示打开还是关闭私人浏览:
由于没有backgroundColor
财产,我该怎么办UIBarButtonItem
?
创建一个,UIButton
并将其用作的自定义视图UIBarButtonItem
。然后,backgroundColor
在按钮的图层上设置:
UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:@"Test"];
button.layer.backgroundColor = [UIColor redColor].CGColor;
button.layer.cornerRadius = 4.0;
UIBarButtonItem* buttonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
self.toolbarItems = @[buttonItem];
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句