Change alpha status bar

In the Snapchat app, the status bar changes alpha when the table view is dragged to reload.

This is a normal status bar. This is a normal status bar.

This is what happens when the table view is dragged down. enter image description here

How has the alpha status bar changed? And how has the frame changed? Initially, I thought it was a snapshot, but the clock changes as usual.

+5
source share
2 answers

This should do the trick for attenuation animation:

/* Swift 3 */ let statusBarWindow = UIApplication.shared.value(forKey: "statusBarWindow") as? UIWindow UIView.animate(withDuration: 2) { statusBarWindow?.alpha = 0.2 } /* Objective-C */ UIWindow *statusBarWindow = (UIWindow *)[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"]; [UIView animateWithDuration:2.f animations:^{ [statusBarWindow setAlpha:0.2]; } completion:nil]; 

You can also set the statusBarWindow frame and move it the way you want. Good luck;]

+9
source

Most likely, they will either capture the window in which the status bar is located, or animate it, or place a window above the status bar with a view and animate it. I do not have a validation application, but this should be one of these two methods. To place the window above the status bar, I think it is window.windowLevel = UIWindowLevelStatusBar + 1 so that it is above your status bar. If they capture a link, you need to loop around the application windows to find it, and I never tried to find the Statusbar window, but I grabbed the keyboard window. If the clock is really reset, then this can be a combination of both getting the window in which the status bar is located, and adding the window up and animating both. Facebook captures the keyboard window to scroll through it in Facebook Messenger. Hope this helps you.

Edit: I found an example of getting a status window here .

I would also recommend using CAAnimations and not changing anything. Just use animations to give it a look.

0
source

Source: https://habr.com/ru/post/1265580/


All Articles