Using standard refresh button
I'm trying to display a small refresh button using UIButton in a standard UIView using the refresh icon built into UIKit. If I use an UIBarButtonItem it can be created as a refresh button, but I've had no luck in using this icon in other places.
So far I'v开发者_如何学Pythone tried to "steal" the refresh image of a UIBarButtonItem using the code below, but the image returned is nil:
UIBarButtonItem *temp = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:nil action:nil];
self.refreshButton.imageView.image = temp.image;
[temp release];
Any suggestions, or do I have to provide a refresh image myself?
Here's the png, straight from the OS:
You'll have to either make one yourself, hire a designer, or find a free one somewhere that you can use. The Toolbar buttons can only be used inside of a toolbar.
Glyphish has a free set of icons, including a "refresh" icon, which you can use if you agree to the Creative Commons Attribution license terms.
I don't know that Apple would allow you to use their UI images in a way they deem inappropriate, but you could always try a screenshot and store the image in your project yourself. You can run a sample in the simulator to get an easy screenshot on your development machine.
Failing that, I've found a ton of excellent icons sets at http://icons.mysitemyway.com/
IN OS X, you can get that icon with NSImageNameRefreshTemplate, check the doc "System-Provided Icons". But for iOS, system provided icons are not exposed to our developers I think.
精彩评论