SwitchViewController类中有一个方法
-(IBAction)switchDetailViews:(id)sender
{
}
想实现点击tableview一行,显示一个view,
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
SwitchViewController *switchViewController=[[SwitchViewController alloc] init];
[switchViewController switchViews];
[switchViewController release];
}
但是显示不了。在界面的按钮直接连线到switchViews这个方法就可以执行
------解决方案--------------------
显示不了,我猜是因为当前加载的View是tableView,需要翻页或者覆盖这个tableView。
点击一行肯定会触发
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
在这里试一下
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
v.backgroundColor = [UIColor purpleColor];
[self.view addSubview:v];