iPhone-出现后,UIViewController中的工具栏立即消失

问题描述

| 我使用此代码在UIViewController中显示一个工具栏(由UINavigationController推送)。工具栏显示并立即消失:
UIBarButtonItem * logoutButton = [[UIBarButtonItem alloc] initWithTitle:@\"Log out\" style:UIBarButtonItemStylePlain target:self action:nil];
NSMutableArray * arr = [NSMutableArray arrayWithObjects:logoutButton,nil];
[self settoolbaritems:arr animated:NO];
[self.navigationController setToolbarHidden:NO animated:NO];
你知道是什么问题吗?     

解决方法

        这段代码在哪里?在这里似乎并没有什么不同,所以要么与您调用它的位置有关,要么与之后发生的其他事情有关(例如,将工具栏在以后设置为“是”或其他)