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