views:

31

answers:

1

I have a uipickerview, which appears with an ActionSheet. All this is in a class "MultiPicker". I create a new instance from "FirstViewController" this way:

multiPicker *multiPic = [[multiPicker alloc]init];
multiPic.delegate = self;

[multiPic action:aRunIndex];

And inside "multiPicker", in "action:"

    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:title          delegate:otroDelegate cancelButtonTitle:nil destructiveButtonTitle:@"Cancel" otherButtonTitles:@"Done", nil];

 UIPickerView *pickerView = [[[UIPickerView alloc] init] autorelease];
 pickerView.tag = 101;
 pickerView.delegate = self;
 pickerView.dataSource = self;
 pickerView.showsSelectionIndicator = YES;

 [actionSheet addSubview:pickerView];
 [actionSheet showInView:self.view];

I need "FirstViewController" when MultiPicker finishes, so I can update a table in FirstView. I tried setting a new delegate to MultiPicker so, it tells FirstView when it finishes. But the instruction "multipic.delegate = self" in the first piece of code mades the app crash and says "Terminating due to uncaught exception".

If I simply put all "MultiPicker" code inside FirstViewController class, not in a separate one, the action sheet stay blocked when I try to push a button different from "Cancel"

Any idea?

Thank u

A: 
  1. be sure that your class 'self' implement the require protocol
  2. protocols have optional and required methods you must implement all required methods of delegate 'protocol' in you class 'self'
m. h. ameen