[英]Set corner radius of `UISegmentedControl` equal to that of `UISearchController`
我在页面上有几个框,我希望它们在该页面上都具有UISearchController
的角半径。
我试图将分段控件的角半径设置为等于搜索控制器的角半径。 但是, _searchController.searchBar.layer.cornerRadius
返回0
而不是viewDidLoad
和viewDidAppear
中的实际值。
我尝试了搜索栏内的文本字段,但它的拐角半径也返回0
。
#define CornerRadius 6
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self.navigationController setNavigationBarHidden:YES];
[self.userNameTextfield.layer setCornerRadius:CornerRadius];
[self.userNameTextfield.layer setBorderColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_login"]].CGColor];
[self.userNameTextfield.layer setBorderWidth:1.0];
[self.userNameTextfield.layer setMasksToBounds:YES];
[self.passwordTextfield.layer setCornerRadius:CornerRadius];
[self.passwordTextfield.layer setBorderColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_login"]].CGColor];
[self.passwordTextfield.layer setBorderWidth:1.0];
[self.passwordTextfield.layer setMasksToBounds:YES];
// Do any additional setup after loading the view, typically from a nib.
}
像这样设置两个拐角半径
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.