I have a UIPageViewController (lets call it IntroPages
) inside a UIViewController
(IntroView
) that takes up about half of the screen. I have four pages that I want to be scrollable inside IntroPages
, lets call them A
, B
, C
and D
. All of A
, B
, C
and D
are implemented as separate UIViewControllers
with their own nibs. A
, B
and C
are static while D
has a form on it (imagine three sell pages and then a form to, say, sign up). The user can easily swipe through A
, B
, C
and reach D
but when the user taps a text field on D
(lets call it firstName
), D
completely disappears from IntroPages
and IntroPages
starts to show C
without any exceptions or anything. At this point the user can swipe from C
to D
again and this time around D
would behave just fine.
Additional Information:
- The delegate of
firstName
isD
. - If I return NO from
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
D
does not disappear even the first time but then the keyboard doesn't come up and I need the keyboard to come up. - I also tried to make
IntroView
(theUIViewController
containing theUIPageViewController
) to be the delegate offirstName
but that did not work either i.e. gave the same problem. - I am using ARC
My first thought was that D
is somehow getting released but that is not the case. I created a -dealloc
function for D
and put a break point there but D disappears well before the -dealloc
is called on it. In fact the -dealloc
is called on it only once the user swipes from C
to D
a second time. This tells me that the UIPageViewController
is deallocating the first instance of D when the second instance of D is supplied to it.