开发者

Handling UITabController and UIViewController

I have a class called ListViewController which has a UITableView attached to it and shows a list of elements, also the ListViewController is handled in a nib that has a UITabBarController (i started the project using the Tab Bar app template).

Now, 开发者_如何学编程the problem is, i want to reuse the ListViewController in another tab of the UITabBarController but with different settings that the instance i had before, and also, before actually showing the ListViewController, i want to show a different view and that view can later show the ListViewController. . As i created the project using the template, i'm not sure how to customize the behavior so when the user clicks on a different tab, a UIViewController which is an instance in the AppDelegate is created and not setting the class in the "Class identity" tab in the Interface builder.

I hope i could state my problem in a understandable way.. as i'm new to objective-c development, it's kinda hard to express my problem.

Thanks!


Using the template is tricky, because the second tab they give you doesn't match up to it's own XIB. For a scenario like this, I would hold your Tab Bar Controller in MainWindow.xib, and create a xib for each tab. So you would wind up w/ three xibs. Just be sure to set the appropriate settings in the inspector for the tab bar controller (NIB Name, Your custom Class identity, and add the tabs) and also double check the File's Owner view outlet for each tab. You shouldn't need to mess with the AppDelegate at all.

Hope that helps!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜