1
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#import "HomeMainVC.h"
|
||||
#import "HomeHeadView.h"
|
||||
#import "KBPanModalView.h"
|
||||
#import "KBGuideVC.h" // 首次安装指引页
|
||||
|
||||
@interface HomeMainVC ()
|
||||
@property (nonatomic, strong) HomeHeadView *headView;
|
||||
@@ -43,6 +44,31 @@
|
||||
[self.simplePanModalView presentInView:self.view];
|
||||
}
|
||||
|
||||
// 在界面可见后做“首次安装”检查,避免在 viewDidLoad 期间 push 引起的转场警告
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
[self kb_showGuideIfFirstLaunch];
|
||||
}
|
||||
|
||||
/// 首次安装进入首页时,跳转到 KBGuideVC
|
||||
- (void)kb_showGuideIfFirstLaunch {
|
||||
static NSString *const kKBHasLaunchedOnce = @"KBHasLaunchedOnce";
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
if (![ud boolForKey:kKBHasLaunchedOnce]) {
|
||||
[ud setBool:YES forKey:kKBHasLaunchedOnce];
|
||||
[ud synchronize];
|
||||
|
||||
// 避免重复 push;同时确保在主线程执行
|
||||
if (self.navigationController && self.presentedViewController == nil) {
|
||||
KBGuideVC *vc = [KBGuideVC new];
|
||||
vc.hidesBottomBarWhenPushed = YES;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setupMas{
|
||||
[self.headView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self.view);
|
||||
|
||||
Reference in New Issue
Block a user