MTMsgHomePageViewController.m 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. //
  2. // MTMsgHomePageViewController.m
  3. // Jianbinglian
  4. //
  5. // Created by Simon on 2021/2/20.
  6. // Copyright © 2021 Simon. All rights reserved.
  7. //
  8. #import "MTMsgHomePageViewController.h"
  9. #import "MTMsgListViewController.h"
  10. @interface MTMsgHomePageViewController ()
  11. @end
  12. @implementation MTMsgHomePageViewController
  13. - (NSArray<NSString *> *)titles {
  14. return @[@"全部",@"好友",@"群聊"];
  15. }
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. // Do any additional setup after loading the view.
  19. [self.navgationView setLeftBtn:nil];
  20. }
  21. - (instancetype)init
  22. {
  23. self = [super init];
  24. if (self) {
  25. self.menuViewStyle = WMMenuViewStyleLine;
  26. self.menuViewLayoutMode = WMMenuViewLayoutModeLeft;
  27. self.titleSizeSelected = kNumFrom375(16);
  28. self.titleSizeNormal = kNumFrom375(14);
  29. self.menuBGColor = HColor(@"#F9FBFA");
  30. self.titleColorNormal = HColor(@"#666E6B");
  31. self.titleColorSelected = HColor(@"#333B38");
  32. self.progressColor = MainColor;
  33. self.menuHeight = kNumFrom375(41);
  34. self.menuItemWidth = kNumFrom375(45);
  35. self.progressWidth = kNumFrom375(14);
  36. self.showOnNavigationBar = NO;
  37. self.viewFrame = CGRectMake(0, navHeight, ScreenWidth, ScreenHeight-navHeight);
  38. }
  39. return self;
  40. }
  41. #pragma mark WMPageController DataSource
  42. - (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
  43. return self.titles.count;
  44. }
  45. - (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
  46. return self.titles[index];
  47. }
  48. - (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
  49. MTMsgListViewController *vc = [[MTMsgListViewController alloc]init];
  50. return vc;
  51. }
  52. - (CGRect)pageController:(WMPageController *)pageController preferredFrameForMenuView:(WMMenuView *)menuView {
  53. CGFloat leftMargin = self.showOnNavigationBar ? 50 : 0;
  54. CGFloat originY = self.showOnNavigationBar ? 0 : CGRectGetMaxY(self.navigationController.navigationBar.frame);
  55. return CGRectMake(leftMargin, originY, self.view.frame.size.width - 2*leftMargin, 44);
  56. }
  57. - (CGRect)pageController:(WMPageController *)pageController preferredFrameForContentView:(WMScrollView *)contentView {
  58. CGFloat originY = CGRectGetMaxY([self pageController:pageController preferredFrameForMenuView:self.menuView]);
  59. return CGRectMake(0, originY, self.view.frame.size.width, self.view.frame.size.height - originY);
  60. }
  61. @end