#import "ViewController.h"
#import "IQKeyboardManager/IQKeyboardManager.h"
#import "sbTableViewCell.h"
@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(strong,nonatomic)UITableView * tableView;
@end
@implementation ViewController
-(UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) style:0];
_tableView.delegate = self;
_tableView.dataSource = self;
[_tableView registerNib:[UINib nibWithNibName:@"sbTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"sbTableViewCell"];
}
return _tableView;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 50;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
sbTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"sbTableViewCell"];
return cell;
}
- (void)viewDidLoad {
[super viewDidLoad];
[IQKeyboardManager sharedManager].enable = YES;
[self.view addSubview:self.tableView];
}
@end

屏幕快照 2019-07-18 上午11.19.58.png
网友评论