سؤال

أحاول الحصول على شريحة Uipickerview من أسفل الشاشة (فوق الجزء العلوي من شريط علامة التبويب) ولكن لا يمكن أن يحصل عليها. يأتي الرمز الفعلي للرسوم المتحركة من أحد مشاريع رمز مثال Apple (DateCell). أنا أتصل بهذا الرمز من وحدة تحكم العرض الأولى (FirstViewController.M) ضمن وحدة التحكم في شريط Tab.

- (IBAction)showModePicker:(id)sender {
if (self.modePicker.superview == nil) {
    [self.view.window addSubview:self.modePicker];

    // size up the picker view to our screen and compute the start/end frame origin for our slide up animation
    //
    // compute the start frame
    CGRect screenRect = [[UIScreen mainScreen] applicationFrame];
    CGSize pickerSize = [self.modePicker sizeThatFits:CGSizeZero];
    CGRect startRect = CGRectMake(0.0, screenRect.origin.y + screenRect.size.height, pickerSize.width, pickerSize.height);
    self.modePicker.frame = startRect;

    // compute the end frame
    CGRect pickerRect = CGRectMake(0.0, screenRect.origin.y + screenRect.size.height - pickerSize.height, pickerSize.width, pickerSize.height);

    // start the slide up animation
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];

    // we need to perform some post operations after the animation is complete
    [UIView setAnimationDelegate:self];

    self.modePicker.frame = pickerRect;

    // shrink the vertical size to make room for the picker
    CGRect newFrame = self.view.frame;
    newFrame.size.height -= self.modePicker.frame.size.height;
    self.view.frame = newFrame;
    [UIView commitAnimations];

    // add the "Done" button to the nav bar
    self.navigationItem.rightBarButtonItem = self.doneButton;
}}

عندما يطلق هذا الإجراء عن طريق uibarbuttonitem الذي يعيش في uinavigationbar (وهو كل شيء تحت FirstViewController) لا يحدث شيء. هل يمكن لأي شخص تقديم بعض النصائح؟

هل كانت مفيدة؟

المحلول

تبين أنني قد فاتني الحقيقة المهمة للغاية التي تم تحديدها في Uipickerview في Builder Interface أيضًا ... بعد القيام بذلك وتوصيل المخرج الذي يعمل كل شيء!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top