fix: the timing of iOS's onShow call
This commit is contained in:
parent
531e2d9298
commit
e62bfa315e
@ -23,6 +23,7 @@
|
||||
@interface DoricPanel ()
|
||||
@property(nonatomic, assign) CGFloat renderedWidth;
|
||||
@property(nonatomic, assign) CGFloat renderedHeight;
|
||||
@property(nonatomic, assign) BOOL isShow;
|
||||
@end
|
||||
|
||||
@implementation DoricPanel
|
||||
@ -47,9 +48,6 @@ - (void)config:(NSString *)script alias:(NSString *)alias extra:(NSString *)extr
|
||||
[self.view addSubview:it];
|
||||
}]];
|
||||
}];
|
||||
if (self.parentViewController != nil) {
|
||||
[self.doricContext onShow];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewWillLayoutSubviews {
|
||||
@ -58,17 +56,27 @@ - (void)viewWillLayoutSubviews {
|
||||
self.renderedWidth = self.view.width;
|
||||
self.renderedHeight = self.view.height;
|
||||
[self.doricContext build:CGSizeMake(self.renderedWidth, self.renderedHeight)];
|
||||
if (!self.isShow) {
|
||||
self.isShow = YES;
|
||||
[self.doricContext onShow];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
if (self.doricContext && !self.isShow) {
|
||||
self.isShow = YES;
|
||||
[self.doricContext onShow];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
[super viewDidDisappear:animated];
|
||||
if (self.isShow) {
|
||||
self.isShow = NO;
|
||||
[self.doricContext onHidden];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user