我需要从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