I have several boxes on a page and I would like them all the have the corner radius of the UISearchController
also on that page.
I tried to set the corner radius of my segmented control equal to that of the search controller. However, _searchController.searchBar.layer.cornerRadius
returns 0
instead of its actual value in both viewDidLoad
and viewDidAppear
.
I tried the textfield inside of the search bar, but it also returns 0
for its corner radius.
#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.
}
set both corner radius like this
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.