IOS8以上的UIAlertView
在iOS8以前,我们都习惯性用UIAlertView去做提示框,iOS8以后,苹果提倡使用UIAlertController取代UIAlertView。
#defineSYSTEM_VERSION[[UIDevicecurrentDevice].systemVersionfloatValue]
if(SYSTEM_VERSION>=8.0){UIAlertController*alertCtrl=[UIAlertControlleralertControllerWithTitle:@"赎回成功"message:nilpreferredStyle:UIAlertControllerStyleAlert];UIAlertAction*okAction=[UIAlertActionactionWithTitle:@"确定"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction*action){[self.navigationControllerpopViewControllerAnimated:YES];}];[alertCtrladdAction:okAction];[selfpresentViewController:alertCtrlanimated:YEScompletion:nil];}else{//这个else一定要写,否则会导致在ios8一下的真机crashUIAlertView*alert=[[UIAlertViewalloc]initWithTitle:@"赎回成功"message:nildelegate:selfcancelButtonTitle:nilotherButtonTitles:@"确定",nil];alert.tag=998;[alertshow];}
#pragmamark-UIAlertViewDelegate-(void)alertView:(UIAlertView*)alertViewclickedButtonAtIndex:(NSInteger)buttonIndex{if(alertView.tag==998){[self.navigationControllerpopViewControllerAnimated:YES];}}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。