I’m gettin’ these while i analyze my code:
Method returns an Objective-C object with a +1 retain count
and
Object leaked: object allocated and stored into 'headerLabel' is not referenced later in this execution path and has a retain count of +1
on this method:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
// create the parent view that will hold header Label
UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(15.0, 0.0, 300.0, 44.0)];
// create the button object
UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.opaque = NO;
headerLabel.textColor = [UIColor whiteColor];
headerLabel.highlightedTextColor = [UIColor whiteColor];
headerLabel.font = [UIFont boldSystemFontOfSize:15];
headerLabel.frame = CGRectMake(10.0, 0.0, 300.0, 44.0);
if (section == 0)
headerLabel.text = NSLocalizedString(@"A", @"A");
else if (section == 1)
headerLabel.text =NSLocalizedString(@"B", @"B");
else if (section == 2)
headerLabel.text = NSLocalizedString(@"C", @"C");
if(searching)
headerLabel.text = NSLocalizedString(@"SEARCH", @"Search Results");
[customView addSubview:headerLabel];
return customView;
}
Now, expanding the arrows i’m trying to understand, and i suppose that customView is not being deallocated. Is it right?
How can i do to fix it? I’m new to this, help me to understand!
Either add
after
or initialize it like this
of course given that you’re not using ARC