// // MTMsgHomePageViewController.m // Jianbinglian // // Created by Simon on 2021/2/20. // Copyright © 2021 Simon. All rights reserved. // #import "MTMsgHomePageViewController.h" #import "MTMsgListViewController.h" @interface MTMsgHomePageViewController () @end @implementation MTMsgHomePageViewController - (NSArray *)titles { return @[@"全部",@"好友",@"群聊"]; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self.navgationView setLeftBtn:nil]; } - (instancetype)init { self = [super init]; if (self) { self.menuViewStyle = WMMenuViewStyleLine; self.menuViewLayoutMode = WMMenuViewLayoutModeLeft; self.titleSizeSelected = kNumFrom375(16); self.titleSizeNormal = kNumFrom375(14); self.menuBGColor = HColor(@"#F9FBFA"); self.titleColorNormal = HColor(@"#666E6B"); self.titleColorSelected = HColor(@"#333B38"); self.progressColor = MainColor; self.menuHeight = kNumFrom375(41); self.menuItemWidth = kNumFrom375(45); self.progressWidth = kNumFrom375(14); self.showOnNavigationBar = NO; self.viewFrame = CGRectMake(0, navHeight, ScreenWidth, ScreenHeight-navHeight); } return self; } #pragma mark WMPageController DataSource - (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController { return self.titles.count; } - (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index { return self.titles[index]; } - (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index { MTMsgListViewController *vc = [[MTMsgListViewController alloc]init]; return vc; } - (CGRect)pageController:(WMPageController *)pageController preferredFrameForMenuView:(WMMenuView *)menuView { CGFloat leftMargin = self.showOnNavigationBar ? 50 : 0; CGFloat originY = self.showOnNavigationBar ? 0 : CGRectGetMaxY(self.navigationController.navigationBar.frame); return CGRectMake(leftMargin, originY, self.view.frame.size.width - 2*leftMargin, 44); } - (CGRect)pageController:(WMPageController *)pageController preferredFrameForContentView:(WMScrollView *)contentView { CGFloat originY = CGRectGetMaxY([self pageController:pageController preferredFrameForMenuView:self.menuView]); return CGRectMake(0, originY, self.view.frame.size.width, self.view.frame.size.height - originY); } @end