2010-06-30 6 views
0

나는 섹션 테이블을 만들고 있는데, 섹션 상단에 섹션으로 보이는 것과 함께 표시됩니다. 각 섹션 아래에 흰색 선이 있음을 이미지에서 볼 수 있습니다. 여기 섹션 맨 위에있는 섹션 iphone 테이블

The image

내가 테이블 구축해야하는 코드입니다 :

- (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; 
} 
+0

이미지 링크가 죽어서 질문이 명확하지 않습니다. –

답변

1

변경 테이블 뷰의 분리 스타일 중 하나를 한 줄 또는 없음을 - 당신은 아마 에칭 한 줄에 있습니다.

관련 문제