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!
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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:)];
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.
EDIT 7/16/17 Added the 3x images as well!