0

I am doing a proof of concept in UIApplication in xcode. In my application I have a common tool bar which include two buttons with action that shows the table view(list of items). I have done this programatically.

I have 10 viewcontroller which require the tool bar with two buttons. how can I get the tool bar in all viewcontroller screen. some viewcontroller also have their own table view.

I just inherit the toolbar class to all viewcontroller . it works fine except some viewcontroller page which have their own tableview. because the parent class (toolbar class) and derived class both are having the table view delegate so the derived class table view is override when accessing the base class table view.

4

1 回答 1

0

您可以做的是使工具栏成为全局工具栏,即将其添加到窗口而不是视图。这将让它在所有viewControllers.

为此,您必须创建该类的对象,appDelegate然后在要在其中显示工具栏的类中声明它。

就像是 ,

AppDelegate *appDelegate;  
appDelegate = (AppDelegate*)[[UIApplication sharedApplication]delegate];

[appDelegate.window addSubview:Toolbar];

如果viewControllers它们已在特定的viewController

于 2013-06-20T06:57:52.653 回答