小编Aar*_*ron的帖子

UITableView contentInset 变化

我已经在方法中设置了 tableView 的 contentInset- (void)viewDidLoad并且属性是self.tableView.contentInset = UIEdgeInsetsMake(200, 0, 200, 0);tableView.contentInset 将自动更改为 : 。{64, 0, 0, 0} 为什么会发生这种情况,我该如何解决这个问题?

环境:XCode8.1 iOS10.1

    #import "YAVideoViewController.h"
static NSString * const ID = @"cell";
@interface YAVideoViewController ()

@end

@implementation YAVideoViewController

- (void)viewDidLoad {
    [super viewDidLoad];



    self.view.backgroundColor = [UIColor arcColor];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:ID];

    self.tableView.contentInset = UIEdgeInsetsMake(200, 0, 200, 0);
}



- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return 50;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID …
Run Code Online (Sandbox Code Playgroud)

uitableview ios

2
推荐指数
1
解决办法
5455
查看次数

标签 统计

ios ×1

uitableview ×1