2016-07-04 6 views
-1

У меня есть табличное представление с динамическим числом клеток. И у меня проблемы с высотой стола. Столбец прокручивается, но он не доходит до последней ячейки, но может потребоваться сделать щелчок мышью по табуляции и прокручивать весь путь вниз, и когда я отпущу клик, он вернется.Как установить высоту таблицыView dynamic?

Вот как я реализую это

UIInterfaceOrientation newOrientation = [UIApplication sharedApplication].statusBarOrientation; 
if(newOrientation == UIInterfaceOrientationLandscapeLeft || newOrientation == UIInterfaceOrientationLandscapeRight) 
{ 

    _logoView = [[UIView alloc] initWithFrame:CGRectMake(0,0,self.view.bounds.size.width/2.3, self.view.bounds.size.height/3)]; 
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(self.view.bounds.size.width/2.3, 0, self.view.bounds.size.width - self.view.bounds.size.width/2.3, self.view.bounds.size.height + self.view.bounds.size.height)]; 


} 

else if (newOrientation == UIInterfaceOrientationPortrait || newOrientation == UIInterfaceOrientationPortraitUpsideDown) 
{ 

    _logoView = [[UIView alloc] initWithFrame:CGRectMake(0,0,self.view.bounds.size.width, self.view.bounds.size.height/4)]; 
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height/4, self.view.bounds.size.width, self.view.bounds.size.height)]; 
} 
imageView.frame = _logoView.bounds; 
[_logoView addSubview:imageView]; 


self.tableView.dataSource = self; 
self.tableView.delegate = self; 
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cells"]; 
[self.view addSubview:self.tableView]; 

И когда я добавить еще self.view.bounds.height на высоту Tableview в портрете TableView прибудет меньший формат

+0

Почему бы не использовать vfl (автоспуск)? – Joshua

+0

Что это? Кстати, я создаю табличное представление динамически – drbj

+0

визуальный формат форматирования автозапуска. (https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/VisualFormatLanguage.html) @drbj – Joshua

ответ

0

решаемого его. Виноват. Высота моего UITableView превышает. Снизилась его высота и теперь она работает нормально

Смежные вопросы