繁体   English   中英

在 UINavigationController 和 UITableViewController 中跟踪僵尸

[英]Tracking zombie in UINavigationController and UITableViewController

我正在尝试追踪僵尸,我已经在启用 NSZombies 的情况下运行了该应用程序。 一条消息被发送到 BookEventViewController 中的一个解除分配的对象(下面的代码)。

从 UITabBar 按钮移动时发生崩溃。 BookEventViewController 不在 uiTabBar 上,它是从 TabBarController 上的 EventsTableViewController 导航到的。

只有当您从 EventsTableViewController 导航到 BookEventViewController 然后按下 tabButtons 时才会发生崩溃。

我正在努力弄清楚我做错了什么。 我看过仪器的输出,僵尸是由

[UiNavigationController viewWillApear] 

正是在这一点上,我被困住了任何想法,非常感谢

这是我的班级

@implementation BookEventViewController
@synthesize _Image,dateLabel,titleLabel,details,dresscode,Type,capacity,rsvp,runtime,location,price,bookButton,alert,starttime;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.hidesBottomBarWhenPushed=NO;
        self.navigationController.delegate=self;
        self.tabBarController.delegate=self;

    }
    return self;
}

-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
   // NSLog(@"nav called");
    self.tabBarController.tabBar.hidden=NO; //hides tabbar of parent view
    self.hidesBottomBarWhenPushed=NO;
}
-(void)dealloc
{
    self.navigationController.delegate=nil;
    self.tabBarController.delegate=nil;
}

-(void)viewWillAppear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden=YES;
    [self loadDataFromDb];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
     _Image.image=[UIImage imageNamed:@"drinksimg"];
    _Image.clipsToBounds=YES;
    self.navigationController.delegate=self;
    self.tabBarController.tabBar.hidden=YES;
    UISwipeGestureRecognizer *vertical=[[UISwipeGestureRecognizer alloc]
                                        initWithTarget:self
                                        action:@selector(back)];
    vertical.direction=UISwipeGestureRecognizerDirectionRight;
    [self.view addGestureRecognizer:vertical];
   [Functions setFontFamily:@"Neutra Display" forView:self.view andSubView:YES];
    regist=0;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

这是骨灰盒的输出

#Event Type ∆ RefCt RefCt   Timestamp   Responsible Library Responsible Caller
162 Zombie      -1  00:20.374.056   UIKit   -[UINavigationController viewWillAppear:]

我想我已经找到了问题所在。 我已经添加了行

-(void)viewWillDisapear:(bool)animate
 {
     self.navigationController.delegate=nil;
     self.tabBarController.delegate=nil;
     [super viewWillDisapear:animate];
 }

,删除了 dealloc 方法,我现在没有崩溃。 谢谢你的帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM