I am working on an app. I tried to add an UIIMage to UIAlertView using below code,
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Instruction"
message:@"Please TAP on Screen to Continue."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(220, 50, 32, 32)];
UIImage *img = [UIImage imageNamed:@"pendingImg.png"];
[imageView setImage:img];
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
[alert setValue:imageView forKey:@"accessoryView"];
}else{
[alert addSubview:imageView];
}
[alert show];
My image is of dimension 32 × 32 pixels. I am getting the alert as shown,
Should I add constraints to this image? or anything else to be made?