开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜