[英]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.