SORU
23 HAZİRAN 2014, PAZARTESİ


İOS 8 UİActionSheet içinde UİPickerView çalışmıyor Ekle

UIActionsheet ios 7 çalışma perfectally için UIPickerView ekleme ama değil ios 8 çalışıyorum. Lütfen bana bunu çözmek için yardımcı olur.

İşte bunun için ekran görüntüsü ekledim*.8*

Teşekkürler

Bunun için aşağıdaki kodu kullanıyorum.

UIActionSheet *actionSheet;
NSString *pickerType;

- (void)createActionSheet {

    if (actionSheet == nil) {
        // setup actionsheet to contain the UIPicker
        actionSheet = [[UIActionSheet alloc] initWithTitle:@"Please select" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
        actionSheet.backgroundColor = [UIColor clearColor];

        UIToolbar *pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 40)];
        pickerToolbar.barStyle = UIBarStyleBlackOpaque;
        [pickerToolbar sizeToFit];

        UIImageView *imageObj = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 40)];
        imageObj.image = [UIImage imageNamed:@"header.png"];
        [pickerToolbar addSubview:imageObj];

        UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [cancelBtn addTarget:self action:@selector(pickerCancel:)forControlEvents:UIControlEventTouchDown];
        // [cancelBtn setImage:[UIImage imageNamed:@"btnInviteCancel.png"] forState:UIControlStateNormal];
        [cancelBtn setTitle:@"Cancel" forState:UIControlStateNormal];

        cancelBtn.frame = CGRectMake(7.0, 7.0, 65.0, 25.0);
        [pickerToolbar addSubview:cancelBtn];

        UIButton *doneBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [doneBtn addTarget:self action:@selector(pickerDone:)forControlEvents:UIControlEventTouchDown];
        //[doneBtn setImage:[UIImage imageNamed:@"btnInviteDone.png"] forState:UIControlStateNormal];
        [doneBtn setTitle:@"Done" forState:UIControlStateNormal];
        doneBtn.frame = CGRectMake(258.0, 7.0, 55.0, 25.0);
        [pickerToolbar addSubview:doneBtn];

        [actionSheet addSubview:pickerToolbar];
        [pickerToolbar release];


        UIPickerView *chPicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 200.0)];
        chPicker.dataSource = self;
        chPicker.delegate = self;
        chPicker.showsSelectionIndicator = YES;
        [chPicker selectRow:0 inComponent:0 animated:YES];
        [actionSheet addSubview:chPicker];
        [chPicker release];

        [actionSheet showInView:self.view];
        [actionSheet setBounds:CGRectMake(0,0,320, 464)];
    }
}

CEVAP
23 HAZİRAN 2014, PAZARTESİ


Elma UIActionSheet iç uygulama değiştiği için işe yaramıyor. Lütfen the documentation bakın:

Sınıflara Notlar

UİActionSheet alt etmek için tasarlanmış değildirne de onun hiyerarşi manzaralı eklemek gerekir. Eğer UİActionSheet API tarafından sağlanan daha fazla özelleştirme ile ilgili bir sayfa sunmak için ihtiyacınız varsa, kendi oluşturmak ve presentViewController:animasyon:tamamlanması ile mevcut bir yöntemdir.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • captainpuppys2000

    captainpuppy

    20 HAZİRAN 2013
  • Eric Magidson

    Eric Magidso

    4 Ocak 2009
  • Joseph Hayhoe

    Joseph Hayho

    20 Mayıs 2010