更新到Xcode 5.1.1改变了我的表视图行为

时间:2014-04-28 08:42:27

标签: ios xcode uitableview uiscrollview

我在Xcode 4.6中工作并设置了基本的UItableview,其中单元格是从数组中填充的。在4.6中工作时,视图表现得非常完美,就像我喜欢它一样。更新到5.1.1后,似乎已在表视图上启用滚动,表视图从视图底部加载,顶部的3个填充单元格不可见。有时视图会橡皮筋而不允许我一直向上滚动到顶部,有时它会赢得橡皮筋并且会让我。我对此很陌生,但是我一直试图搞乱汽车布局,但无济于事。

- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
    // Custom initialization
}
return self;
}

- (void)viewDidLoad
{
[super viewDidLoad];


_Manufacturers = @[@"1",
                   @"2",
                   @"3"];

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return _Manufacturers.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath       *)indexPath
{
static NSString *CellIdentifier = @"TableCell";
TableCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

// Configure the cell...

int row = [indexPath row];

cell.TitleLabel.text = _Manufacturers[row];


return cell;
}

1 个答案:

答案 0 :(得分:0)

在Xcode 4.6中工作的UITableView代码应该在Xcode 5.1.1中完美运行。我观察到的主要变化是表格在状态栏下移动。这可以通过以下代码段修复:

self.edgesForExtendedLayout=UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars=NO;
self.automaticallyAdjustsScrollViewInsets=NO;

然而,提供代码,以便我可以了解正在进行的操作。