简体   繁体   中英

Back button on navigation bar

How do I achieve this kind of button? Can I do using navigation bar ?

在此处输入图片说明

You have to use a UINavigationController . Each time you push a new view controller using:

self.navigationController?.pushViewController(controller, animated: true)

the new controller gets a back button with the previous controller in the stack name.

是的,您可以通过在设置视图控制器中提供导航标题来实现。

self.navigationItem.title = @"Settings";

yes you can achieve this by navigationBar. it is very easy in implement by UINavigationBar.

Objective C

// Set this in every view controller so that the back button displays back instead of the root view controller name

self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];

Swift

self.navigationItem.backBarButtonItem = UIBarButtonItem(title:"", style:.Plain, target:nil, action:nil)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM