dismissViewControllerAnimated crash at ios5

前端 未结 2 1585
猫巷女王i
猫巷女王i 2020-12-21 23:01

Does the code crash, because of a circular reference?

MenuController: UIViewController

- (id)initWithNibName:
{...
TabsController *tabs = [[TabsController a         


        
相关标签:
2条回答
  • 2020-12-21 23:22

    tough to tell without more info (are you using ARC, are you retaining/assigned the delegate, etc...) but per the iOS docs you are also using deprecated modalview methods. May be worth trying:

    [self presentViewController:tab animated:YES completion:NULL];
    

    and

    [self dismissViewControllerAnimated:YES completion:NULL];
    
    0 讨论(0)
  • 2020-12-21 23:28

    Your question is a little difficult to understand, but I gather you have a retain-cycle:

    ObjectA retains ObjectB
    ObjectB retains ObjectA
    

    and neither object gets deallocated?

    Your property for the tabDelegate should read:

    @property (nonatomic, assign) id tabDelegate;
    //                    ^^^^^^-This is the important bit, this stops the retain cycle.
    
    0 讨论(0)
提交回复
热议问题