-1
uibezierpathなどを使用して、このボーダーをUIViewに描画するのに役立ちます。uibezierpathを使用してUIViewに境界線を描画する
私は、このソリューション行った:別のものに巣のUIViewを、しかし、私はよりよい解決策があると思い:
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
self.theView.layer.cornerRadius = self.theView.bounds.size.width/2;
self.theView.layer.masksToBounds = YES;
UIView *borderView = [[UIView alloc] initWithFrame:CGRectMake(4, 4, CGRectGetWidth(self.theView.frame) - 8, CGRectGetHeight(self.theView.frame) - 8)];
borderView.backgroundColor = [UIColor grayColor];
borderView.layer.cornerRadius = self.theView.bounds.size.width/2;
borderView.layer.masksToBounds = YES;
self.theView.layer.borderWidth = 2;
self.theView.layer.borderColor = [UIColor redColor].CGColor;
self.theView.backgroundColor = [UIColor clearColor];
[self.theView addSubview:borderView];
}
おかげで。