sinat_36062173
sinat_36062173
2016-09-08 01:10
采纳率: 0%
浏览 1.5k

IOS的警告框与页面跳转

IOS里面如何实现点击警告框中的按钮,然后跳转到另一个页面(viewcontroller)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

5条回答 默认 最新

  • hi_chen_xingwang
    朕就是这么帅 2016-09-08 10:01

    AlertViewController /UIAlertView 服从代理写方法去跳转就可以

    点赞 评论
  • u013026165
    lufee_liufei 2016-09-27 08:26

    //这是只有取消和确定按钮的alertView的代理方法的实现
    -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (alertView == self.logoutAlertView) {
    if (buttonIndex == 0) {
    debugLog(@"取消");
    //取消跳转
    }
    if (buttonIndex == 1) {
    debugLog(@"确定");
    //确定,然后在这里面实现跳转的事件
    }
    }
    }

    点赞 评论
  • u012877287
    木易晓天 2016-10-08 08:00

    UIActionSheet *actionS = [[UIActionSheet alloc]initWithTitle:@"标题" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"跳转到页面一",@"跳转到页面二",@"跳转到页面3", nil];
    [actionS showInView:self.view];

    再抄上楼二楼的 基本就够了

    记得准守协议和赋上代理

    点赞 评论
  • Soar2
    Soar2 2016-10-10 03:27

    楼上说的方法差不多就可以实现了!

    点赞 评论
  • qq_36634059
    打乒乓真开心 2016-11-07 02:31

    UIAlertController,在确定的block块里,实现页面跳转
    代码如下:

     - (void)showOkayCancelAlert {
        NSString *title = NSLocalizedString(@"A Short Title Is Best", nil);
        NSString *message = NSLocalizedString(@"A message should be a short, complete sentence.", nil);
        NSString *cancelButtonTitle = NSLocalizedString(@"Cancel", nil);
        NSString *otherButtonTitle = NSLocalizedString(@"OK", nil);
    
        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
    
        // Create the actions.
        UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
            NSLog(@"The \"Okay/Cancel\" alert's cancel action occured.");
        }];
    
        UIAlertAction *otherAction = [UIAlertAction actionWithTitle:otherButtonTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
            NSLog(@"The \"Okay/Cancel\" alert's other action occured.");
        }];
    
        // Add the actions.
        [alertController addAction:cancelAction];
        [alertController addAction:otherAction];
    
        [self presentViewController:alertController animated:YES completion:nil];
    }
    

    大神问答,程序员专用问答网站,又快又准找到问题答案!

    点赞 评论

相关推荐