iphone dev--如何让uiAlertView、action sheet用代码消失

看网上很多人没有找到这个方法,有个老外用的是一个私有的类,但他警告过了,当心你的程序进不了appStore, 打开UIAlertView.h头文件,苹果公司明确写了这么几句:

 

// hides alert sheet or popup. use this method when you need to explicitly dismiss the alert.

// it does not need to be called if the user presses on a button

- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;


请看第一句就知道如何用自己的代码消失了:
hides alert sheet or popup. use this method when you need to explicitly dismiss the alert.
当你想明确地(明确就是指用代码显式地)让alert消失,用来隐藏alert/sheet 弹出式的view.

使用方法:
UIAlertView* alertView=[[UIAlertView alloc] init......];


[alertView dismissWithClickedButtonIndex:0 animated:YESorNO];

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值