ios - Only top left corner is rounded instead of topLeft and bottomLeft -
i trying make uiview topleft , bottomleft corners rounded reason topleft has border radius. can cause this?
this doing:
i have extension:
extension uiview { func roundcorners(_ corners: uirectcorner, radius: cgfloat) { let path = uibezierpath(roundedrect: self.bounds, byroundingcorners: corners, cornerradii: cgsize(width: radius, height: radius)) let mask = cashapelayer() mask.path = path.cgpath self.layer.mask = mask } }
and apply view this:
myview.roundcorners([.topleft, .bottomleft], radius: 10.0)
i using inside cell , using auto-layout.
at moment looks this(green view talking about) want bottomleft have corner radius also:
the problem timing. extension relies on self.bounds
. if call extension early, such viewdidload
, bounds
have not yet been determined. view sized auto layout; means don't have bounds until view's layoutsubviews
or view controller's viewdidlayoutsubviews
has been called.
Comments
Post a Comment