문제

I want to make my tableViewCell with rounded corner. It is work fine upto iOS6. But in iOS7 rounded corners are not shown.

I used

((UIView*)[self viewWithTag:200]).layer.cornerRadius = 8;    
((UIView*)[self viewWithTag:200]).layer.masksToBounds = YES;

Please help me. Thanks.

도움이 되었습니까?

해결책

Try this category. For me it is working for all iOS.

- (void)setRoundedBorder:(float) radius borderWidth:(float)borderWidth color:(UIColor*)color
{
    CALayer * l = [self layer];
    [l setMasksToBounds:YES];
    [l setCornerRadius:radius];
    // You can even add a border
    [l setBorderWidth:borderWidth];
    [l setBorderColor:[color CGColor]];
}

다른 팁

iOS 7 does not support rounded corners in grouped tables anymore.

iOS 7 is a major overhaul of the whole GUI. Many things have changed, including the appearance of the UITableViews.

You can try to create a custom cell which draws a rounded rect. You have to identifiy the first and last cell in your TableView and only draw the custom View, Background, whatever for those cells.

Here is a link that may help you, although it is targeted for iOS 6:

changing corner radius of uitableview grouped in iOS6

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top