Thursday, 15 January 2015

iphone - Adding padding to an UIView -



iphone - Adding padding to an UIView -

i'm looking way add together padding property uiview. ideally, avoid subclassing , putting in category. usage like:

myview.padding = uiedgeinsetsmake(10, 10, 10, 10);

and maybe have paddingbox property homecoming cgrect describing size , position of inner padding box.

now, how 1 implement in category that. though of using bounds, unfortunately size of bounds linked size of frame (always same) coordinates can differ.

this done setting bounds within view. if wanted inset of 10 round do:

view.bounds = cgrectinset(view.frame, 10.0f, 10.0f);

the bounds defines drawable area of view, relative frame. should give in effect padding. can 'paddingbox' bounds.

hope helps! :)

iphone ios cocoa uiview uikit

No comments:

Post a Comment