UIPickerView(FlipsideViewController)在MainViewController中显示值

时间:2011-10-27 09:20:35

标签: objective-c uipickerview selectedvalue

在我的MainViewController类中使用flipsideViewControllerDidFinish方法,我可以显示我的子视图FlipsideViewController上的各种控件的值。例如通过执行以下操作来执行UIDatePicker:

NSDateFormatter *formatFromDate = [[NSDateFormatter alloc] init];
[formatFromDate setDateFormat:@"yyyy-MM-dd"];

NSDateFormatter *formatToDate = [[NSDateFormatter alloc] init];
[formatToDate setDateFormat:@"yyyy-MM-dd"];

NSString *fromDateSelected = [NSString stringWithFormat:@"%@",[formatFromDate stringFromDate:controller.fromDate.date]];
NSString *toDateSelected = [NSString stringWithFormat:@"%@",[formatToDate stringFromDate:controller.toDate.date]];

lblFromDate.text = fromDateSelected;
lblToDate.text = toDateSelected;

我试图获取UIPickerView的值以显示在MainViewController上。我可以使用以下事件方法在FlipsideViewController上显示值:

- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {

    customDateSelected = [customDates objectAtIndex:row];
    NSLog(@"Selected Date: %@. Index of selected Date: %i", customDateSelected, row);
}

只是不知道如何在MainViewController中显示该值。

0 个答案:

没有答案