0
我在故事板中使用UITableViewController。導航欄標題沒有設置和後退按鈕不禁用在UITableViewControler
[self.navigationController setNavigationBarHidden:NO animated:NO];
[self.navigationItem setHidesBackButton:YES animated:YES];
UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back2.png"] style:UIBarButtonItemStylePlain target:self action:@selector(back:)];
self.navigationItem.leftBarButtonItem = editButton;
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
[self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:(44/255.0f) green:(165/255.0f) blue:(264/255.0f) alpha:(1.0f)]];
[self.navigationItem setTitle:@"SETTINGS"];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
問題是我想隱藏後退按鈕和標題不顯示在導航欄中。相同的代碼在UIViewcontroller中起作用。
你究竟在哪裏放置這段代碼?在哪個方法? –
如果你沒有發現問題,也許只是使用一個UIViewController,並把一個ViewController裏面。這些變化很小,UIViewController稍後會給你更多的靈活性(以我的經驗..) –
我把這段代碼放在viewWillApear方法中。 – Singh