前言
BaseViewController应该做哪些事情呢?
//左右导航按钮回调
typedef void(^PassAction)(UIButton *button);
//刷新按钮回调
typedef void(^RefreshAction)();
//传值回调
typedef void(^PassStr)(NSString *);
@interface FDBaseViewController : UIViewController
@property (copy, nonatomic) PassAction leftItemAction;
@property (copy, nonatomic) PassAction rightItemAction;
@property (copy, nonatomic) RefreshAction refreshAction;
@property (copy, nonatomic) PassStr passStr;
- (void)setNavigationBarTitle:(NSString *)title;
/**
* 设置navigation背景透明
*/
- (void)setNavigationBackGroudDiaphanous;
/**
* 设置navigation背景不透明
*/
- (void)setNavigationBackGroudOpaque;
#pragma mark ===== leftBarButton
/**
* 设置navigation左按钮(图片)
*
* @param image normal图片
* @param highImage 高亮图片
*/
- (void)setNavigationBarLeftItemimage:(NSString *)image highImage:(NSString *)highImage;
/**
* 设置navigation左按钮(文字)
*
* @param title 按钮文字
*/
- (void)setNavigationBarLeftItemButttonTitle:(NSString *)title;
/**
* 设置navigation左按钮(图片 + 文字)
*
* @param title 文字
* @param image 图片
*/
- (void)setNavigationBarLeftItemButtonTitle:(NSString *)title image:(NSString *)image;
#pragma mark ===== rightBarButton
/**
* 设置navigation右按钮
*
* @param image 正常图片
* @param highImage 高亮图片
*/
- (void)setNavigationBarRightItemimage:(NSString *)image highImage:(NSString *)highImage;
/**
* 设置navigation右按钮(文字)
*
* @param title 按钮文字
*/
- (void)setNavigationBarRightItemButttonTitle:(NSString *)title;
/**
* 设置navigation右按钮(图片 + 文字)
*
* @param title 文字
* @param image 图片
*/
- (void)setNavigationBarRightItemButtonTitle:(NSString *)title image:(NSString *)image;
BaseTableViewController应该做哪些事情呢?
- (void)loadView
{
[super loadView];
self.baseTableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStyleGrouped];
self.view = self.baseTableView;
}
- (void)dealloc
{
self.baseTableView.emptyDataSetSource = nil;
self.baseTableView.emptyDataSetDelegate = nil;
self.baseTableView.delegate = nil;
self.baseTableView.dataSource = nil;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.baseTableView.delegate = self;
self.baseTableView.dataSource = self;
self.baseTableView.emptyDataSetSource = self;
self.baseTableView.emptyDataSetDelegate = self;
//自适应
self.baseTableView.estimatedRowHeight = 1000;
self.baseTableView.rowHeight = UITableViewAutomaticDimension;
[self.baseTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
//公共方法----配置统一的样式
- (void)confignBaseTableView
{
self.baseTableView.sectionFooterHeight = 0;
self.baseTableView.sectionHeaderHeight = 20;
self.baseTableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, SCREEN_WIDTH, 20.01f)];
}