我使用以下代码在UIAlertView中创建了一个UIPickerView:
alert1 = [[UIAlertView alloc] initWithFrame:CGRectMake(0, 0, 300, 200)];
alert1.title = @"All Notes";
alert1.message = @"\n\n\n\n\n\n\n";
alert1.delegate = self;
[alert1 addButtonWithTitle:@"Cancel"];
myPickerView = [[UIPickerView alloc] initWithFrame:CGRectZero];
myPickerView.tag = TAG_PICKER0;
myPickerView.delegate = self;
myPickerView.showsSelectionIndicator = YES;
myPickerView.autoresizingMask = UIAlertViewStyleDefault;
myPickerView.frame = CGRectMake(10, 40, 265, 150);
[alert1 addSubview:myPickerView];
[alert1 show];
我想在按下按钮时重新加载此pickerView,在按钮操作中我向拾取器中出现的数组添加了一个新元素,我也添加了这一行
[self.myPickerView reloadAllComponents];
self.myPickerView.delegate=self;
但此时新元素不会出现在选择器中,当我重新打开应用程序时会出现
我怎样才能解决这个问题,使新元素在添加时出现在pickerView中?