diff --git a/keyBoard.xcodeproj/project.pbxproj b/keyBoard.xcodeproj/project.pbxproj index 361bae5..b06cd04 100644 --- a/keyBoard.xcodeproj/project.pbxproj +++ b/keyBoard.xcodeproj/project.pbxproj @@ -54,7 +54,6 @@ 0459D1B72EBA287900F2D189 /* KBSkinManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B62EBA287900F2D189 /* KBSkinManager.m */; }; 0459D1B82EBA287900F2D189 /* KBSkinManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B62EBA287900F2D189 /* KBSkinManager.m */; }; 0460866B2F18D75500757C95 /* ai_test.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 0460866A2F18D75500757C95 /* ai_test.m4a */; }; - 046086732F191B6900757C95 /* KBAiMainVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 046086722F191B6900757C95 /* KBAiMainVC.m */; }; 046086752F191CC700757C95 /* AI技术分析.txt in Resources */ = {isa = PBXBuildFile; fileRef = 046086742F191CC700757C95 /* AI技术分析.txt */; }; 0460869A2F19238500757C95 /* KBAiWaveformView.m in Sources */ = {isa = PBXBuildFile; fileRef = 046086992F19238500757C95 /* KBAiWaveformView.m */; }; 0460869C2F19238500757C95 /* KBAiRecordButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 046086972F19238500757C95 /* KBAiRecordButton.m */; }; @@ -404,8 +403,6 @@ 0459D1B52EBA287900F2D189 /* KBSkinManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSkinManager.h; sourceTree = ""; }; 0459D1B62EBA287900F2D189 /* KBSkinManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSkinManager.m; sourceTree = ""; }; 0460866A2F18D75500757C95 /* ai_test.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = ai_test.m4a; sourceTree = ""; }; - 046086712F191B6900757C95 /* KBAiMainVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBAiMainVC.h; sourceTree = ""; }; - 046086722F191B6900757C95 /* KBAiMainVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBAiMainVC.m; sourceTree = ""; }; 046086742F191CC700757C95 /* AI技术分析.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = "AI技术分析.txt"; sourceTree = ""; }; 046086962F19238500757C95 /* KBAiRecordButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBAiRecordButton.h; sourceTree = ""; }; 046086972F19238500757C95 /* KBAiRecordButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBAiRecordButton.m; sourceTree = ""; }; @@ -1158,8 +1155,6 @@ 0460866E2F191A5100757C95 /* VC */ = { isa = PBXGroup; children = ( - 046086712F191B6900757C95 /* KBAiMainVC.h */, - 046086722F191B6900757C95 /* KBAiMainVC.m */, 048FFD092F273BFC005D62AE /* KBAIHomeVC.h */, 048FFD0A2F273BFC005D62AE /* KBAIHomeVC.m */, 048FFD2B2F29F356005D62AE /* KBAIMessageVC.h */, @@ -2474,7 +2469,6 @@ 04122FAD2EC73C0100EF7AB3 /* KBVipSubscribeCell.m in Sources */, 049FB31D2EC21BCD00FAB05D /* KBMyKeyboardCell.m in Sources */, 048909F62EC0AAAA00FABA60 /* KBCategoryTitleCell.m in Sources */, - 046086732F191B6900757C95 /* KBAiMainVC.m in Sources */, 048909F72EC0AAAA00FABA60 /* KBCategoryTitleView.m in Sources */, 048FFD332F29F3D2005D62AE /* KBAIMessageChatingVC.m in Sources */, 048FFD342F29F400005D62AE /* KBAIMessageListVC.m in Sources */, diff --git a/keyBoard/Assets.xcassets/AI/ai_limit_close.imageset/Contents.json b/keyBoard/Assets.xcassets/AI/ai_limit_close.imageset/Contents.json new file mode 100644 index 0000000..8ea17fb --- /dev/null +++ b/keyBoard/Assets.xcassets/AI/ai_limit_close.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ai_limit_close@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "ai_limit_close@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/keyBoard/Assets.xcassets/AI/ai_limit_close.imageset/ai_limit_close@2x.png b/keyBoard/Assets.xcassets/AI/ai_limit_close.imageset/ai_limit_close@2x.png new file mode 100644 index 0000000..e505a42 Binary files /dev/null and b/keyBoard/Assets.xcassets/AI/ai_limit_close.imageset/ai_limit_close@2x.png differ diff --git a/keyBoard/Assets.xcassets/AI/ai_limit_close.imageset/ai_limit_close@3x.png b/keyBoard/Assets.xcassets/AI/ai_limit_close.imageset/ai_limit_close@3x.png new file mode 100644 index 0000000..5c13d1c Binary files /dev/null and b/keyBoard/Assets.xcassets/AI/ai_limit_close.imageset/ai_limit_close@3x.png differ diff --git a/keyBoard/Assets.xcassets/AI/ai_limit_goto.imageset/Contents.json b/keyBoard/Assets.xcassets/AI/ai_limit_goto.imageset/Contents.json new file mode 100644 index 0000000..17c0922 --- /dev/null +++ b/keyBoard/Assets.xcassets/AI/ai_limit_goto.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ai_limit_goto@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "ai_limit_goto@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/keyBoard/Assets.xcassets/AI/ai_limit_goto.imageset/ai_limit_goto@2x.png b/keyBoard/Assets.xcassets/AI/ai_limit_goto.imageset/ai_limit_goto@2x.png new file mode 100644 index 0000000..79ad03d Binary files /dev/null and b/keyBoard/Assets.xcassets/AI/ai_limit_goto.imageset/ai_limit_goto@2x.png differ diff --git a/keyBoard/Assets.xcassets/AI/ai_limit_goto.imageset/ai_limit_goto@3x.png b/keyBoard/Assets.xcassets/AI/ai_limit_goto.imageset/ai_limit_goto@3x.png new file mode 100644 index 0000000..543a0ae Binary files /dev/null and b/keyBoard/Assets.xcassets/AI/ai_limit_goto.imageset/ai_limit_goto@3x.png differ diff --git a/keyBoard/Assets.xcassets/AI/ai_limit_icon.imageset/Contents.json b/keyBoard/Assets.xcassets/AI/ai_limit_icon.imageset/Contents.json new file mode 100644 index 0000000..9808298 --- /dev/null +++ b/keyBoard/Assets.xcassets/AI/ai_limit_icon.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ai_limit_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "ai_limit_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/keyBoard/Assets.xcassets/AI/ai_limit_icon.imageset/ai_limit_icon@2x.png b/keyBoard/Assets.xcassets/AI/ai_limit_icon.imageset/ai_limit_icon@2x.png new file mode 100644 index 0000000..fd51184 Binary files /dev/null and b/keyBoard/Assets.xcassets/AI/ai_limit_icon.imageset/ai_limit_icon@2x.png differ diff --git a/keyBoard/Assets.xcassets/AI/ai_limit_icon.imageset/ai_limit_icon@3x.png b/keyBoard/Assets.xcassets/AI/ai_limit_icon.imageset/ai_limit_icon@3x.png new file mode 100644 index 0000000..b8fcef6 Binary files /dev/null and b/keyBoard/Assets.xcassets/AI/ai_limit_icon.imageset/ai_limit_icon@3x.png differ diff --git a/keyBoard/Class/AiTalk/V/PopView/KBChatLimitPopView.m b/keyBoard/Class/AiTalk/V/PopView/KBChatLimitPopView.m index 1280283..eb89d58 100644 --- a/keyBoard/Class/AiTalk/V/PopView/KBChatLimitPopView.m +++ b/keyBoard/Class/AiTalk/V/PopView/KBChatLimitPopView.m @@ -8,21 +8,25 @@ #import "KBChatLimitPopView.h" #import +static CGFloat const kKBChatLimitIconSize = 252.0; +static CGFloat const kKBChatLimitGotoWidth = 251.0; +static CGFloat const kKBChatLimitGotoHeight = 53.0; +static CGFloat const kKBChatLimitCloseSize = 28.0; +static CGFloat const kKBChatLimitSpacing1 = 18.0; +static CGFloat const kKBChatLimitSpacing2 = 18.0; + @interface KBChatLimitPopView () -@property (nonatomic, strong) UILabel *titleLabel; +@property (nonatomic, strong) UIImageView *iconImageView; @property (nonatomic, strong) UILabel *messageLabel; -@property (nonatomic, strong) UIButton *cancelButton; -@property (nonatomic, strong) UIButton *rechargeButton; -@property (nonatomic, strong) UIView *buttonDivider; +@property (nonatomic, strong) UIButton *gotoButton; +@property (nonatomic, strong) UIButton *closeButton; @end @implementation KBChatLimitPopView - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { - self.backgroundColor = [UIColor whiteColor]; - self.layer.cornerRadius = 16.0; - self.layer.masksToBounds = YES; + self.backgroundColor = [UIColor clearColor]; [self setupUI]; } return self; @@ -31,51 +35,37 @@ #pragma mark - UI - (void)setupUI { - [self addSubview:self.titleLabel]; - [self addSubview:self.messageLabel]; - [self addSubview:self.buttonDivider]; - [self addSubview:self.cancelButton]; - [self addSubview:self.rechargeButton]; + [self addSubview:self.iconImageView]; + [self.iconImageView addSubview:self.messageLabel]; + [self addSubview:self.gotoButton]; + [self addSubview:self.closeButton]; - [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(self).offset(20); - make.left.equalTo(self).offset(20); - make.right.equalTo(self).offset(-20); - }]; - - [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(self.titleLabel.mas_bottom).offset(8); - make.left.equalTo(self).offset(20); - make.right.equalTo(self).offset(-20); - }]; - - [self.buttonDivider mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.equalTo(self); - make.height.mas_equalTo(1); - make.top.greaterThanOrEqualTo(self.messageLabel.mas_bottom).offset(16); - make.bottom.equalTo(self).offset(-48); - }]; - - [self.cancelButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.bottom.equalTo(self); - make.top.equalTo(self.buttonDivider.mas_bottom); - make.right.equalTo(self.mas_centerX); - }]; - - [self.rechargeButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.bottom.equalTo(self); - make.top.equalTo(self.buttonDivider.mas_bottom); - make.left.equalTo(self.mas_centerX); - }]; - - UIView *verticalLine = [[UIView alloc] init]; - verticalLine.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0]; - [self addSubview:verticalLine]; - [verticalLine mas_makeConstraints:^(MASConstraintMaker *make) { + [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self); make.centerX.equalTo(self); - make.top.equalTo(self.buttonDivider.mas_bottom); + make.width.height.mas_equalTo(kKBChatLimitIconSize); + }]; + + // 让文案落在图中留白区域(大致居中偏下) + [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) { +// make.centerX.equalTo(self.iconImageView); + make.centerY.equalTo(self.iconImageView).offset(10); + make.left.equalTo(self.iconImageView).offset(26); + make.right.equalTo(self.iconImageView).offset(-46); + }]; + + [self.gotoButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.iconImageView.mas_bottom).offset(kKBChatLimitSpacing1); + make.centerX.equalTo(self); + make.width.mas_equalTo(kKBChatLimitGotoWidth); + make.height.mas_equalTo(kKBChatLimitGotoHeight); + }]; + + [self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.gotoButton.mas_bottom).offset(kKBChatLimitSpacing2); + make.centerX.equalTo(self); + make.width.height.mas_equalTo(kKBChatLimitCloseSize); make.bottom.equalTo(self); - make.width.mas_equalTo(1); }]; } @@ -102,56 +92,46 @@ #pragma mark - Lazy -- (UILabel *)titleLabel { - if (!_titleLabel) { - _titleLabel = [[UILabel alloc] init]; - _titleLabel.text = KBLocalized(@"提示"); - _titleLabel.font = [UIFont boldSystemFontOfSize:18]; - _titleLabel.textColor = [UIColor blackColor]; - _titleLabel.textAlignment = NSTextAlignmentCenter; +- (UIImageView *)iconImageView { + if (!_iconImageView) { + _iconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ai_limit_icon"]]; + _iconImageView.contentMode = UIViewContentModeScaleAspectFit; + _iconImageView.userInteractionEnabled = YES; } - return _titleLabel; + return _iconImageView; } - (UILabel *)messageLabel { if (!_messageLabel) { _messageLabel = [[UILabel alloc] init]; - _messageLabel.font = [UIFont systemFontOfSize:14]; - _messageLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1.0]; + _messageLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; + _messageLabel.textColor = [UIColor colorWithWhite:0.18 alpha:1.0]; _messageLabel.textAlignment = NSTextAlignmentCenter; _messageLabel.numberOfLines = 0; } return _messageLabel; } -- (UIButton *)cancelButton { - if (!_cancelButton) { - _cancelButton = [UIButton buttonWithType:UIButtonTypeSystem]; - [_cancelButton setTitle:KBLocalized(@"取消") forState:UIControlStateNormal]; - _cancelButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]; - [_cancelButton setTitleColor:[UIColor colorWithWhite:0.2 alpha:1.0] forState:UIControlStateNormal]; - [_cancelButton addTarget:self action:@selector(onTapCancel) forControlEvents:UIControlEventTouchUpInside]; +- (UIButton *)gotoButton { + if (!_gotoButton) { + _gotoButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_gotoButton setBackgroundImage:[UIImage imageNamed:@"ai_limit_goto"] forState:UIControlStateNormal]; + [_gotoButton setTitle:KBLocalized(@"Go To Recharge") forState:UIControlStateNormal]; + [_gotoButton setTitleColor:[UIColor colorWithWhite:0.1 alpha:1.0] forState:UIControlStateNormal]; + _gotoButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold]; + [_gotoButton addTarget:self action:@selector(onTapRecharge) forControlEvents:UIControlEventTouchUpInside]; } - return _cancelButton; + return _gotoButton; } -- (UIButton *)rechargeButton { - if (!_rechargeButton) { - _rechargeButton = [UIButton buttonWithType:UIButtonTypeSystem]; - [_rechargeButton setTitle:KBLocalized(@"去充值") forState:UIControlStateNormal]; - _rechargeButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold]; - [_rechargeButton setTitleColor:[UIColor colorWithRed:0.28 green:0.45 blue:0.94 alpha:1.0] forState:UIControlStateNormal]; - [_rechargeButton addTarget:self action:@selector(onTapRecharge) forControlEvents:UIControlEventTouchUpInside]; +- (UIButton *)closeButton { + if (!_closeButton) { + _closeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_closeButton setImage:[UIImage imageNamed:@"ai_limit_close"] forState:UIControlStateNormal]; + [_closeButton addTarget:self action:@selector(onTapCancel) forControlEvents:UIControlEventTouchUpInside]; } - return _rechargeButton; -} - -- (UIView *)buttonDivider { - if (!_buttonDivider) { - _buttonDivider = [[UIView alloc] init]; - _buttonDivider.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0]; - } - return _buttonDivider; + return _closeButton; } @end + diff --git a/keyBoard/Class/AiTalk/VC/KBAIHomeVC.m b/keyBoard/Class/AiTalk/VC/KBAIHomeVC.m index bf44884..cfc4e55 100644 --- a/keyBoard/Class/AiTalk/VC/KBAIHomeVC.m +++ b/keyBoard/Class/AiTalk/VC/KBAIHomeVC.m @@ -14,7 +14,7 @@ #import "AiVM.h" #import "KBHUD.h" #import "KBChatLimitPopView.h" -#import "KBVipPay.h" +#import "KBPayMainVC.h" #import "KBUserSessionManager.h" #import "LSTPopView.h" #import "KBAIMessageVC.h" @@ -764,8 +764,9 @@ static NSString * const KBAISelectedPersonaIdKey = @"KBAISelectedPersonaId"; [self.chatLimitPopView dismiss]; } - CGFloat width = KB_SCREEN_WIDTH - 60; - KBChatLimitPopView *content = [[KBChatLimitPopView alloc] initWithFrame:CGRectMake(0, 0, width, 180)]; + CGFloat width = 252.0; + CGFloat height = 252.0 + 18.0 + 53.0 + 18.0 + 28.0; + KBChatLimitPopView *content = [[KBChatLimitPopView alloc] initWithFrame:CGRectMake(0, 0, width, height)]; content.message = message; content.delegate = self; @@ -841,7 +842,8 @@ static NSString * const KBAISelectedPersonaIdKey = @"KBAISelectedPersonaId"; [[KBUserSessionManager shared] goLoginVC]; return; } - KBVipPay *vc = [[KBVipPay alloc] init]; + KBPayMainVC *vc = [[KBPayMainVC alloc] init]; + vc.initialSelectedIndex = 1; // SVIP [KB_CURRENT_NAV pushViewController:vc animated:true]; } @@ -1051,8 +1053,21 @@ static NSString * const KBAISelectedPersonaIdKey = @"KBAISelectedPersonaId"; dispatch_async(dispatch_get_main_queue(), ^{ KBPersonaChatCell *cell = [strongSelf currentPersonaCell]; - + // 处理次数用尽(与聊天接口保持一致) if (error) { + NSInteger bizCode = [error.userInfo[@"code"] integerValue]; + NSString *messageError = error.localizedDescription; + if (bizCode == 50030) { + if (cell) { + [cell removeLoadingUserMessage]; + } + NSString *message = messageError ?: @""; + strongSelf.isVoiceProcessing = NO; + [strongSelf updateCollectionViewScrollState]; + [strongSelf showChatLimitPopWithMessage:message]; + return; + } + NSLog(@"[KBAIHomeVC] 语音转文字失败:%@", error.localizedDescription); [KBHUD showError:KBLocalized(@"语音转文字失败,请重试")]; if (cell) { diff --git a/keyBoard/Class/AiTalk/VC/KBAiMainVC.m b/keyBoard/Class/AiTalk/VC/KBAiMainVC.m index c126991..228bff0 100644 --- a/keyBoard/Class/AiTalk/VC/KBAiMainVC.m +++ b/keyBoard/Class/AiTalk/VC/KBAiMainVC.m @@ -15,7 +15,7 @@ #import "KBAiRecordButton.h" #import "KBHUD.h" #import "KBChatLimitPopView.h" -#import "KBVipPay.h" +#import "KBPayMainVC.h" #import "LSTPopView.h" #import "VoiceChatStreamingManager.h" #import "KBUserSessionManager.h" @@ -430,9 +430,10 @@ [self.limitPopView dismiss]; } - CGFloat width = KB_SCREEN_WIDTH - 60; + CGFloat width = 252.0; + CGFloat height = 252.0 + 18.0 + 53.0 + 18.0 + 28.0; KBChatLimitPopView *content = - [[KBChatLimitPopView alloc] initWithFrame:CGRectMake(0, 0, width, 180)]; + [[KBChatLimitPopView alloc] initWithFrame:CGRectMake(0, 0, width, height)]; content.message = message; content.delegate = self; @@ -461,7 +462,8 @@ [[KBUserSessionManager shared] goLoginVC]; return; } - KBVipPay *vc = [[KBVipPay alloc] init]; + KBPayMainVC *vc = [[KBPayMainVC alloc] init]; + vc.initialSelectedIndex = 1; // SVIP [KB_CURRENT_NAV pushViewController:vc animated:true]; } diff --git a/keyBoard/Class/Pay/VC/KBPayMainVC.h b/keyBoard/Class/Pay/VC/KBPayMainVC.h index 20ab5ba..37722cf 100644 --- a/keyBoard/Class/Pay/VC/KBPayMainVC.h +++ b/keyBoard/Class/Pay/VC/KBPayMainVC.h @@ -11,6 +11,12 @@ NS_ASSUME_NONNULL_BEGIN @interface KBPayMainVC : BaseViewController +/// 默认选中的会员类型: +/// - 0:VIP +/// - 1:SVIP +/// 默认 0 +@property (nonatomic, assign) NSInteger initialSelectedIndex; + @end NS_ASSUME_NONNULL_END diff --git a/keyBoard/Class/Pay/VC/KBPayMainVC.m b/keyBoard/Class/Pay/VC/KBPayMainVC.m index a7e696b..d23f70a 100644 --- a/keyBoard/Class/Pay/VC/KBPayMainVC.m +++ b/keyBoard/Class/Pay/VC/KBPayMainVC.m @@ -61,6 +61,7 @@ static const CGFloat JXheightForHeaderInSection = 39; self.view.backgroundColor = [UIColor whiteColor]; // self.navigationController.navigationBar.translucent = false; // self.edgesForExtendedLayout = UIRectEdgeNone; + NSInteger initialIndex = (self.initialSelectedIndex == 1) ? 1 : 0; self.imageNames = @[@"VIP_Normal_icon", @"SVIP_Normal_icon"]; NSArray *selectedImageNames = @[@"VIP_Selected_icon", @"SVIP_Selected_icon"]; @@ -84,6 +85,7 @@ static const CGFloat JXheightForHeaderInSection = 39; self.myCategoryView.imageInfoArray = self.imageNames; self.myCategoryView.selectedImageInfoArray = selectedImageNames; + self.myCategoryView.defaultSelectedIndex = initialIndex; self.myCategoryView.loadImageBlock = ^(UIImageView *imageView, id info) { NSString *imageName = info; imageView.image = [UIImage imageNamed:imageName]; @@ -101,6 +103,7 @@ static const CGFloat JXheightForHeaderInSection = 39; _pagerView = [self preferredPagingView]; + self.pagerView.defaultSelectedIndex = initialIndex; self.pagerView.mainTableView.gestureDelegate = self; [self.view addSubview:self.pagerView];