![](/img/trans.png)
[英]why can't I access .layer.borderWidth for this UITextView instance? (code attached)
[英]iOS layer.borderWidth
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(100,100,100,100)];
view.backgroundColor = [UIColor redColor];
view.layer.borderWidth = 1.0;
view.layer.borderColor = [UIColor blueColor].CGColor;
UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(-8, -10, 20, 20)];
image.image = [UIImage imageNamed:@"sample"];
[view addSubview:image];
圖像在視圖中,但邊界線是透明的……・ ・請給我解決方法。
嘗試使用:
image.clipsToBounds = YES;
image.contentMode = UIViewContentModeScaleAspectFit;
添加上面的代碼行,問題將得到解決。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.