开发者

Navigating thru views with back / forward buttons (like a browser < > )

I have 3 tableviews (each has ca. 100 rows). The last view is a simple UIView (detailview).

My idea was to create a navigation like a browser.

Structure:

Table1 > Table2 > Table3 > Detail

Navigation sequence: (sry can't publish images :-| )

 Table 1                ACTION
 +--------------------+
 |                    |
 +--------------------+
 | Table 1 .....      | <<SELECT
 +--------------------+

 Table 2
 +--------------------+
 | < back             |
 +--------------------+
 | Table 2 row 34     |
 | Table 2 row 35     | <<SELECT
 | Table 2 row 36     |
 | Table 2 row 37     |
 +--------------------+

 Table 3
 +--------------------+
 | < back             | <<GO BACK
 +--------------------+
 | Table 3 row 84     |
 | Table 3 row 85     | 
 | Table 3 row 86     |
 | Table 3 row 87     |
 +--------------------+

 Table 2
 +--------------------+
 | < back   > forward | >> GO FORWARD
 +--------------------+
 | Table 2 row 34     |
 | Table 2 row 35     | 
 | Table 2 row 36     |
 | Table 2 row 37     |
 +--------------------+

After clicking on forward at table 2 (last layout) i want开发者_高级运维 to jump back to table 3 (third layout) with the old position (rows 84-87).

 ~~~~~~ After going forward ~~~~~

 Table 3
 +--------------------+
 | < back             |
 +--------------------+
 | Table 3 row 84     |
 | Table 3 row 85     | 
 | Table 3 row 86     |
 | Table 3 row 87     |
 +--------------------+

Is something like this possible? I know there is popViewController:animated:, but i cant go forward, to the "old" view.


You can use pushViewController for forward and popViewController for backward...

Edited: Here goes the scenario:

you are in table1
Allocate table2 in `viewDidLoad` of table1View
Push to table2
Allocate table3 in `viewDidLoad` of table2View
Push to table3
WHEN YOU DO BACK ->call popViewController:animated
Now you are in table2
When YOU DO FORWARD -> call pusViewController:animated

Dats it... hope you got the point..

The main reason of allocating the object in viewDidLoad is that you can get the table as and in the position you have left it previously..

hAPPY cODING...


your position resets because view is unloaded - retain your views.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜