Advertisement

ios 9提示框正确方法

阅读量:

在iOS8向iOS9的系统升级过程中,弹出提示框的实现方式发生了显著变化。在Xcode7及iOS9.0的SDK中,明确指出UIAlertView已不再被推荐使用,开发者应改用UIAlertController进行替代。以下通过代码示例来展示这一变化的具体实现方式。

当用户点击某一按钮后,系统将触发提示框的显示功能,具体代码示例如下:

复制代码
 #import "ViewController.h"

    
  
    
 @interface ViewController ()
    
  
    
 @property(strong,nonatomic) UIButton *button;
    
  
    
 @end
    
  
    
 @implementation ViewController
    
  
    
 - (void)viewDidLoad {
    
   [super viewDidLoad];
    
   
    
   self.button = [[UIButton alloc] initWithFrame:CGRectMake(0, 100, [[UIScreen mainScreen] bounds].size.width, 20)];
    
   [self.button setTitle:@"跳转

全部评论 (0)

还没有任何评论哟~