Question

Je construis une table en coupe, et il montre avec ce qui semble être une section sur le dessus d'une section. Vous pouvez voir sur l'image qu'il ya une ligne blanche dans chaque section.

L'image

Voici le code que je dois construire la table:

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return [alertList count];
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier;

 if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation == UIInterfaceOrientationLandscapeRight)
 {
  CellIdentifier = @"CellLandscape";
 }
 else
 {
  CellIdentifier = @"Cell";
 }

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        cell = [[[UITableViewCell alloc] 
     initWithStyle:UITableViewCellStyleSubtitle
     reuseIdentifier:CellIdentifier] 
    autorelease];

  //cell.contentView.backgroundColor = [UIColor blackColor];

  CGRect frame;

  if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation == UIInterfaceOrientationLandscapeRight)
  {
   frame.origin.x = 370;
   //titleFrame.size.width = 320;
  }
  else
  {
   frame.origin.x = 220;
   //titleFrame.size.width = 220;
  }

  frame.origin.y = 5;
  frame.size.height = 15;
  frame.size.width = 74;

  UILabel *instLabel = [[UILabel alloc] initWithFrame:frame];
  instLabel.tag = 1;
  [cell.contentView addSubview:instLabel];
  [instLabel release];
    }


 // Configure the cell.
 Alert *p = [alertList objectAtIndex:indexPath.section];

 UILabel *instLabel = (UILabel *) [cell.contentView viewWithTag:1];
 instLabel.text = [p docDate];
 instLabel.textColor = [UIColor blackColor];
 [instLabel setFont:[UIFont fontWithName:@"Arial" size:12]];

 NSString *path;

 if ([[p subscription] isEqual:@"Y"])
 {
  path = [[NSBundle mainBundle] pathForResource:@"watchlist_on" ofType:@"png"];
 }
 else
 {
  path = [[NSBundle mainBundle] pathForResource:@"watchlist_off" ofType:@"png"];
 }

 //NSLog(@"%@", path);

 cell.textLabel.textColor = [UIColor colorWithRed:.847 green:0 blue: 0 alpha: 1];
 [cell.textLabel setFont:[UIFont boldSystemFontOfSize:13]];
 cell.textLabel.text = [[NSString alloc] initWithFormat:@"%@", [p Name]];

 cell.detailTextLabel.textColor = [UIColor blackColor];
 [cell.detailTextLabel setFont:[UIFont fontWithName:@"Arial" size: 10]];
 cell.detailTextLabel.text = [p docTitle];

 cell.detailTextLabel.textColor = [UIColor blackColor];
 [cell.detailTextLabel setFont:[UIFont fontWithName:@"Arial" size: 10]];
 //cell.detailTextLabel.text = [p docDate];

 //cell.imageView.image = [UIImage imageWithContentsOfFile:path];
 cell.imageView.userInteractionEnabled = YES;
 cell.imageView.userInteractionEnabled = YES;

 //cell.imageView.image = [UIImage imageWithContentsOfFile:path];

 ///    [cell addSubview:imgView];

 //cell.textLabel.text = [[NSString alloc] initWithFormat:@"%@, %@ G: %@\nDOB: %@ Inst: %@", [p lastName], [p firstName], [p gender], 
 //        [p birthDate], [p inst]];

 cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

 //only 1 alert at a time

 //make doc list from alert object
 Document *documentList1 = [[Document alloc] init];
 self.documentList = documentList1;
 [documentList1 setTitle:[p docTitle]];
 [documentList1 setUniqueId:[p uniqueId]];
 [documentList1 setDate:[p docDate]];
 [documentList1 setRepoOID:[p repoOid]];
 [documentArray addObject:documentList];

    return cell;
}
Était-ce utile?

La solution

Modifier le style de séparation de vue de table soit une seule ligne ou pas -. Vous avez probablement sur une seule ligne gravée

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top