0

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

Larry Morries
  • 669
  • 7
  • 17
dead_soldier
  • 429
  • 1
  • 5
  • 18

1 Answers1

2

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:

@property (nonatomic, assign) id delegate;

// implementation
@synthesize delegate = _delegate;

// in your cell... method
[self.delegate presentPicker];

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

ACell *aCell = [ACell alloc] init];
aCell.delegate = self;
D.C.
  • 15,340
  • 19
  • 71
  • 102
  • @ darren presentPicker is the name of the pickercontroller?..if so then [self.delegate presentPicker] is not present in my custom cell..i have a button action in which i am writing this?is it okay..and the last piece of code,is it to be written in pickercontroller or main view controller where the custom cell is being allocated memory.. – dead_soldier Oct 18 '11 at 07:30