MyClubApplicationViewController.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // MyClubApplicationViewController.m
  3. // ChinaTheoryNetwork
  4. //
  5. // Created by 张毅成 on 2019/2/15.
  6. // Copyright © 2019 张毅成. All rights reserved.
  7. //
  8. #import "MyClubApplicationViewController.h"
  9. #import "ClubApplicationViewController.h"
  10. #import "MyClubApplicationTableViewCell.h"
  11. @interface MyClubApplicationViewController ()<UITableViewDelegate, UITableViewDataSource>
  12. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  13. @end
  14. @implementation MyClubApplicationViewController
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. self.title = @"我的投稿";
  18. [self setupRightButton];
  19. [self createTableView];
  20. }
  21. - (void)setupRightButton {
  22. UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
  23. rightButton.frame = CGRectMake(0, 0, 40, 40);
  24. [rightButton setTitleColor:kMainColor forState:(UIControlStateNormal)];
  25. [rightButton.titleLabel setFont:[UIFont systemFontOfSize:15]];
  26. [rightButton setTitle:@"投稿" forState:(UIControlStateNormal)];
  27. UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton];
  28. UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:(UIBarButtonSystemItemFixedSpace) target:nil action:nil];
  29. item.width = -7;
  30. self.navigationItem.rightBarButtonItems = @[item,rightItem];
  31. [rightButton addEventHandler:^(id sender) {
  32. ClubApplicationViewController *controller = [ClubApplicationViewController new];
  33. [self.navigationController pushViewController:controller animated:true];
  34. } forControlEvents:(UIControlEventTouchUpInside)];
  35. }
  36. - (void)createTableView {
  37. self.tableView.delegate = self;
  38. self.tableView.dataSource = self;
  39. self.tableView.tableFooterView = [UIView new];
  40. self.tableView.rowHeight = UITableViewAutomaticDimension;
  41. self.tableView.estimatedRowHeight = 60;
  42. self.tableView.separatorStyle = 0;
  43. }
  44. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  45. return 10;
  46. }
  47. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  48. MyClubApplicationTableViewCell *cell = [MyClubApplicationTableViewCell cellWithTableView:tableView];
  49. return cell;
  50. }
  51. @end