【问题标题】:Adding Rounded Corners to UIView without breaking interactions.在不中断交互的情况下向 UIView 添加圆角。
【发布时间】:2012-07-12 06:18:22
【问题描述】:

这个答案很好用,Adding Rounded Corners to only top of UITableView? 除了我的 UIBarButtonItems 不再可点击。我的猜测是,面具现在位于打破交互的按钮之上。

有没有人有什么想法可以在不干扰其他视图的情况下实现这一点?

【问题讨论】:

    标签: ios rounded-corners uibezierpath cashapelayer


    【解决方案1】:

    您是否尝试过仅屏蔽 tableView's 层:

    CAShapeLayer * maskLayer = [CAShapeLayer layer];
    maskLayer.path = [UIBezierPath bezierPathWithRoundedRect: self.bounds byRoundingCorners: UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii: (CGSize){10.0, 10.}].CGPath;
    
    self.tableView.layer.mask = maskLayer;
    

    或只是使用:

    self.tableView.layer.cornerRadius = 10.0
    

    整张桌子

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-22
      • 2015-11-02
      相关资源
      最近更新 更多