Iphone 从customcell转到viewController

Iphone 从customcell转到viewController,iphone,ios,custom-cell,uipickerviewcontroller,Iphone,Ios,Custom Cell,Uipickerviewcontroller,我有一个加载自定义单元格的tableview。自定义单元格有一个按钮,点击该按钮将打开一个pickerview,其中将有选项可供选择 问题是modalViewController方法不起作用,它给出了以下错误 Selector *sel = [[Selector alloc]initWithNibName:@"Selector" bundle:nil]; [self PresentModalViewController:sel animated:YES]; error:property pres

我有一个加载自定义单元格的tableview。自定义单元格有一个按钮,点击该按钮将打开一个pickerview,其中将有选项可供选择

问题是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如何从自定义单元格调用其他视图

首先,将您的类命名为“选择器”是一个非常令人困惑的想法。您应该使用更具描述性的内容,以及尚未成为obj-c关键字的内容

至于您的问题,我认为您应该使用委托从您的单元格视图获取对控制器的引用。在自定义单元视图类中,执行以下操作:

@property (nonatomic, assign) id delegate;

// implementation
@synthesize delegate = _delegate;

// in your cell... method
[self.delegate presentPicker];
在这里,委托ivar将指向您的视图控制器。要设置它,请找到您分配单元格的位置,然后

ACell *aCell = [ACell alloc] init];
aCell.delegate = self;

@darren presentPicker是pickercontroller的名称?。如果是这样,那么我的自定义单元格中不存在[self.delegate presentPicker]。我有一个按钮操作,我在其中编写它?可以吗。最后一段代码,是在pickercontroller还是在分配自定义单元格内存的主视图控制器中编写的。。