开发者

Making sure draggable imageview stays within boundary of frame

So I have an app where I have a UIImageView which is a subview of a larger UIView. I've attached some UIGestureRecognizers to the UIImageView so 开发者_Python百科that the user can drag it around within the parent UIView. I'd like for the UIImageView, when dragged out of the boundary of the UIView that encloses it, to have the appearance that it has disappeared off the screen rather than it spilling over to the other UIViews within my controller (IE going underneath the boundary rather than above it). What is the cleanest way to accomplish this?

Thanks,

CoDEFRo


From http://developer.apple.com/library/iOS/#documentation/UIKit/Reference/UIView_Class/UIView/UIView.html

clipsToBounds

A Boolean value that determines whether subviews are confined to the bounds of the receiver.

@property(nonatomic) BOOL clipsToBounds

Discussion

Setting this value to YES causes subviews to be clipped to the bounds of the receiver. If set to NO, subviews whose frames extend beyond the visible bounds of the receiver are not clipped. The default value is NO.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜