how to add an icon to an UIActionSheet button?
I hope to know how to add an icon to an UIActionSheet button?
I checked some documen开发者_如何学运维t but no result.
Welcome any comment
Thanks
interdev
Although there is no API, it is a simple property you can change.
You can access each UIButton image like so:
SEL buttonsSEL = @selector(buttons);
if([yourUIActionSheet respondsToSelector:buttonsSEL]) {
NSString *buttonsSel = NSStringFromSelector(buttonsSEL);
[[[yourUIActionSheet valueForKey:buttonsSel objectAtIndex:yourIndex]
setImage:[UIImage imageNamed:@"yourImage.png"]
forState:UIControlStateNormal];
...
}
where
- yourUIActionSheet is a UIActionSheet*
- yourIndex is an int representing the button index, starting at 0
No way to do this with the current SDK.
精彩评论