如何将每个UITableViewCell与另一个视图链接 [英] How to link each UITableViewCell with another view
问题描述
我是iOS编程的新手,我想做一件简单的事情。我看到了几个有关我的问题的主题,但是我不明白为什么我的代码不起作用...
I'm new in iOS programming, and I want to do a simple thing. I saw several topics about my problem, but I don't understand why my code doesn't work...
- 我创建了一个空白视图称为 details.xib
- 我创建了一个Objective-C类,因此我有两个空文件 details.h 和 details.m
- 在我的主视图 ViewController.xib 中,我有一个tableView
- 在 ViewController.m 中,我在顶部添加:
#import details.h
-
在 ViewController.m 中,我修改了 didSelectRowAtIndexPath 方法,如下所示:
- I created an empty view called details.xib
- I created an objective-C class, so I have two empty files details.h and details.m
- In my main view called ViewController.xib, I have a tableView
- In ViewController.m, I added on the top :
#import "details.h"
In ViewController.m, I modified the didSelectRowAtIndexPath method like this :
details *det = [[details alloc] init];
[self.navigationController pushViewController:det animated:YES];
我获得了这个广告:不兼容指针类型发送'details * __ strong'到类型'UIViewController *'的参数
对不起,如果我的英语很尴尬,我是法语...谢谢
Sorry if my english is awkward, I'm french... Thanks for your help !
推荐答案
检查您是否在文件所有者中将details.xib根植于类中。
Check whether you are rooted the details.xib with class properly in file owner.
请参考这张图片:
并确保您的Details view controller是UIViewController的子类,否则请创建一个View Controller作为UIViewController子类(在创建视图控制器本身时,您可以选择。请参见下图)
And make sure you Details view controller is a sub class of UIViewController if not, create a view controller as UIViewController sub class(While creating a view controller itself u will can choose. refer below image)
这篇关于如何将每个UITableViewCell与另一个视图链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!