Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 在UITableView中圆顶角_Objective C_Ios4_Uitableview_Iphone Sdk 3.0 - Fatal编程技术网

Objective c 在UITableView中圆顶角

Objective c 在UITableView中圆顶角,objective-c,ios4,uitableview,iphone-sdk-3.0,Objective C,Ios4,Uitableview,Iphone Sdk 3.0,我确实在UItableView中添加了圆角,但只在顶部添加了圆角。 问题是,当我在UItableView中使用掩码时,UItableView仅显示前4个单元格 当我从mask中注释代码时,tableview工作正常 这是我的密码: UIBezierPath *maskPath; maskPath = [UIBezierPath bezierPathWithRoundedRect:_tbFeeds.bounds byRoundingCorners:(UIRectCornerTopLeft | UI

我确实在UItableView中添加了圆角,但只在顶部添加了圆角。 问题是,当我在UItableView中使用掩码时,UItableView仅显示前4个单元格

当我从mask中注释代码时,tableview工作正常

这是我的密码:

UIBezierPath *maskPath;
maskPath = [UIBezierPath bezierPathWithRoundedRect:_tbFeeds.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight) cornerRadii:CGSizeMake(9.0, 9.0)];

CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = _tbFeeds.bounds;
maskLayer.path = maskPath.CGPath;
_tbFeeds.layer.mask = maskLayer; //tbfeeds is my tableview
[maskLayer release];

一种方法是向tableview添加标题:

- (void)loadView {
    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 10)]; // height of header (10)
    [headerView setBackgroundColor:[UIColor whiteColor]]; // color of header (white)

    UIBezierPath *maskPath;
    maskPath = [UIBezierPath bezierPathWithRoundedRect:headerView.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight) cornerRadii:CGSizeMake(5.0, 5.0)];

    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = headerView.bounds;
    maskLayer.path = maskPath.CGPath;
    headerView.layer.mask = maskLayer;

    self.tableView.tableHeaderView = headerView;
}

看起来几乎和同一张海报上的一模一样。