Questions tagged «objective-c-category»


6
将圆角添加到所有UIImageViews
我想在我的项目中的所有UIImageViews中添加一些圆角。我已经使代码工作了,但是必须将其应用于每个图像。我应该继承UIImageView来添加它吗?如果是这样,有人可以给我一些如何做的指示吗? 这是代码 - (void)viewDidLoad { [super viewDidLoad]; NSString *mainpath = [[NSBundle mainBundle] bundlePath]; welcomeImageView.image = [UIImage imageWithContentsOfFile:[mainpath stringByAppendingString:@"/test.png"]]; welcomeImageView.layer.cornerRadius = 9.0; welcomeImageView.layer.masksToBounds = YES; welcomeImageView.layer.borderColor = [UIColor blackColor].CGColor; welcomeImageView.layer.borderWidth = 3.0; CGRect frame = welcomeImageView.frame; frame.size.width = 100; frame.size.height = 100; welcomeImageView.frame = frame; }
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.