需要有关添加导航项目的帮助

发布于 2024-09-05 00:44:24 字数 405 浏览 0 评论 0原文

alt text

正如您在图像中看到的,按下导航控制器时会自动创建顶部图片

如果我尝试创建这样的一个,它会像下面的图片一样显示。

如何以编程方式创建如上图所示的后退按钮?

这是我创建“完成”按钮的代码

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(backtohome)];

alt text

As you see in the images, the top picture is created automatically when navigation controller is pushed

If I try to create one like this it will appear like the bottom picture.

How can I programmatically create a Back Button like the top picture?

Here is my code to create the Done button

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(backtohome)];

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我很坚强 2024-09-12 00:44:24
UIBarButtonItem *theBackButton = [[UIBarButtonItem alloc] initWithTitle:@"Done"
                                                                  style:UIBarButtonItemStylePlain target:self action:nil]; 
self.navigationItem.backBarButtonItem = theBackButton;
[theBackButton release];
UIBarButtonItem *theBackButton = [[UIBarButtonItem alloc] initWithTitle:@"Done"
                                                                  style:UIBarButtonItemStylePlain target:self action:nil]; 
self.navigationItem.backBarButtonItem = theBackButton;
[theBackButton release];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文