// // MyClubApplicationViewController.m // ChinaTheoryNetwork // // Created by 张毅成 on 2019/2/15. // Copyright © 2019 张毅成. All rights reserved. // #import "MyClubApplicationViewController.h" #import "ClubApplicationViewController.h" #import "MyClubApplicationTableViewCell.h" @interface MyClubApplicationViewController () @property (weak, nonatomic) IBOutlet UITableView *tableView; @end @implementation MyClubApplicationViewController - (void)viewDidLoad { [super viewDidLoad]; self.title = @"我的投稿"; [self setupRightButton]; [self createTableView]; } - (void)setupRightButton { UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeCustom]; rightButton.frame = CGRectMake(0, 0, 40, 40); [rightButton setTitleColor:kMainColor forState:(UIControlStateNormal)]; [rightButton.titleLabel setFont:[UIFont systemFontOfSize:15]]; [rightButton setTitle:@"投稿" forState:(UIControlStateNormal)]; UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton]; UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:(UIBarButtonSystemItemFixedSpace) target:nil action:nil]; item.width = -7; self.navigationItem.rightBarButtonItems = @[item,rightItem]; [rightButton addEventHandler:^(id sender) { ClubApplicationViewController *controller = [ClubApplicationViewController new]; [self.navigationController pushViewController:controller animated:true]; } forControlEvents:(UIControlEventTouchUpInside)]; } - (void)createTableView { self.tableView.delegate = self; self.tableView.dataSource = self; self.tableView.tableFooterView = [UIView new]; self.tableView.rowHeight = UITableViewAutomaticDimension; self.tableView.estimatedRowHeight = 60; self.tableView.separatorStyle = 0; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 10; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { MyClubApplicationTableViewCell *cell = [MyClubApplicationTableViewCell cellWithTableView:tableView]; return cell; } @end