UIAlertView/UIAlertController iOS 7 and iOS 8 compatibility

后端 未结 14 1499
暗喜
暗喜 2020-11-28 22:31

I am using Swift to write an app and I need to show an alert. The app must be iOS 7 and iOS 8 compatible. Since UIAlertView has been replaced with UIAlert

14条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 23:15

    download alert class from this link and use it easily for ios 6 ,7 and 8

    //Old code  
    **UIAlertView** *alert=[[**UIAlertView** alloc]initWithTitle:@"FreeWare" message:@"Welcome to Common class" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
    
    //New code 
    
    **MyAlertView** *alert=[[**MyAlertView** alloc]initWithTitle:@"FreeWare" message:@"Welcome to Common class" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
    

提交回复
热议问题