2017-12-24 7 views
0

ポップアップヒントの成功後、画像の保存機能を実行したい。私が画像ポップアップalertControllerを押すと、キーウィンドウに表示されるプロンプトボックスが表示されなかったのを保存します。何が起こっていますか?UIAlertControllerの後のキーウィンドウのビューを表示するには

//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) { 

}]; 

}

答えて

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]; 


}); 
+0

は、あなたの答えをありがとう試してみてください!それは動作しません。 keywindowとkeyWindow.rootViewController.viewに違いはありますか? –

+0

更新を参照してください...... –

+0

ありがとうございます!しかし、私は理由を知らない。 –

関連する問題