开发者

iPhone SDK, selection Rectangle around a view

I have a Drawing app of开发者_StackOverflow中文版 sorts and am looking for some feedback on ways to draw a selection rectangle, and or the resize grips for a selected view.

So I have a custom class that is inherited from UIView, in it it contains a UIImageView, UILabel, and UIButton. I can have several on the screen at one time. I want to tap on one and draw a selection rectangle around it. From there if i drag I want the view and the selection rectangle to move with it. I would like the Selection Rectangle maybe 4px larger than the exiting bounds rect.

So my question is what is the best way to get the Selection Rectangle around the selected UIView object?

Do I offset the object so what when I add in the UIImageView, UILabel, and UIButton that are part of it I have a 4px buffer around the edges?

Do I adjust the View when selected to reposition the subview, increase the bounds and offset the frame?

Do I just create a new UIView that is 4px larger than the selected object and just move it with the selected view?

Do I just create a new UIView that is 4px larger than the selected object and and make the selected view a subview of it?

or? (your Idea Here...)

Thank you for your comments and Suggestions...

Scooter133


Consider setting the borderWidth property on your view's layer. Note that this is drawn within the view's bounds, so it may be more useful as a highlight state than a selection rectangle.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜