flash!

UIWindow* window = [[UIApplication sharedApplication] keyWindow];
UIView* snapshotView = [[UIView alloc] init];
snapshotView.translatesAutoresizingMaskIntoConstraints = false;
[window addSubview:snapshotView];
[NSLayoutConstraint activateConstraints:@[
[snapshotView.topAnchor constraintEqualToAnchor:window.topAnchor],
[snapshotView.leadingAnchor constraintEqualToAnchor:window.leadingAnchor],
[snapshotView.trailingAnchor constraintEqualToAnchor:window.trailingAnchor],
[snapshotView.bottomAnchor constraintEqualToAnchor:window.bottomAnchor]
]];
snapshotView.backgroundColor = [UIColor blueColor];
[UIView animateWithDuration:0.2
animations:^{
snapshotView.alpha = 0;
}
completion:^(BOOL finished) {
[snapshotView removeFromSuperview];
}];

Leave a Reply