I made a book and have it as an app for the ipad but now and creating a version of it for the iPhone family devices. Its going to be a total of about 700 pages (view controllers) Each view controller has a large imaige in it that can be scrolled and zoomed and panned. double tapped zoom and double tap back to orginal size. I have a Navigation controller and three bar button items in each view. on the left the bar button item opens a drawer for a table view to select a certian page (view). no matter how many times i change views in the table view it will not crash. On the right side of each view i have two bar button items. I want them to be used for next page and prev page buttons. I created a segue for the next page bar button items and connected 50 view controllers using these segues. i have not connected the prev page seguess yet. So when i open the app and use the next page bar button item and change threw 38 views the app crashes. But here is the wierd thing. If i start the app and go threw 30 views using the segues then go to the slide out table view and go back to the frist view and start over to 30 again it wont crash. It only crashes when i use the segues consecutively 37 or 38 times. going threw 38 view controllers. I am guessing maybe because each view has a large image that collectively are taking up much memory after have viewed 38 view controllers from segues? I also have AVAudio and makes a sound in the view did load as if the page was being turned. in the table view when it slides it plays a sound like a drawer is opening. I dont think it has anything to do the audio, they are both WAV files and i named each AVAudio player a different name. Could someone please help me.
App Crashes. I have many view controllers
It sounds like you are pushing more and more view controllers onto the navigation controller's stack, or you have a whole series of view controllers that are presenting another view controller. I think you need to pop the previous view controller off the navigation controller's stack before presenting the next one, or dismiss the previous view controller before presenting the next one.
Hmmm thanks. That may help. So how would I code to pop the previous view controller off the navigatoin controller's stack? or code to dismiss the previous view controller before presenting the next one?
It sounds like you are using a navigation controller, so the next button on the view controller that is your page would have to call a function in your navigation controller subclass that pops the current view controller and pushes the next one. The previous button would call a similar function that pops the current page and pushes the previous one. Or they could be the same function, with a parameter that indicates which page to push. Pushing and Popping functions are defined here:
Note that you can't pop the root view controller, so you will probably want a very simple view in your root view controller - maybe just an empty view with a neutral color - and push the view controller that is your first page on top of that.
Also, you said that you can choose many pages using your table view controller, and it never crashes. How are you presenting the page's view controller from that table view controller?
Thanks for the resource. I am not sure why the table view doesnt crash and the next page button does. Thank you for your help. I will research these func for navigation controller. Ill comment here again if i find a way to fi this problem.
A couple of random points here. Not sure what happened to KMT's post but you need to take his advice seriously. Apple does not allow "books as apps". Unless it uses some platform features besides just a navigation bar / index to change pages, it is likely to be rejected by app review.
Also, I strongly advise against adding 700 separate view controllers to your storyboard if that's what you're doing. You will be in a world of hurt if some API change comes along that requires you to make some small change to each of them. You should have ONE view controller for each type of view that acts in a similar way, and just programmatically add your different images / subviews. So ideally you would only have a handful or maybe a few tens of VCs on the storyboard at most.
>you need to take his advice seriously
猫 に 小判