带iOS 7的UIAlertController(UIAlertControllerStyleActionSheet)

带iOS 7的UIAlertController(UIAlertControllerStyleActionSheet),ios,objective-c,uialertview,uialertcontroller,Ios,Objective C,Uialertview,Uialertcontroller,在iOS 8中,要获得添加照片警报功能,我需要: UIAlertController * view= [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];

在iOS 8中,要获得添加照片警报功能,我需要:

UIAlertController * view=   [UIAlertController
                             alertControllerWithTitle:nil
                             message:nil
                             preferredStyle:UIAlertControllerStyleActionSheet];

UIAlertAction* choosePhoto = [UIAlertAction
                     actionWithTitle:@"Choose Exisiting"
                     style:UIAlertActionStyleDefault
                     handler:^(UIAlertAction * action)
                     {
                         [self selectPhoto];

                     }];
[view addAction:choosePhoto];
...
在iOS7中如何执行相同的操作


UIAlertController
不适用于iOS7.1,并且
UIAlertView
不提供此类功能。

根据上述要求,我回答自己的问题:

- (void)updateWithActionSheet:(BOOL)isNew
{
    NSString *destructiveButtonTitle  = nil;
    if (!isNew) {
        destructiveButtonTitle = @"Delete it";
    }

    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                             delegate:self
                                                    cancelButtonTitle:@"Cancel"
                                               destructiveButtonTitle:destructiveButtonTitle
                                                    otherButtonTitles:@"Choose Exisiting", @"Take Photo", nil];


    [actionSheet showInView:self.view];
}

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    NSString *buttonTitle = [actionSheet buttonTitleAtIndex:buttonIndex];
    if ([buttonTitle isEqualToString:@"Cancel"]) {
        [self.firstNameTextField becomeFirstResponder];
    }
    if ([buttonTitle isEqualToString:@"Choose Exisiting"]) {
        [self selectPhoto];
    }
    if ([buttonTitle isEqualToString:@"Take Photo"]) {
        [self takePhoto];
    }
    if ([buttonTitle isEqualToString:@"Delete it"]) {
        [self deletePhoto];
    }
}

我想你在找
UIActionSheet
@ScottBerrevets它现在对我有效你能添加解决方案吗?@DaRk-\uud0g…刚刚添加了