I'm a bit lost on how to pass my fetched managed object data through a didSelectRow UIPickerView action.
On the previous view, I passed the CalcInfo object like this:
CalcInfo *calc = (CalcInfo *)[_calcInfos objectAtIndex:indexPath.row];开发者_Python百科
self.myPageOneViewController.calcInfos = calc;
I was successfully able to use calcInfos.attribute for all my IBAction:(id)sender buttons, but the pickerView isn't able to fetch / use the data. The updateLabel action always has calcInfos.attribute as NULL. Here's a bit of my code
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
[self updateLabel];
}
- (void)updateLabel {
double stdrate = [calcInfos.infusionstd doubleValue];
double lowrate = [calcInfos.infusionlow doubleValue];
if (calcInfos.infusionlow == NULL) {
NSLog(@"It's null");
}
}
Your help is much appreciated!
The picker view is a subview with its own hardwired controller. It returns the row and column/component picked in its delegate message `didSelectRow:inComponent'.
You need to pass that info along to your updateLabel
method so that you can relate the pickerview selection to your managed objects. Right now, the method does nothing at all.
精彩评论