I want to display a handle at the corners of a UIView that can be used to resize the view. How can I display the handles floating on the top of everything else and still have a connection to and be in sync with a view?
The solution I implemented before looks like this:
alt text http://bayimg.com/image/dalipaacn.jpg
I put the view into another view that shows the handles on top of the corners. The problem with this approach is that the handles add extra space to the original view's size. Since Apple recommends at least 40 x 40 px for the size of a button, it is not very little space and also goes beyond the visible bounds of the original view. Also when I want to align the original views border with its superviews border, parts of the handle buttons become untouchable. Another problem is that the origina开发者_运维技巧l view has to be encapsulated in this 'helper view' object and thus becomes a part of something although it really is the main component.
You could make your frame view larger than the actual content, and then inset the content. That's probably the simplest way. You could also use views that weren't subviews of the frame view, but then you run into problems of synchronizing the handle with the content view, as you mentioned. I'd recommend the first option.
精彩评论