在 UINavigationController 上创建后向箭头形状的 leftBarButtonItem

发布于 2024-09-11 03:46:11 字数 427 浏览 2 评论 0原文

我有一个带有导航控制器的视图,我以模态方式显示该视图,并且我想添加一个后退按钮,其形状类似于大多数 splitViewController 中使用的默认左箭头按钮。

我可以创建一个基本按钮,但我真的想要左箭头形状 - 这就是我现在拥有的:

/* set title and nav bar items */
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Back To Thumbnails" style:UIBarButtonItemStylePlain target:self action:@selector(backToThumbnails:)] autorelease];

我在这里只看到了 3 个样式选项?任何建议将不胜感激!

I have a view with a navigation controller that I am showing modally and I want to add a back button that is shaped like the default left arrow buttons used in most splitViewControllers.

I can create a basic button but I really want the left arrow shape - here is what i have now:

/* set title and nav bar items */
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Back To Thumbnails" style:UIBarButtonItemStylePlain target:self action:@selector(backToThumbnails:)] autorelease];

I only saw 3 options for style here? Any suggestions are greatly appreciated!

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

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

发布评论

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

评论(2

第七度阳光i 2024-09-18 03:46:11

不幸的是,创建这样的按钮不是公共 API 的一部分,您需要制作一个自定义 带有图像的 UIBarButton

Unfortunately creating a button like that is not apart of the public API, you'll need to make a custom UIBarButton with an image.

一曲琵琶半遮面シ 2024-09-18 03:46:11

虽然,这看起来像是一个小场景,但有一个名为 Three20 的开源库,它是由Facebook 应用程序的开发者。它有一个叫做 TTButton 的东西(与 UIButton 非常相似),提供的样式之一是带有箭头的后退按钮。它是一个相当大的库,所以我不确定是否值得将其放入其中,尽管它们确实提供了一些其他地方没有的非常好的功能。

Although, this seems like a small scenario, there is a open source library called Three20 which is created by the developer of the Facebook app. It has something called TTButton in there (very similar to UIButton) and one of the styles offered is the back button with arrow. Its a pretty big library, so I am not sure if it will be worth to put this in just for one thing although they do offer some very nice feature that are not available else where.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文