經(jīng)常在項(xiàng)目中,使用強(qiáng)制更新的功能届宠,我們可以使用UIAlertview跳轉(zhuǎn)到APPStore進(jìn)行更新乘粒,但是同時(shí)也可以點(diǎn)擊左上方的小箭頭,返回到之前的APP.這時(shí)候谓厘,UIAlertview已經(jīng)消失竟稳,我們需要讓他依然在,一直在聂宾!
import "DGAlertView.h"
#import <UIKit/UIKit.h>
@interface DGAlertView : UIAlertView
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;
@end
DGAlertView.m
#import "DGAlertView.h"
@implementation DGAlertView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated{
if (buttonIndex == 0) {
//[super dismissWithClickedButtonIndex:buttonIndex animated:animated]; // 消失
}else{
// ...
// 不消失
}
}
@end
重寫系統(tǒng)的這個(gè)方法诊笤,就OK了
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated