我在表單元格中使用自定義標籤。每當我再次訪問此頁面時,標籤文本變得越來越暗,就像它表現爲覆蓋。 我該如何解決這個問題?iphone:問題重裝表數據
- (void)viewWillAppear:(BOOL)animated {
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Note" inManagedObjectContext:context];
[request setEntity:entity];
[request release];
[self.tableView reloadData];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
Note *noteItem = [resultController objectAtIndexPath:indexPath];
//[cell.textLabel setText:[noteItem noteTitle]];
//[cell.detailTextLabel setText:[dateFormatter stringFromDate:[noteItem creationDate]]];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
cell.accessoryView=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow.png"]];
UILabel *newLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, 200, 19)];
newLabel.text = [noteItem noteTitle];
[newLabel setBackgroundColor:[UIColor clearColor]];
[cell addSubview:newLabel];
[newLabel release];
UILabel *detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 20, 200, 26)];
detailLabel.text = [dateFormatter stringFromDate:[noteItem creationDate]];
[detailLabel setFont:[UIFont fontWithName:@"Helvetica" size:12.0]];
[detailLabel setBackgroundColor:[UIColor clearColor]];
[cell addSubview:detailLabel];
[detailLabel release];
[cell setBackgroundColor:[UIColor clearColor]];
[cell setAlpha:0.6];
return cell;
}
確定..現在的工作? – iProgrammer
是的,它現在 – Heena