0
我創建了一個UIImageView,然後在ApplicationDidLaunch中爲它分配一個模糊背景圖像。 這imageview的重疊整個屏幕,並註定要覆蓋下面的視圖控制器ApplicationDidLaunch中的RemoveFromSuperView UIImageView延遲執行
UIImage *captureImage = [self captureView:tabBar.view];
backgroundImage.image = [captureImage applyExtraLightEffect];
backgroundImage.frame = [[UIScreen mainScreen] applicationFrame];
[tabBar.view addSubview:backgroundImage];
然後我要求觸摸ID,其很好地示出了。如果TouchID認證成功我想用一個漂亮的淡出動畫刪除背景圖像
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:@"Are you the device owner?"
reply:^(BOOL success, NSError *error) {
if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"There was a problem verifying your identity."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
exit(0);
return;
}
if (success) {
NSLog(@"Passcode via TOUCH ID entered OK");
[UIView animateWithDuration:0.5
animations:^{backgroundImage.alpha = 0;}
completion:^(BOOL finished){[[tabBar.view viewWithTag:13] removeFromSuperview];; }];
// [UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];
[UIView setAnimationDelegate:self];
}
現在我的問題是,代碼被執行的時候了,但切除和backgroundImage框架需要像5-10秒,執行。它發生在我所有的iDevices上。我不明白爲什麼在撤銷超級視圖之前有一段延遲。有沒有人有任何線索?
謝謝你解決了我的問題! – 2014-12-07 03:40:28