Skip to content

Problem in - (MDSpreadViewCell *)spreadView:(MDSpreadView *)aSpreadView cellForHeaderInColumnSection:(NSInteger)section forRowAtIndexPath:(MDIndexPath *)rowPath; #34

@shreeshecommstreet

Description

@shreeshecommstreet

Hi

I am trying to create Header cell through this method. My implementation is as follows

  • (MDSpreadViewCell *)spreadView:(MDSpreadView *)aSpreadView cellForHeaderInColumnSection:(NSInteger)section forRowAtIndexPath:(MDIndexPath *)rowPath
    {
    static NSString *cellIdentifier = @"SpreadsHeaderColumn";

    MDSpreadViewCell *cell = [aSpreadView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
    cell = [[MDSpreadViewCell alloc] initWithStyle:MDSpreadViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    [cell setBackgroundColor:[UIColor colorWithRed:238.0/255.0f green:238.0/255.0f blue:238.0/255.0f alpha:1.0]];
    UILabel * textLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height)];
    [textLabel setText:[array objectAtIndex:rowPath.row]];
    [textLabel setFont_small];
    [textLabel setTextAlignment:NSTextAlignmentCenter];
    [cell addSubview:textLabel];
    return cell;
    }

Problem is that, Initially I am getting no header cell. When I scroll the spread sheet it shows some. When I come back to starting point all the headers become visible.

When I scroll the spread sheet all headers become messy. I think problem is with reuse identifier.

Can you please help me.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions