私はiPhone4Sでアプリを実行していますが、カスタムテーブルビューコントローラーとカスタムテーブルビューセルを使用しています。テーブルビューを空白に上にスライドさせ、同様に空白にスライドさせると、メモリリークが発生します。添付の画像を参照してください。
問題がどこにあるのか、あるいはそのセルが問題を引き起こしているとしても、私は特定できないようです。
私はSeasonTableViewControllerを持っています、
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"SeasonTableViewCell";
//SeasonTableViewCell *cell = (SeasonTableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
SeasonTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSLog(@"%@",[tableView dequeueReusableCellWithIdentifier:CellIdentifier]);
if(cell==nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"STableView" owner:self options:nil];
//cell = [[[SeasonTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]autorelease];
cell = (SeasonTableViewCell*)[nib objectAtIndex:0];
}
Season *season = [seasonTableArray objectAtIndex:[indexPath row]];
cell.label1.text = [NSString stringWithFormat:@"%@",[season season_title]];
cell.contentView.backgroundColor = [UIColor redColor];
return cell;
}
これは、NSLog @ "%@"、[tableview dequeResuableCellWithIdentifier:.....]のNSLogからの出力です。
2012-05-31 11:26:10.799 myTVApp[1462:707] (null)
2012-05-31 11:26:10.804 myTVApp[1462:707] (null)
2012-05-31 11:26:10.809 myTVApp[1462:707] (null)
2012-05-31 11:26:10.813 myTVApp[1462:707] (null)
2012-05-31 11:26:10.817 myTVApp[1462:707] (null)
2012-05-31 11:26:11.185 myTVApp[1462:707] <SeasonTableViewCell: 0xfe24da0; baseClass = UITableViewCell; frame = (0 44; 320 44); autoresize = W; layer = <CALayer: 0xfe24860>>
2012-05-31 11:26:11.187 myTVApp[1462:707] <SeasonTableViewCell: 0xfe25730; baseClass = UITableViewCell; frame = (0 132; 320 44); autoresize = W; layer = <CALayer: 0xfe244a0>>
2012-05-31 11:26:11.189 myTVApp[1462:707] (null)
2012-05-31 11:26:11.191 myTVApp[1462:707] (null)
2012-05-31 11:26:11.194 myTVApp[1462:707] (null)
上記では、myTableViewに5つのカスタムSeasonTableViewCellが表示されていますが、残りは通常の白いセルで、何も含まれていません。
以下はSeasonTableViewCellです。
#import "SeasonTableViewCell.h"
@implementation SeasonTableViewCell
@synthesize label1;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
-(void)dealloc
{
[super dealloc];
[label1 release];
//[label2 release];
}
表示の助けをいただければ幸いです。よろしくお願いします。