我有一个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:”是该类中的一个方法“
请帮帮我
答案 0 :(得分:0)
您没有展示epubViewController
。在loadSpine
方法调用后添加此行:
[self.navigationController pushViewController: epubViewController animated: YES];
此外,我会将hit
传递给epubViewController
并在loadSpine
内的viewDidLoad
或viewDidAppear
方法上致电epubViewController
。
答案 1 :(得分:0)
请使用此方法推送或显示视图控制器,并在-(void)viewDidLoad:
中使用此代码调用您要点击的方法 -
[self.navigationController pushViewController: epubViewController animated: YES];
viewDidLoad
中的将您的加载主题方法称为
[self loadSpine];
希望这会有所帮助