[英]IOS 7.0 : How to change values of layer.cornerRadius of a Navigation Button
Is there a method to change the corner radius of the default button in the navigation bar ? 有没有方法可以更改导航栏中默认按钮的角半径?
Or the best way is to create a custom button and set this button in the navigation bar. 或者最好的方法是创建自定义按钮并在导航栏中设置此按钮。
NSDictionary *rightAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"myFont" size:12.0], UITextAttributeFont,
nil];
[self.navigationItem.rightBarButtonItem setTitleTextAttributes:rightAttributes forState:UIControlStateNormal];
//self.navigationItem.rightBarButtonItem.layer.cornerRadius = 5; //Don'tWork
Thanks. 谢谢。
You probably are going to want to create a BarButtonItem and then set that to the rightBarButtonItem with a custom view. 您可能想要创建一个BarButtonItem,然后使用自定义视图将其设置为rightBarButtonItem。 Something like
就像是
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:aView];
item.customView.layer.cornerRadius = 5;
Good luck. 祝好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.