Strange delay with Navigation Controller behaviour - iphone

I have the following set up in a navigation controller.
The root is a list of categories (banks, hotels etc) and each category has a child view below it containing a table view of items (Bank A, Bank B etc). When i select 'Banks' i see my banks (list coming from from web service), but then i go up one level to my root, and select 'Hotels', when the view loads (from web service), i still see my banks, for about 1 second, before the view is updated with the list of hotels.
How can i stop the previous category's list showing up when i choose a different category?
Thanks

Clear the array first before you load the view, try also getting views to reload

Related

For Each Detail View Data to Main View

I don’t have any code for this, so I’ll make up a hypothetical situation:
I want to make a grocery list app. I have a tab bar that sends me to a view where I can create categories in a list (fruits, vegetables, dairy etc.) Each category sends the user to a detail view where they can list off certain brands and the amount they need.
(This is where it gets a bit tricky)
In the main view, the categories that the user made are now tabs that are on the bottom and the list they made in detail view appears on the screen. Any changes they make in the list shown (in the main view) will update back into the specific detail view.
Is that possible? And what technique would be used for something like this?

iphone How to implement a view used in multiple places?

In my specific example I have a navigation controller inside tab 2 of a tab bar controller, the root navigation controller view has three buttons:
'nearest store' - this pushes a view that contains a mapview with nearest stores, clicking the store pins will push the store details view.
'all stores' - this pushes a view that contains a tableview that lists all the stores, clicking on a row will push the store details view.
'store search' - this pushes a view that contains a text box which allows a town/postcode search for nearest stores which appear in a tableview, clicking on a row will push the store details view.
The issue I have is how should the store details view be implemented since it will be pushed onto from multiple parent views.
I currently have each parent view, nearest store view, all stores view, store search view, contain a seperate instance of the store details view controller which is allocated memory and pushed onto the view controller as necessary. My worry is that if I access the store details view through each of these 3 paths then there will be 3 copies of the store details in memory since I am not sure when these will be automatically released.
My thinking was that an alternative way of implementing this is to have an instance of the store details view controller from the primary navigation root controller with the three buttons.
From any of the nearest store, all store, store search views, if the store details view needs to be accessed then the current view is popped off the navigation controller and a method in the root controller will be run to push the store details view on. This will mean that there will only ever be one instance of the store details view in memory since it will be reused everytime it is accessed.
Since the popping and pushing to get to the store details view will not be animated, it may be confusing for the user when they click the back button as they will end up on the root view controller and not the view they were previously on.
Is this a good way to implement this view structure? I am not sure I understand how the iPhone keeps views in memory and if going down this alternate route will be beneficial or a waste of time.
Thanks for any help.
What I would do (may not be right) is have a tab bar controller and the three different store search views under each of the tabs.
Then have a singleton view object which will be your details view. Therefore all three of the views can access the same details view object.
Hope I kinda helped :S

Jumping to a point in a navigation stack

Just after a bit of advice really and a push in the right direction.
I have a modal view with a navigation controller containing 3 levels (views):
My Active Jobs (pulls a list of the users active jobs from the server and displays as a table, select a job and view 2 is passed the jobID and displayed).
Job Details (pulls the job details and a list of its updates based on the jobID from the server, select an update and view 3 is passed the updateID and displayed).
Update Details (pulls the details of the update based on the updateID from the server and any photos attached to that update, select a photo and it displays full screen.
So I have a seperate modal view in a different part of the app which displays the latest updates to the jobs. This includes new jobs assigned to the user and new updates for active jobs.
What I would like to do is link directly to the relevant view in the navigation controller when an item is selected in the latest updates modal window.
So my thoughts are to call the the Active jobs modal view when a latest update is selected and pass the relevant ID(s), initialise the combination of views needed in the stack pass the ID(s) to the views then initialise the navigation controller with the setViewControllers:animated: method.
Is this the best way to do it, or is there a better way?
Any help or suggestions would be greatly appreciated.
I don't see a reason to duplicate the functionality of creating the views for the view controller. One thing you could do is have a "cache" for each element (jobId and updateId ). If you want to push multiple viewControllers at once you would fill the cache with the desired values. Then when you push a viewController onto the navigationController, the new controller would check the cache and if there is something cached you would simply push the next view controller directly. This would all happen quickly and should be unnoticeable to the user.
By doing it this way, you are using the same code regardless of if you know the next id or not. You are either using the user selected id, or the one already predefined by the other selection.

Navigation based Application and UITableViewController

I am creating a navigation based application and in the root view, it lists an array of choices, which as many you know leads to a more specific choice. My question is the lists that is displayed on the root view is actually not a choices of different functionality like calendar,mail but a choice, which is going to do the same functionality with different values.So I am wondering whether I should create a different view controller for each of the choices or I should just update the existing view. Which one is more efficient. Choice of inputs comes from a dictionary. I really appreciate your inputs. Thanks ;)
I assume that you want to have a screen with a number of "settings". Clicking on one of the settings will slide in a new view where the user can pick between a number of options. So basically you have two views each with a table and a navigation controller on top, right?
If this assumption is right, then I propose the following:
Create one view controller for the "front view".
This view controller will display the different "settings" and know that selecting one of the settings should slide in the next view.
This next view should be handled by a second view controller. It sounds like the different settings can be handled by one view controller.
So basically: Two view controllers, one for the first "level" and a different one for the second "level".

iPhone SDK: How to load a different view?

Suppose that I want to create and application and that application will have two windows and a menu mechanism. How do I accomplish this on iPhone? I know how to create a single view and have that displayed but what I want is this ability:
a.) Upon loading app, show a navigation mechanism. The choices are Item A or Item B.
b.) If Item A is chosen, view A should be loaded.
c.) It Item B is chosen, view B should be loaded.
Thanks in advance.
To me, what you're describing sounds like three views.
1. Root View
This view has two buttons (or other controls) that allow the user to select where they would like to go.
2. View A
A view with the necessary controls and data.
3. View B
A view with the necessary controls and data.
The actual transition between the views could involve a UINavigationController. If so, the root view would be pushed onto the UINavigationController's stack initially, and clicking the buttons would push either view A or B onto the stack. Otherwise, views A and B could be presented modally when the appropriate button is clicked by calling [rootView.presentModalViewController:animated].
Is that what you're looking for?
Since you mention a "menu", is it possible the user may like to go back and change their selection (A or B) at some stage?
In that case you may like to also investigate if a Tab Bar Controller based application fits your needs (similiar to the built in Clock application)
This would always display two buttons at the bottom of the screen which the user could use at any point in time to switch between the two modes. it would automatically handle the switching of views "A" and "B" within the main part of the screen.
The real answer probably depends upon what your two views need to do, and what kind of UI they present.