如何在左侧制作带有后退/前进箭头的 iOS UIToolbar [英] How to make iOS UIToolbar with back/forward arrows on the left

查看:33
本文介绍了如何在左侧制作带有后退/前进箭头的 iOS UIToolbar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将工具栏放置在日期选择器上方,该工具栏的左侧有后退和前进箭头.我想使用标准的 iOS 机器来做到这一点,而不是推出自定义按钮来做到这一点.这可能吗?我附上了一张图片供参考.提前致谢!

I am trying to place a toolbar above a date picker that has back and forward arrows on the left side of the toolbar. I'd like to do this using standard iOS machinery and not roll out custom buttons to do this. Is this possible? I have attached an image for referral. Thanks in advance!

推荐答案

我知道你不想使用自定义按钮,而且这个解决方案没有自定义按钮,但它有自定义图标.我希望这个对你有用.我到处寻找解决方案,但没有找到 Apple 构建的任何东西,所以我想我会自己做.这就是它的样子,不完全相同,但非常接近.

I know you don't want to use custom buttons, and this solution doesn't have custom buttons, but it does have custom icons. I hope it works for you. I have looked all over the place for a solution and did not find anything that Apple built, so I figured I would make my own. This is what it looks like, not identical, but pretty close.

在我制作工具栏的方法中,我使用了这段代码.

In my method where I make the toolbar, I used this code.

 previousButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Back.png"]
                                                      style:UIBarButtonItemStyleBordered
                                                     target:self 
                                                     action:@selector(previousField:)];
 nextButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Forward.png"]
                                                  style:UIBarButtonItemStyleBordered
                                                 target:self 
                                                 action:@selector(nextField:)];

您需要做的就是插入图像.我在一个名为 Paint Code 的程序中制作了视网膜和非视网膜.

All you need to do is insert the images. I made both retina and non retina in a program called Paint Code.

也许这会对某人有所帮助.

Maybe this will help someone out.

编辑 7/16/17还添加了 3x 图像!

EDIT 7/16/17 Added the 3x images as well!

这篇关于如何在左侧制作带有后退/前进箭头的 iOS UIToolbar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆