开发者社区> 问答> 正文

关于iPhone-带选项的警报视图

Android中可以有带选项的警报对话框,如下图:
screenshot
但是iPhone应该怎么实现类似的呢?

展开
收起
爵霸 2016-03-19 09:46:37 2383 0
1 条回答
写回答
取消 提交回答
  • 创建有代理名称和属性的MyCustomAlertViewController,创建 xib。然后这样写:

    - (void) alertForAgentName: (NSString*) anAgentName agentPhoneNumber: (NSString*) anAgentPhoneNumber
    {
        MyCustomAlertViewController* modalViewController =
            [[MyCustomAlertViewController alloc] initWithNibName: @"MyCustomAlertViewController" bundle:nil];
    
        modalViewController.agentName = anAgentName;
        modalViewController.agentPhoneNumber = anAgentPhoneNumber;
    
        UINavigationController *modalViewNavController =
            [[UINavigationController alloc]
            initWithRootViewController: modalViewController];
    
        [self.navigationController presentModalViewController:
            modalViewNavController animated:YES];
        // If MRC
        [modalViewNavController release];
    }

    解除对话框时进行调用:

    - (IBAction) dismissModalView:(id)sender
    {
        [self.parentViewController dismissModalViewControllerAnimated:NO];
    }
    2019-07-17 19:07:20
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载