I haven't been able to find any sort UIBarButtonSystemItem representing tha "Back" button in 开发者_如何学编程Mobile Safari. I want my UIWebView's controls to look just like the ones in Mobile Safari so it makes sense. Would the best solution be to just screenshot UIBarButtonSystemItemPlay (same image as the Forward button) and flip it?
Thanks.
I just made them for myself, basically they are exact copies (don't count the pixels though). You may use them in any way you like, commercially or not. Just don't try to sell them please.
[File removed, iOS 7 introduced a whole new look for those buttons.]
I think the right move is to try and find the raw icon somewhere (try Terminal, and find in your /Developer directory).
It's possible that
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/Applications/WebSheet.app/ArrowBack.png
is the right file.
Just taking a screenshot isn't going to work, as the toolbar icons are based on alpha levels rather than colours. If you grab a screenshot and flip it, you'll just end up with a solid square for your button.
Unicode is your friend here.
Create a UIBarButtonItem (in Interface Builder or in code) and set it to "Custom" where you can enter text for the button.
Now use these Unicode characters to simulate the back & forward buttons:
◄ and ►
I use it in my apps and it looks great.
I had the same problem but have found a very nice solution:
http://outerlevel.com/blog/2008/12/26/code-example-drawing-the-iphone-back-button/
But you have to change some values
as the following:
CGContextBeginPath(context);
CGContextMoveToPoint(context, 8.0f, 12.0f);
CGContextAddLineToPoint(context, 24.0f, 3.0f);
CGContextAddLineToPoint(context, 24.0f, 21.0f);
CGContextClosePath(context);
CGContextFillPath(context);
only a little tweak from me because the back button was not aligned to the forward button, back button was 1px too high. btw should I make this to community Wiki ? im new here ...
If I just use unicode for left-pointing triangle @"\U000025C0", it uses Apple Color Emoji. To use simple symbol without color, use unicode variation selector for text style emoji("\U0000FE0E").
So, string for the left-pointing triangle is @"\U000025C0\U0000FE0E".
I think this is the matter only on iPhone Simulator(on Mountain Lion supporting unicode 6.1), and does not cause problem on actual device, yet.
I'm not sure how iPhone apps are packaged, but if you can open the .app folder and poke around, you should be able to find the actual image file in there in the resources folder...
精彩评论