2013-04-23 50 views
1

嘗試從搜索結果推送到新視圖,並且出於某種原因代碼未被調用。對不起,我不能更具描述性。從SearchDisplayController推送到新視圖

下面的代碼:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 
[self.table deselectRowAtIndexPath:indexPath animated:YES]; 
int selectedTemplateID = [((CollectionItem*)[cllct objectAtIndex:indexPath.row]).tID intValue]; 

ACollection *newView = [[ACollection alloc] initWithID:selectedTemplateID]; 
newView.template = [cllct objectAtIndex:indexPath.row]; 

if(tableView == self.table) { 
    [self.navigationController pushViewController:newView animated:YES]; 
    newView.theTitle = [self.table cellForRowAtIndexPath:indexPath].textLabel.text; 
} 
if(tableView == self.searchDisplayController.searchResultsTableView) { 
    NSLog(@"Should push"); 
    [self.navigationController pushViewController:newView animated:YES]; 
    newView.theTitle = [self.table cellForRowAtIndexPath:indexPath].textLabel.text; 
    } 

} 

感謝

+0

你設置了你的TableVIewDelegate嗎? – 2013-04-23 11:00:41

+0

檢查與breake點這個方法調用或不/ /? – Balu 2013-04-23 11:02:49

+0

如果您的委託方法被調用,那麼您的應用程序導航爲基礎還是基於視圖? – 2013-04-23 11:03:23

回答

-1

首先檢查的tableview的數據源和delegat。 刪除[self.table deselectRowAtIndexPath:indexPath animated:YES];並檢查一次。