Darren Findlay
Darren Findlay

Reputation: 2563

Drawing beyond a UIView's bounds

I'm trying to draw a complex border around a UIView in it's drawRect method using core graphics. The border is being clipped because it's outside of the view's bounds. Is there any way to prevent this clipping? Setting clipsToBounds to NO doesn't work.

Upvotes: 2

Views: 2510

Answers (1)

duci9y
duci9y

Reputation: 4168

drawRect: gives you a CGRect. This defines the area in which you can draw. As it stands, you cannot draw outside this area.

You'd have to look into a different solution to your problem. I'd suggest CALayers, or a subview/superview hierarchy, perhaps a border view and a content view. But don't try doing that in drawRect:, unless you can get the desired results while keeping within the area specified by drawRect:.

Upvotes: 3

Related Questions