Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shreeshecommstreet opened this issue Jun 6, 2014 · 1 comment

Comments

@shreeshecommstreet
Copy link

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

@dimitribouniol
Copy link
Member

Since this is a header cell, have you tried basing it off of MDSpreadViewHeaderCell instead? The only other thing I can think of is that you aren't being consistent with widths or heights of your cells — MDSpreadView requires that they not change between data reloads. If you can prepare a sample project showing the issue, I can look into it more though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants