Skip to content

pop出去再push进去页面,[[(UIViewController *)_delegate view] endEditing:YES];报错 #1

@joshua-hua

Description

@joshua-hua

我从A页面push进去B页面,B页面pop回A页面,A页面再push进B页面的时候,

  • (void)setDelegate:(id)delegate{

    if ([[delegate class] isSubclassOfClass:[UIViewController class]]) {
    // 在代理对象更改前,将现有代理对象中弹出的键盘收回

    [[(UIViewController *)_delegate view] endEditing:YES]; //报错了

    //Thread1:EXC_BAD_ACCESS (code=1,address=0x*****)
    }else{
    NSAssert(NO, @"请将当前响应控件所在的ViewController作为代理参数传入");
    }

    _delegate = delegate;
    }

是不是我写错了什么呢?希望能解答,谢谢。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions