我需要從AppDelegate中設置UIViewController的一些UI元素。我使用Storyboard,所以UIViewController不會在AppDelegate中初始化。從Storyboard實例化UIViewController時無法從AppDelegate更改UI
我試圖讓UIViewController中的實例與:
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]];
TableViewController* myTableViewController = [storyboard instantiateViewControllerWithIdentifier:@"myTableViewController"];
但是,當我嘗試設置一些UI元素,如UINavigationBar的的的UIBarButtonItem,喜歡這裏:
UIBarButtonItem* refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refreshEntry)];
myTableViewController.navigationItem.rightBarButtonItem = refreshButton;
的UINavigationBar的住宿空白和UIBarButtonItem不會出現...
如何更改UI?
好的......謝謝! Thant的解決方案:3 – Lindemann 2012-02-20 01:02:42
我現在發現,我知道問題是什麼,一個類似的問題:http://stackoverflow.com/questions/8784143/accessing-a-view-controller-created-through-storyboard-using-在應用程序內,委託 – Lindemann 2012-02-20 01:05:23