I have an UIAlertView which has an Button. By pressing that button I need to load a Camera controller(Image Picker) above the UIAlertView. Pressing cancel in ImagePicker will go back to UIAlertView of Previous view.
Any Help is Greatly appreciated. Thanks in Advance.
{
UIButton *aStartTimer = [[UIButton alloc]initWithFrame:CGRectMake(90, 170, 45, 45)];
[aStartTimer setImage:[UIImage imageNamed:@"timer.png"] forState:UIControlStateNormal];
[alertView addSubview:aS开发者_JAVA百科tartTimer];
}
Thanks in advance
UIAlertView * alertAddImage = [[UIAlertView alloc] init];
[alertAddImage setDelegate:self];
[alertAddImage setTitle:@"Add Images"];
[alertAddImage addButtonWithTitle:@"Take a New Picture"];
[alertAddImage addButtonWithTitle:@"Cancel"];
[alertAddImage setNeedsLayout];
[alertAddImage show];
[alertAddImage release];
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0)
[self imageFromCamera];
}
-(void)imageFromCamera{
imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:imgPicker animated:YES];
}
精彩评论