Попробуйте это, он работает на моем конце.
@interface ViewController (){
__weak IBOutlet UIView *view3;
__weak IBOutlet UIView *view2;
__weak IBOutlet UIView *view1;
BOOL isshowing;
}
@end
@implementation ViewController
#pragma mark - UIView Controller Life Cycle
- (void)viewDidLoad {
[super viewDidLoad];
isshowing = YES;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView; {
CGFloat offset = scrollView.contentOffset.y;
CGFloat viewOffset = view1.frame.size.height + view1.frame.origin.y;
if (viewOffset > offset) {
if (isshowing == NO) {
view1.hidden = NO;
view1.alpha = 0;
[UIView animateWithDuration:0.3 animations:^{
view1.alpha = 1;
} completion:^(BOOL finished) {
}];
}
isshowing = YES;
NSLog(@"View 1 show");
}
if (viewOffset < offset) {
if (isshowing == YES) {
[UIView animateWithDuration:0.3 animations:^{
view1.alpha = 0;
} completion:^(BOOL finished) {
view1.hidden = YES;
}];
}
isshowing = NO;
NSLog(@"View 1 Hide");
}
}
Просто настройте загрузчик на всю сетку, определенную для вашего основного контента:
app {
display: grid;
grid-template-areas:
"main other"
"main other"
"main other";
height: 200px;
border: 1px solid;
}
#main {
grid-area: main;
background: red;
}
#other {
grid-area: other;
background: green;
}
#preloader {
grid-column: 1/span 2;
grid-row: 1/span 3;
background: yellow;
}
While loading
<app>
<div id="preloader">
</div>
</app>
After content is loaded
<app>
<div id="main">
</div>
<div id="other">
</div>
</app>