Welcome, Guest
Username Password: Remember me

contentOffset after popping detail view
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: contentOffset after popping detail view

contentOffset after popping detail view 1 year, 7 months ago #1

Hey there,

I have a UITableViewController subclass to which I add a SCTableViewModel.
Then I add a UISearchBar to the tableHeaderView of the table model's modeled table view:
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
self.tableModel.modeledTableView.tableHeaderView = searchBar;


To hide the search bar by default I set a content offset in viewWillAppear:
- (void)viewWillAppear:(BOOL)animated {
 
[super viewWillAppear:animated];
 
self.tableModel.modeledTableView.contentOffset = CGPointMake(0,44);
}


This works fine.
But when I tap on a cell to show the detail view table and pop this view (= go back to the root table view) the search bar appears. I guess that's because the tableview is being reloaded by STV.

Is there any chance to set this content offset again after the table has been reloaded. (In case I'm right with my reloading theory.) Maybe a delegate?

Thanks,
Patrick
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3
Last Edit: 1 year, 7 months ago by Patrick.

Re: contentOffset after popping detail view 1 year, 7 months ago #2

You're right Patrick. I think we should probably add two BOOL properties to SCTableViewModel: hideHeaderView and hideFooterView.

As for now, hiding the search bar in tableViewModel:willConfigureCell should do the trick.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: contentOffset after popping detail view 1 year, 7 months ago #3

Thank you, Tarek.
  • Patrick
  • OFFLINE
  • Senior Boarder
  • Posts: 49
  • Karma: 3
  • Page:
  • 1
Time to create page: 2.25 seconds