Border image on UIView
- by drunknbass
I want to have a UIView subclass that has a border image, but i dont want or care about this 'new' frame/bounds around the border image itself.
What i wanted to do was just use drawRect and draw outside of the rect but all drawing is clipped and i dont see a way to not clip drawing outside of this context rect.
So now i have added a sublayer to the views layer, set [self clipsToBounds] on the view and override setFrame to control my sublayers frame and always keep it at the proper size (spilling over the views frame by 40px)
the problem with this is that setFrame on a uiview by default has no animation but seTFrame on a calayer does.
i cant just disable the animations on the calayers setFrame because if i were to call setFrame on the uiview inside a uiview animation block the calayer would still have its animation disabled.
the obvious solution is to look up the current animationDuration on the uiview animation and set a matching animation on the sublayer, but i dont know if this value is available. And even if it is, im afraid that calling an animation from within another animation is wrong.
Unfortunately the best solution is to not use a calayer at all and just add a uiview as a subview and draw into that just like i am drawing into my layer, and hope that with autoresizingMask set to height and width that everything will 'just work'. Just seems like unnecessary overhead for such a simple task.