0

开始开发以匹配IOS 7,但我对UIPickerView's奇怪的行为一无所知IOS 7 (Only in IOS7)正如他们在这里指定的那样, 我也面临一个问题。当我单击 pickerView 时,键盘正在打开。我不能辞职。

我尝试了以下所有事情

[sender resignFirstResponder];
[self dismissKeyboard];
[self.view endEditing:YES];

我的代码:

- (IBAction)selectCountry:(UIControl *)sender {

    UITextField *txtfld = (UITextField*)sender;
    NSLog(@"selectCountry Picker Called:%d ",txtfld.tag);

    [self dismissKeyboard];
    [self.view endEditing:YES];

    [sender resignFirstResponder];

        ActionStringDoneBlock done = ^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
            if ([billingCountry respondsToSelector:@selector(setText:)]) {
                [billingCountry performSelector:@selector(setText:) withObject:selectedValue];
                selectedBillingCountry = selectedValue;

                        }

            [self resetShippingServicesControl];
            [self resetProvinceState];
            [self loadViewAsperCountry];
                               };


        ActionStringCancelBlock cancel = ^(ActionSheetStringPicker *picker) {
            NSLog(@"selectCountry Picker Cancelled");
            [self dismissKeyboard];
            [self.view endEditing:YES];
            [sender resignFirstResponder];
        };
        NSArray *countryA = [NSArray arrayWithArray:[self getCountryList]];
        [ActionSheetStringPicker showPickerWithTitle:@"Select Country" rows:countryA initialSelection:0 doneBlock:done cancelBlock:cancel origin:sender];


}

但是,它的 :( 。请帮我找出解决方案。我需要为IOS7用户重新设计吗?提前感谢 Geeks。

4

1 回答 1

0

你的问题似乎是关于UIActionSheet,而不是UIPickerView

如其文档UIActionSheet中所述,您不应将子视图添加到 a

UIActionSheet 不是为子类而设计的,也不应该将视图添加到它的层次结构中。如果您需要呈现比 UIActionSheet API 提供的自定义更多的表单,您可以创建自己的表单并使用 presentViewController:animated:completion: 以模态方式呈现它。

于 2013-09-23T12:27:59.467 回答