UIPopoverPresentationController对象不会在委托方法中取消分配

时间:2015-10-02 06:56:13

标签: ios objective-c delegates uipopovercontroller

我有一个text field(cInputField)的子类,这个子类包含一个委托,它回调在父视图中打开一个popover。

  • 父视图中的cInputField对象

    self.agencyField.inputType = PopupPicker;
    self.agencyField.indicator = Filter;
    self.agencyField.cInputFieldDeleagate = self;
    self.agencyField.text = @"";
    self.agencyField.placeholder = RWLocalizedString(@"Select Agency", @"Select Agency");
    
  • 调用委托方法

    [self.cInputFieldDeleagate performSelector:@selector(popupPickerTouchUpEvent:) withObject:self];
    
  • CInputField委托方法

    - (void)popupPickerTouchUpEvent:(CInputField *)cInputField {
        [self openAgencyPicker:cInputField];
    }
    
  • 打开弹出功能

    - (void)openAgencyPicker:(id)sender{
    
        if (!agencyPicker) {
        agencyPicker = [[CPickerController alloc]
                        initWithSize:CGSizeMake(300, 500)];
    
        agencyPicker.displayTitle = RWLocalizedString(@"SFA.Product.Agency", @"Agency");
        agencyPicker.items = [SalesDataManager getRclAgencyListByShipTo:[[OrderState sharedInstance] orderHeader].storeCd];
        agencyPicker.valueMember = @"value";
        agencyPicker.displayMember = @"text";
        agencyPicker.delegate = self;
        agencyPicker.selectedIndex = -1;
    
        agencyContentNav = [[UINavigationController alloc] initWithRootViewController:agencyPicker];
        agencyContentNav.modalPresentationStyle = UIModalPresentationPopover;
       }
    
        [[AppD menuViewController] presentViewController:agencyContentNav animated:YES completion:nil];
    
        popOverPresentController = agencyContentNav.popoverPresentationController;
        popOverPresentController.sourceView = [sender superview];
        popOverPresentController.sourceRect = popOverRect;
        popOverPresentController.permittedArrowDirections = UIPopoverArrowDirectionAny;
    }
    

问题

在下面添加代码后,我的表单在Xcode工具中没有取消分配(分配模式)

[[AppD menuViewController] presentViewController:agencyContentNav animated:YES completion:nil];

popOverPresentController = agencyContentNav.popoverPresentationController;
popOverPresentController.sourceView = [sender superview];
popOverPresentController.sourceRect = popOverRect;
popOverPresentController.permittedArrowDirections = UIPopoverArrowDirectionAny;

知道这里有什么问题吗?非常感谢,如果有人可以提供帮助。

0 个答案:

没有答案