Code refactoring

This commit is contained in:
Roman Efimov
2013-04-04 17:31:49 -05:00
parent 726c19c9ff
commit 98f5fbafd6

View File

@@ -158,24 +158,13 @@
- (void)actionBar:(REActionBar *)actionBar navigationControlValueChanged:(UISegmentedControl *)navigationControl
{
if (navigationControl.selectedSegmentIndex == 0) {
NSIndexPath *indexPath = [self indexPathForPreviousResponder];
if (indexPath) {
RETableViewCell *cell = (RETableViewCell *)[self.parentTableView cellForRowAtIndexPath:indexPath];
if (!cell)
[self.parentTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];
cell = (RETableViewCell *)[self.parentTableView cellForRowAtIndexPath:indexPath];
[cell.responder becomeFirstResponder];
}
} else {
NSIndexPath *indexPath = [self indexPathForNextResponder];
if (indexPath) {
RETableViewCell *cell = (RETableViewCell *)[self.parentTableView cellForRowAtIndexPath:indexPath];
if (!cell)
[self.parentTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];
cell = (RETableViewCell *)[self.parentTableView cellForRowAtIndexPath:indexPath];
[cell.responder becomeFirstResponder];
}
NSIndexPath *indexPath = navigationControl.selectedSegmentIndex == 0 ? [self indexPathForPreviousResponder] : [self indexPathForNextResponder];
if (indexPath) {
RETableViewCell *cell = (RETableViewCell *)[self.parentTableView cellForRowAtIndexPath:indexPath];
if (!cell)
[self.parentTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];
cell = (RETableViewCell *)[self.parentTableView cellForRowAtIndexPath:indexPath];
[cell.responder becomeFirstResponder];
}
}