這是我的代碼,應該工作,但沒有。爲什麼我不能創建邊框
self.square =[[UIView alloc]init];
self.square.center = CGPointMake(location.x, location.y);
//_square.backgroundColor = [UIColor colorWithRed:12.0/255.0 green:185.0/255.0 blue:249.0/255.0 alpha:1];
[_square.layer setBorderColor: (__bridge CGColorRef)[UIColor colorWithRed:12.0/255.0 green:185.0/255.0 blue:249.0/255.0 alpha:1]];
_square.alpha=1.0;
[_square.layer setBorderWidth:2.0];
[previewView addSubview:_square];
事情是,如果我給視圖的背景顏色,然後視圖是可見的,但如果我不,視圖不是。我想要做的是獲得一個方形輪廓。所以我想如果我看到一個沒有背景色和邊框的視圖,它就會起作用。
如果你downvote問題,有正派說明原因 – nupac