像在UIDocumentInteractionController中一样将图像添加到UIActionSheet按钮 [英] Adding Images to UIActionSheet buttons as in UIDocumentInteractionController
本文介绍了像在UIDocumentInteractionController中一样将图像添加到UIActionSheet按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以将图像添加到 UIActionSheet
的按钮中,如 UIDocumentInteractionController
中所示?如果是这样,请告诉我它是如何完成的。
Is it possible to add an image to the buttons of the UIActionSheet
as seen in UIDocumentInteractionController
? If so, please let me know how it is done.
推荐答案
试试这种方式,我希望它可以帮到你。
Try this way, i hope it may be help you.
UIActionSheet * action = [[UIActionSheet alloc]
initWithTitle:@"Title"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"",nil];
[[[action valueForKey:@"_buttons"] objectAtIndex:0] setImage:[UIImage imageNamed:@"yourImage.png"] forState:UIControlStateNormal];
[[[action valueForKey:@"_buttons"] objectAtIndex:0] setImage:[UIImage imageNamed:@"yourImage_Highlighted.png"] forState:UIControlStateHighlighted];
这篇关于像在UIDocumentInteractionController中一样将图像添加到UIActionSheet按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文