ios - Delete button not showing on UITableViewCell with rounded corners -


in tableview, have logic in tableview(tableview: uitableview, willdisplaycell cell: uitableviewcell, forrowatindexpath indexpath: nsindexpath) determine if cell has rounded corners on top, bottom, or no rounded corners @ all.

override func tableview(tableview: uitableview, willdisplaycell cell: uitableviewcell, forrowatindexpath indexpath: nsindexpath) {          if indexpath.row == 0 {             // round top 2 corners             let masklayer = cashapelayer()             masklayer.path = uibezierpath(roundedrect: cell.bounds, byroundingcorners: [uirectcorner .topleft, uirectcorner .topright], cornerradii: cgsizemake(4, 4)).cgpath             cell.layer.mask = masklayer         }          if indexpath.section != 1 {              if indexpath.row == self.tableview.numberofrowsinsection(indexpath.section) - 1 {                 let masklayer = cashapelayer()                 masklayer.path = uibezierpath(roundedrect: cell.bounds, byroundingcorners: [uirectcorner .bottomleft, uirectcorner .bottomright], cornerradii: cgsizemake(4, 4)).cgpath                 cell.layer.mask = masklayer             }         }      } 

this works, after have implemented editing tableview, strange things happen delete button.

with rounded corners code:

with rounded corners

when remove rounded corners:

without rounded corners

this confuses me because i'm not sure i'm doing wrong. can help?

override func tableview(tableview: uitableview, willdisplaycell cell: uitableviewcell, forrowatindexpath indexpath: nsindexpath) {          if indexpath.row == 0 {             // round top 2 corners             let masklayer = cashapelayer()             masklayer.path = uibezierpath(roundedrect: cell.bounds, byroundingcorners: [uirectcorner .topleft, uirectcorner .topright], cornerradii: cgsizemake(4, 4)).cgpath             cell.contentview.layer.mask = masklayer         }          if indexpath.section != 1 {              if indexpath.row == self.tableview.numberofrowsinsection(indexpath.section) - 1 {                 let masklayer = cashapelayer()                 masklayer.path = uibezierpath(roundedrect: cell.bounds, byroundingcorners: [uirectcorner .bottomleft, uirectcorner .bottomright], cornerradii: cgsizemake(4, 4)).cgpath                 cell.contentview.layer.mask = masklayer             }         }      } 

use cell.contentview.layer.mask = masklayer


Comments

Post a Comment

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

python - Error opening file in H5PY (File signature not found) -