В моем стеке навигации есть 2 вида View1
и View2
.View1
является tableView
.Итак, что я пытаюсь сделать, это deselectRow when I come back from
View2 to
View1`.Это прекрасно работает, если просто сделать так:
- (void)viewWillAppear:(BOOL)animated {
NSIndexPath *myIP = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView deselectRowAtIndexPath:myIP animated:NO];
}
Но мне также нужно перезагрузить эту строку.Но если вызвать reload
, deselect
не работает:
- (void)viewWillAppear:(BOOL)animated {
self.navigationController.navigationBarHidden = NO;
NSIndexPath *myIP = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView deselectRowAtIndexPath:myIP animated:NO];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:myIP] withRowAnimation:UITableViewRowAnimationNone];
}
Я также попытался select
строка и deselect
это, это работает, но проблема в том, что я открываю View1 вв первый раз или из другого вида я вижу отмену выбора анимации
- (void)viewWillAppear:(BOOL)animated {
self.navigationController.navigationBarHidden = NO;
NSIndexPath *myIP = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:myIP] withRowAnimation:UITableViewRowAnimationNone];
[self.tableView selectRowAtIndexPath:myIP animated:NO scrollPosition:UITableViewScrollPositionNone];
[self.tableView deselectRowAtIndexPath:myIP animated:NO];
}
Есть предложения?Заранее спасибо ...