开发者

Making sure draggable imageview stays within boundary of frame

开发者 https://www.devze.com 2023-03-29 05:06 出处:网络
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 with

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

精彩评论

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