方法是不是从UITableview调用?

时间:2013-05-14 13:11:41

标签: ios objective-c uitableview methods uiviewcontroller

我有一个UITableView并且在didSelect方法中我正在使用参数调用另一个类的方法,当我单击该行时,我想用相应的参数打开该类xib。但是当我点击UITableView行时没有发生任何事情,实际上方法正在调用,但新的xib没有打开。

关注didSelect方法`

中的代码
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    SearchResult* hit = (SearchResult*)[results objectAtIndex:[indexPath row]];

    [epubViewController loadSpine:hit.chapterIndex atPageIndex:hit.pageIndex highlightSearchResult:hit];
}

`

epubViewController是第二个类的对象,“loadSpine:atPageIndex:highlightSearchResult:”是该类中的一个方法“

请帮帮我

2 个答案:

答案 0 :(得分:0)

您没有展示epubViewController。在loadSpine方法调用后添加此行:

[self.navigationController pushViewController: epubViewController animated: YES];

此外,我会将hit传递给epubViewController并在loadSpine内的viewDidLoadviewDidAppear方法上致电epubViewController

答案 1 :(得分:0)

请使用此方法推送或显示视图控制器,并在-(void)viewDidLoad:中使用此代码调用您要点击的方法 -

[self.navigationController pushViewController: epubViewController animated: YES];
viewDidLoad中的

将您的加载主题方法称为

[self loadSpine];

希望这会有所帮助