I have a UIView and a ScrollView as 2 separate subviews. How can i drag a UIView(named “a”) from my UIView and have the scrollView “take over” that dragged “a” UIView?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It really depends on what you exactly mean by ‘take over’ the UIView.
If you simply want to change the parent view, when your view is ‘dropped’ then remove it as a Subview of it’s parent view & add the UIView as a Subview of the UIScrollview.
If the original ParentView has a property that holds the UIView, then it will still retain the instance but the view will be one level down the hierarchy.
If you want to past the entire instance of the view to UIScrollView, you’ll have to subclass UIScrollView & add a property for the UIView. Then you can either create a custom setter (i.e. don’t
@synthesize) that will retain the instance & do the above view adding/removingOR
Create a
- (void)provideNewView:(UIView *)newViewmethod that will assign to the local property and do the view adding/removing.