在 UINavigationController 上创建后向箭头形状的 leftBarButtonItem
我有一个带有导航控制器的视图,我以模态方式显示该视图,并且我想添加一个后退按钮,其形状类似于大多数 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,创建这样的按钮不是公共 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.
虽然,这看起来像是一个小场景,但有一个名为 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.