0

我想做一个保存图片的功能,成功后弹出提示。当我按下图片弹出alertController,保存成功没有看到keywindow上显示提示框,这是怎么回事?

 //show the tip of suceess
-(void)show{
UIWindow * window =[UIApplication sharedApplication].keyWindow;
[window addSubview:self];
[self mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(window.mas_top);
    make.leading.equalTo(window.mas_leading);
    make.trailing.equalTo(window.mas_trailing);
    make.bottom.equalTo(window.mas_bottom);
}];
[self layoutIfNeeded];


self.alpha = 0;
[UIView animateWithDuration:.2 animations:^{
    self.alpha = 1;
}];

_alertView.transform = CGAffineTransformMakeScale(0.1, 0.1);
[UIView animateWithDuration:0.3 delay:0.0 usingSpringWithDamping:0.7 initialSpringVelocity:1 options:UIViewAnimationOptionCurveEaseOut animations:^{
    _alertView.alpha=1.0;
    _alertView.transform = CGAffineTransformIdentity;
} completion:^(BOOL finished) {

}];

}

4

1 回答 1

0

尝试这个

 // Delay execution of my block for 10 seconds.
 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 10 * NSEC_PER_SEC),     dispatch_get_main_queue(), ^{

         UIView * windowView =[UIApplication sharedApplication].keyWindow.rootViewController.view;
        [windowView addSubview:self];


 });
于 2017-12-24T08:40:41.920 回答