6
我想向UIImageView添加白色边框。我尝试以下,但它没有工作:如何仅向UIImageView添加右边框
UIImage *image = [UIImage imageNamed:imagePath];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
CGRect rect = imageView.frame;
rect.size.width = rect.size.width + 1; // create white right border
[imageView setBackgroundColor:[UIColor whiteColor]];
imageView.frame = rect;
[myViewView addSubview:imageView];
但多数民众赞成什么,我在我的代码做...? – headkit
你制作一个普通的UIView,然后在imageView中添加。 UIView应该是更大的,而不是imageView。 – CBredlow
但UIImageView继承自UIView。那么这不仅仅是一种观点吗?为什么我的代码不工作? – headkit