IQKeyboardManager 解决解盘遮挡问题

2019-07-18  本文已影响0人  寂寞先森666
#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
上一篇 下一篇

猜你喜欢

热点阅读