objective c - UIView in cell -- Can't round right-hand corners -


i have rectangular uiview object in static table view cell. have outlet object , i'm trying selectively round corners not round corners on right. here's looks in storyboard:

enter image description here

the view want configure pale yellow one. red view serves no real purpose other confirming other view not being clipped.

there no constraint issues or errors. here's how looks on 4s:

enter image description here

i'm doing configuration in tableview:willdisplaycell:forrowatindexpath:

with code (myview outlet pale yellow view above):

self.myview.layer.cornerradius = 5.0f; self.myview.clipstobounds = yes; 

i result:

enter image description here

all 4 corners rounded. need selectively round corners, both top or both bottom corners. here code rounding 2 bottom corners:

cashapelayer *shape = [[cashapelayer alloc] init]; shape.path = [uibezierpath bezierpathwithroundedrect:cgrectmake(0, 0, self.myview.bounds.size.width, self.myview.bounds.size.height)                                    byroundingcorners:uirectcornerbottomleft | uirectcornerbottomright                                          cornerradii:cgsizemake(5.0f, 5.0f)].cgpath; self.myview.layer.mask = shape; self.myview.layer.maskstobounds = yes; 

and here result:

enter image description here

it doesn't work either of right-hand corners. works fine either of left-hand corners.

i tested bezier code view object on ordinary view controller (outside of table view) , code works expected--i can round corner selectively.

any ideas why it's not working in table view cell?

how can accomplish without resorting drawing code?

i think happens because of view's frame , therefore bounds changed after make layer mask.

as documentation tableview:willdisplaycell:forrowatindexpath: states: after delegate returns, table view sets alpha , frame properties, , when animating rows slide in or out.

the best tactics subclassing uitableviewcell , perform layer adjustments in layoutsubviews.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -