Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-14-2010, 09:01 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 4
applelim08 is on a distinguished road
Unhappy Help need for proper use of Navigation Controller


I'm newbie in iPhone development, I need to do a form submission (multiple pages, each page will be a single ViewController). So what I did was navigate each pages through Navigation Controller... here is some illustration:

page 1 (have 'next' button)
page 2 (have 'next' and 'back' button)
page 3 (have 'next' and 'back' button)
page 4 (have 'next' and 'back' button)
page 5 (have 'next' and 'back' button)
page 6 (have 'done' button)

so when from page 1 to page 2, i am using pushViewController,
similiar from page 2 to page 3 etc

similiarly from page 2 back to page 1, i am using popViewController.

if click on 'done' button on page 6, it should back to page 1, i am using popToRootViewController

There's strange things happened if I navigate the pages around, e.g. page 1 to 2, then 2 to 3, then 3 back to 2, then 2 to 3 again etc etc
1st, I notice the memory usage go higher and higher
2nd, sometime the program just crash when i navigate arround, seem not stable at all. (not sure is cause by memory usage or not, but i notice the memory climb around 2MB)

i also try to use popToViewController, so i can from page 5 jump back to page 2, but seem not stable as well, not everytime success...

my actual work is include quite number of Views,
i using a TabController to navigate around 5 different NavigationController and each Navigation Controller having 5~6 views.

I really need some help to really understand the navigation controller, especially what is the proper way to navigate around different views in more effective way.

Really appreciate for any help!!! Thank you!!
applelim08 is offline   Reply With Quote
Old 01-14-2010, 09:12 AM   #2 (permalink)
Registered Member
 
Join Date: Dec 2009
Location: Washington, DC
Posts: 77
inlvrwetrst is on a distinguished road
Default

Quote:
I notice the memory usage go higher and higher
Make sure you that after you invoke pushViewController: you are releasing the view you just pushed onto the navigation stack.

Also, if you are using a navigation controller, you do not have to implement the back functionality. It is already implemented for you.

I think the instability is probably stemming from not handling references to the view properly. If you post some code for us to look at, we could probably help.
inlvrwetrst is offline   Reply With Quote
Old 01-14-2010, 09:34 AM   #3 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 4
applelim08 is on a distinguished road
Default

Quote:
Originally Posted by inlvrwetrst View Post
Make sure you that after you invoke pushViewController: you are releasing the view you just pushed onto the navigation stack.

Also, if you are using a navigation controller, you do not have to implement the back functionality. It is already implemented for you.

I think the instability is probably stemming from not handling references to the view properly. If you post some code for us to look at, we could probably help.
Thanks for the answer, the codes are quite messy and need to simplify quite a bit before i can post here~ Let me see what can i do....

I knew there's back function in navigation, and it appear at the upper left as 'back' button, but i need this button display on the bottom of the screen (just next to the 'Next' button), is that anyway to do so? And do you know how the navigation controller's back function work? is that same as popViewController??

Thanks for help again!!
applelim08 is offline   Reply With Quote
Old 01-14-2010, 09:39 AM   #4 (permalink)
Registered Member
 
Join Date: Dec 2009
Location: Washington, DC
Posts: 77
inlvrwetrst is on a distinguished road
Default

You can hide the back button by putting something this in the viewDidLoad method inw hatever view you want to hide it.

Code:
self.navigationItem.hidesBackButton = YES;
Then just have a function in your .h like back: or something, connect it to a control in the view, and use popViewController in that function.

And yes, the back functionality does pop the current view off the navigation stack.
inlvrwetrst is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 336
9 members and 327 guests
2Apps1Day, akacaj, Domele, michelle, NSString, SLIC, soohyun, Techgirl-52, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,650
Threads: 94,114
Posts: 402,886
Top Poster: BrianSlick (7,990)
Welcome to our newest member, soohyun
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:02 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0