English 中文(简体)
back button goes back to a different UITableViewController from where it came from
原标题:

Say I have UITableViewController A, and UITableViewController B. Both A and B loads UIView C. At the back button in C, how do I make sure it always goes back to B, rather than where it came from?

Here is a concrete example: A=Contacts window in iphone skype. B=Chats window, each row is a chat history with a different person C = Chat window displays a conversation with the same person .

C can be loaded from A or B, but I want the backbutton on the Chat window ( C ) goes back to Chats (B) window only.

Cheers.

最佳回答

I got the answer from google group and followed his suggestion, it works:

From Sukima: I believe (although I have no real idea) that what these applications like skype and Beejive are doing is when view A wants view C it will message your UITabBar to move to the chats tab then push in the detail view C. This is actually better because then the user will see that the view has changed via the fact that the tabbar has changed highlights. from: I further read the stackoverflow thread. I understand now what your asking.

问题回答

Your going to find this hard to implement largely because this is a bad UI design and the API does not support it.

You user will expect a back button to take them "back" to the previous view just as in every other app they use. Going to any other view will confuse them all the more so because it isn t a hierarchy but a loop. Users will sometimes go B-->C-->B but other times, A-->C-->B-->C. (How do they get back to A?)

Instead of a back button in C, you should have a button on the right hand side that always takes you to B regardless of how you got to C. The same button in the same context should always produce the same result. Users shouldn t have to remember what invisible mode they are in to predict what action a button will have.


Edit01:(Response to comments below)

(This is all off the top of my head so take it with a grain of salt.) You will need to abandon using the navigation controller and instead manage the views yourself. You will need to swap the views out via the tabbar by substituting the C view for the A and B views in each tab s view property.

I think you will have to start with master view that is invisible and then add the tabbar to that. In the master view controller, create attributes/outlets for each view. In each view, have an attribute/outlet linked to the master view controller. Then have the "back button" (which I strongly suggest you label "Chats") of C view call method in A and B that then calls a method in the master view controller that (1)removes the C view from either tab A or tab B (2) switches the tab to the B tab and then (3) loads view B into tab B.

I can t emphasis how ungainly I think this design is. It doesn t matter if other apps use it. In my experience major companies are more likely to make interface mistakes because their marketing departments want the UI to look unique.

By comparison, look at how the phone app handles the same situation. No matter which tab you use to make a call, favorites, contacts, keypad etc, you still come back that tab s view when the call is done. If you want to make a call with another method, you just hit the appropriate tab.

Ignore the bad example of others. Why spend so much time and effort trying to reproduce someone else s mistake?

You ll always wind up going back to the view that called pushViewController

Could you have A send B a message that causes B to call pushViewController?
I may not understand your architecture, but I believe that would work.

If you really want to do this you could create a method in B that pushes C then push B from A (without animation) and call the method that pushes C. Of course when you pop C to B, A will still be under it.





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签