5

This is what i am doing - I have a UIView - I pass it from one viewcontroller to another.

When I come back to the first viewcontroller - the uiview is missing - Instead there is a white blank space in its place.

I am using ARC - any idea - if its because of that or soemthing else that i am missing

Thanks

vivianaranha
  • 2,781
  • 6
  • 33
  • 47

1 Answers1

3

If you add a UIView to another, then it'll be removed from where it was before. You cannot have a single view in two places at once.

You'd need to put the view back when you go back to the first view controller. Alternatively, just don't do what you're doing. It's not really MVC. Pass data around, not views.

mattjgalloway
  • 34,792
  • 12
  • 100
  • 110
  • The thing is first I took a screenshot of the uiview for the next viewcontroller - but then the orientation change squeezed the image. If I pass the uiview - it works perfectly fine - But now the only issue is when it comes back I dotn have the view - Also as per apple I cant even deep copy a uiview... – vivianaranha Oct 15 '12 at 21:38
  • 1
    My answer to your comment is the same answer. You need to either put the view back in the first view controller, or pass around data rather than the `UIView`. There's no reason to pass around views between view controllers. Just pass the data that the view controller needs to set up the view. – mattjgalloway Oct 15 '12 at 21:41