从customcell转到viewController
我有一个加载自定义单元格的表格视图。自定义单元格有一个按钮,单击该按钮将打开一个选择器视图,其中有可供选择的选项。
问题是 modalViewController 方法不起作用,它给出以下错误。
Selector *sel = [[Selector alloc]initWithNibName:@"Selector" bundle:nil];
[self PresentModalViewController:sel animated:YES];
error:property presentModalViewController not found on object of type CustomCell *...and selector is the pickerview controller class...the method is written in ibaction function in customcell.m file
v 如何从自定义单元格调用其他视图?
谢谢
i am having a tableview in which custom cells are loaded.Custom cell has a button on click of which a pickerview will open which will have options to choose from.
The problem is that modalViewController method is not working, it is giving the following error.
Selector *sel = [[Selector alloc]initWithNibName:@"Selector" bundle:nil];
[self PresentModalViewController:sel animated:YES];
error:property presentModalViewController not found on object of type CustomCell *...and selector is the pickerview controller class...the method is written in ibaction function in customcell.m file
How can v call other view from custom cell?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,将你的类命名为“Selector”是一个非常令人困惑的想法。您应该使用更具描述性的内容,并且还不是 obj-c 关键字。
至于你的问题,我认为你应该使用委托来获取从单元视图到控制器的引用。在您的自定义单元视图类中,执行以下操作:
在这里,委托 ivar 将指向您的视图控制器。要进行设置,请找到分配单元的位置,然后执行
First, naming your class "Selector" is a horribly confusing idea. You should use something more descriptive, and something that is not already an obj-c keyword.
As for your problem, I think you should use a delegate to get a reference from your cell view to the controller. In your custom cell view class, do something like:
Here, the delegate ivar would point back to your view controller. To set that up, find the place where you alloc your cell, and do