SwitchViewController类中有一个方法
-(IBAction)switchDetailViews:(id)sender
{
}
想实现点击tableview一行,显示一个view,-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
SwitchViewController *switchViewController=[[SwitchViewController alloc] init];
[switchViewController switchViews];
[switchViewController release];
}但是显示不了。在界面的按钮直接连线到switchViews这个方法就可以执行
-(IBAction)switchDetailViews:(id)sender
{
}
想实现点击tableview一行,显示一个view,-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
SwitchViewController *switchViewController=[[SwitchViewController alloc] init];
[switchViewController switchViews];
[switchViewController release];
}但是显示不了。在界面的按钮直接连线到switchViews这个方法就可以执行
点击一行肯定会触发
-(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];
这样点击行的时候会有一个view遮住tableview
你把那个View换一下就是啊。
到http://www.cocoachina.com/
搜 UItableview 看看有没有你想要的例子⋯⋯
不信你可以加断点看看。
[switchViewController switchViews];
你用这个方法返回一个View
然后再用 addsubview 加载一下试试
⋯⋯⋯⋯
我给你的代码是跟你说,肯定能执行,但是没有正确的加载view。你没有理解
所以我感觉不可能加载上你定义的View
那上边有很多例子,虽然也有很多翻译错误,总体说来还是不错的。
照着书练练手还是不错的~
全书的代码在这里⋯⋯