开发者

In iphone can i add one picker view on two text boxes /uilabel with diffrent values?

In my project i am filling the picker view array with the value which i am getting from the service.And in the same view i have another label on click of button in the label i want to get the same uipickerview with different value is that possible.....so wit开发者_如何学JAVAh one picker view my work will be done no need to call to different picker views...anyone has solution for this isssue


i dont think so .. it will only be possible if you load the data again which means the uipicker(all same instance) with loaded with same data


of course this is possible. Just switch to another model that holds the data that is used in the picker.

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
   if (myCurrentEditingValue == MyCountryValue) {
        return ...
   }
   else if (myCurrentEditingValue == MyCityValue) {
        return ...
   }
   return nil;
}

- (IBAction)startEditingCountryField {
    myCurrentEditingValue = MyCountryValue;
    [picker reloadAllComponents];
}

You should get the idea.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜