iPad version ItemsViewController viewWillAppear


#1

iPhone implementation works fine (up through end of Chapter 12).

Universalized the app to iPad; when detailView is dismissed, nothing shows in the itemsView.

Debugging reveals that the detailViewController viewWillDisappear is called, with the new (edited) item correctly created.

However, itemsViewController viewWillAppear is NOT called after this; i the iPhone version, it is called. (Can see it in debugger in iPhone run, but does not hit the breakpoint in the iPad version).

This may be due to the iPad detailView not filling the screen. (I don’t know why id does not fill the screen; I had assumed it would.) This makes me think that, since the itemsViewController never really “disappeared”, it does not “willAppear”, which would mean that the table does not get reloaded.

Confirmed this by creating a trivial itemsViewController viewWillDisappear that just calls [super viewWillDisappear]. The iPhone version hits this breakpoint, and the iPad does not.

Two questions: why would the iPad detailView NOT fill the screen? I did nothing to the DetailView XIB to make it smaller. (Side note: this is both iOS 6.1 and 5.1, since I have an older iPad running iOS 5.1.1.)

Second question: is there some way to force the table to reload on dismissing the detailView without relying on the itemsView willAppear method?

Thanks


#2

[quote=“bobmcd”]
Two questions: why would the iPad detailView NOT fill the screen? I did nothing to the DetailView XIB to make it smaller
Thanks[/quote]

It’s not that you made the detailView.xib smaller, but your screen screen became larger when you display it on an iPad.

One way to band aid this: open detailView.xib, select the view (which should be an instance of UIControl by now), go to the file inspector in the utilities, deselect “Use Autolayout”, click on the attributes tab, and set the size to freeform under simulated metrics. iPhone 3.5/4inch was probably selected since you targeted an iPhone when the xib file was created. The detailView.xib should fill the ipad screen.

To take the above a step further, go in and adjust the constraints of all the detailView’s subviews (textfields, ImageView, etc…).