将图像添加到UIActionSheet中

时间:2009-08-20 11:46:52

标签: iphone

如何将图像添加到UIActionSheet中?

1 个答案:

答案 0 :(得分:2)

试试这个:

(void)willPresentActionSheet:(UIActionSheet *)actionSheet{

UIImageView* df = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourpic.png"]];
df.center

[actionSheet addSubview:df];
//scale image aspect to fit image view
df.contentMode = UIViewContentModeScaleAspectFit;
//change width of frame
CGRect frame = df.frame;
frame.size.width = 50;
df.frame = frame;

} 

如图所示,它会调整大小。