我正在尝试以这种方式在 UIAlertView 中添加图像:
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Accept Connection?"
message:[NSString stringWithFormat:@"%@ wants to connect with you", newStr]
delegate:self
cancelButtonTitle:@"No"
otherButtonTitles:@"Yes", nil];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 100, 100, 50)];
NSString *imgPath = [[NSString alloc] initWithString:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"BluetoothDeviceiPhone.png"]];
UIImage *yourImage = [[UIImage alloc] initWithContentsOfFile:imgPath];
[imageView setImage:yourImage];
[alertView addSubview:imageView];
[alertView show];
alertView.tag = 2;
图像没有显示,也没有显示空间,只有文本。为什么??