-
Notifications
You must be signed in to change notification settings - Fork 752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SearchBar 边框圆角设置不了 #151
Comments
@ko1o 自定义搜索框的话,正确设置方式是? |
@JiaHaoGong
|
@ko1o |
只能改大,不能改小、、、、、 |
@AllLuckly |
@ko1o 是否应该考虑用北背景色代替背景图片来解决这个问题?这种方案倒是最简单的。 |
这个size一直是0 重新好像也没用 |
@AllLuckly searchViewController.searchBarCornerRadius = 0; 只需要做下面的变更: - (void)setSearchBarCornerRadius:(CGFloat)searchBarCornerRadius
if ([NSStringFromClass([subView class]) isEqualToString:@"_UISearchBarSearchFieldBackgroundView"]) {
subView.layer.cornerRadius = searchBarCornerRadius;
subView.clipsToBounds = YES;
+ if ([subView isKindOfClass:UIImageView.class]) {
+ [(UIImageView *)subView setImage:nil];
+ }
+ subView.backgroundColor = [UIColor colorWithRed:142.0f/255.0f green:142.0f/255.0f blue:147.0f/255.0f alpha:0.12f];
break;
}
} 你自己暂时继承一下 |
@AllLuckly searchViewController.searchTextField.borderStyle = UITextBorderStyleNone;
searchViewController.searchTextField.layer.cornerRadius = 2;
searchViewController.searchTextField.clipsToBounds = YES;
searchViewController.searchTextField.backgroundColor = [UIColor py_colorWithHexString:@"8E8E93" alpha:0.12f]; |
@ko1o 这个问题并不严重,而且不需要改 |
设置圆角最正确的方式 |
iOS13 不管用了
|
你这就是iOS 13的官方修改方法……ww |
边框的圆角,大小设置无效?
The text was updated successfully, but these errors were encountered: