简体   繁体   中英

How can I drag a subview out of the parent view?

So in my app I have a UIImageView[1] that takes up about the top half of the screen. I also have a TapGesture recognizer that adds a UIImageView[2] as a subview of UIImageView[1] .

In the bottom half of my application I have another UIImageView[3] I need the UIImageView[2] 's to be able to interact with.
However, when I drag the UIImageView[2] outside the frame of UIImageView[1] it obviously disappears.
I was wondering if anyone knew a way I could drag UIImageView[2] to UIImageView[3] without UIImageView[2] disappearing while still maintaining the frame of UIImageView[1] .

I've tried resizing UIImageView[1] to just encompass the whole screen but since I'm using Aspect Fit it centers the image and if I use the top left align thing it doesn't aspect fit it.

试试这个禁用子视图裁剪:

[parentView clipsToBounds:NO];

尝试以下操作将UIImageView[2]拖动到视图中的其他任何位置

[self.view addsubview: UIImageView[2]];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM