自定义标签栏控制器导致内存泄漏?

时间:2014-04-24 20:42:40

标签: ios objective-c memory-leaks

您好我的IOS应用程序中存在NSString内存泄漏问题。我开始相信这个泄漏是由我的自定义标签栏控制器引起的,因为标签栏涉及泄漏堆栈跟踪。我不确定我哪里出错了,如果有人可以快速检查我的自定义课程,我会很感激吗?谢谢!

这是类,.h文件还没有被修改过!

#import "CustomTabBarController.h"

@interface CustomTabBarController ()

@end

@implementation CustomTabBarController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

     UITabBarItem *tabBarItem1 = [self.tabBar.items objectAtIndex:0];
      UITabBarItem *tabBarItem2 = [self.tabBar.items objectAtIndex:1];
      UITabBarItem *tabBarItem3 = [self.tabBar.items objectAtIndex:2];
      UIImage *bg = [UIImage imageNamed:@"tbcb"];
      self.tabBar.tintColor = [UIColor colorWithRed:132.0/255.0 green:64.0/255.0 blue:49.0/255.0 alpha:1];
      [self.tabBar setBackgroundImage:bg];

    tabBarItem1.title = @"Breakfast";
    tabBarItem2.title = @"Lunch";
    tabBarItem3.title = @"Dinner";

      tabBarItem1.image = [[UIImage imageNamed:@"bf"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
      tabBarItem1.selectedImage = [[UIImage imageNamed:@"bfs" ] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];


     tabBarItem2.image = [[UIImage imageNamed:@"l"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
     tabBarItem2.selectedImage = [[UIImage imageNamed:@"ls" ] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];


     tabBarItem3.image = [[UIImage imageNamed:@"d"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
     tabBarItem3.selectedImage = [[UIImage imageNamed:@"ds" ] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

}

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

@end

下面是堆栈跟踪!

enter image description here

0 个答案:

没有答案