1

セルデータを表示する必要があります。実際にコードをデバッグすると、cell.label.text値が正しいことがわかりますが、シミュレーターには何も表示されません。numberOfRowsInSection メソッドで行数を設定しました。

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
        static NSString *identifier = @"Cell";
        LogTableCell *cell = (LogTableCell *)[tableView dequeueReusableCellWithIdentifier:identifier];
        CGRect frame1 = [ self.view  frame];
        frame1.origin.x=22.0f;
        frame1.origin.y=55.0f;

        frame1.size.width = 298.0f;
        frame1.size.height= 425.0f;
        [self.view.superview setFrame:frame1];
        int btnWidth = ((self.view.frame.size.width-16)/3);


        if(cell == nil)
        {
            cell = [[LogTableCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        }
        LogItem *lg = [[LogItem alloc]init];

        lg = [arrLogs objectAtIndex:indexPath.row ];

        NSLog(@"%d",indexPath.row);
        cell.lblname.textColor=[UIColor whiteColor];
        cell.lblsubtype.textColor=[UIColor whiteColor];
        cell.lbltime.textColor=[UIColor whiteColor];
        cell.lblname.font=[UIFont fontWithName:@"Merriweather" size:15.0];
        cell.lblsubtype.font=[UIFont fontWithName:@"Merriweather-Light" size:13.0];
        cell.lbltime.font=[UIFont fontWithName:@"Merriweather-Light" size:13.0];

        UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(1, cell.contentView.frame.size.height, 298.0,2)] ;

        imageview.image = [UIImage imageNamed: @"lineseperator.png"];
        [cell.contentView addSubview:imageview];

        cell.lblname.text = lg.name;
        NSLog(@"%@",lg.name);
        [[cell imgtype] setImage:[UIImage imageNamed:lg.imagetype]];

        if([lg.subtype length] == 0){
            NSLog(@"%@",lg.subtype);
            cell.lblsubtype.text = lg.time;
            cell.lbltime.text = @"";
        }
        else{
            NSLog(@"%@",lg.subtype);
            cell.lblsubtype.text = lg.subtype;
            cell.lbltime.text = lg.time;
        }


    return cell;
}
4

1 に答える 1

0

セルに追加しているイメージビューは、他のすべてのコンテンツをカバーしています。サイズ変更/再配置するか、代わりに既存の cell.imageView を使用する必要があります。

于 2013-03-25T01:05:57.453 に答える