UA-17470720-3

Jump to content


Photo
- - - - -

SCExpandCollapseCell - Not Expanding/Collapsing Section - Demo code added to Tasks.app


  • Please log in to reply
9 replies to this topic

#1 Seth Vanderdrift

Seth Vanderdrift

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 108 posts
Reputation: 20
Excellent

Posted 20 November 2015 - 12:41 PM

Greetings,

 

Using STV 5.1.3, static frameworks. xcode 7.1

 

Trying to use a SCExpandCollapseCell, but it's not expanding/collapsing the section that its in.  I modified the Sample Tasks.app to demonstrate. 

 

Changed the MasterViewController.m viewDidLoad the Tasks.app sample, to below.  As far as I can figure, making a new setting self.tableViewModel to a new SCTableViewModel should reset the IB designed stuff.

 

This code makes a section that looks as expected, with the up/down arrow on the SCExpandCollapseCell, but it does nothing. Just changes flips the up/down arrow and changes the text to Expanded/Closed as appropriate.. My original code had the SCExpandCollapseCell added at the bottom of the section, and it displayed the cell at the bottom of the section.

 

I've used this back in v3 with no problems, not sure what I could be doing wrong at this point.

 

@implementation MasterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
  
    self.tableViewModel = [SCTableViewModel modelWithTableView:self.tableView];
    
    SCTableViewSection *syncSection = [SCTableViewSection sectionWithHeaderTitle:@"Sync Summary"];
    NSInteger recordCount = 10;
    NSString *summaryTitle = [NSString stringWithFormat:@"Total records to update : %i", recordCount];
    
    SCExpandCollapseCell *xccell = [SCExpandCollapseCell cellWithExpandText:summaryTitle collapseText:@"Closed" ownerSectionExpanded:NO];
    
    [syncSection addCell:xccell];
    
    NSArray *list = @[@"Line 1", @"Line 2", @"Line 3", @"Line 4"];
    for (NSString *line in list) {
        SCTableViewCell *cell = [SCTableViewCell cellWithText:line];
        [syncSection addCell:cell];
    }
    
    [self.tableViewModel addSection:syncSection];
}

 

 

 



#2 ozie

ozie

    ¯\_(ツ)_/¯

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 526 posts
  • LocationAustralia
Reputation: 169
Popular

Posted 21 November 2015 - 03:24 PM

need to add the expand cell to the section you want it to work with


@implementation MasterViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

self.tableViewModel = [SCTableViewModel modelWithTableView:self.tableView];

SCTableViewSection *syncSection = [SCTableViewSection sectionWithHeaderTitle:@"Sync Summary"];
NSInteger recordCount = 10;
NSString *summaryTitle = [NSString stringWithFormat:@"Total records to update : %i", recordCount];

syncSection.expandCollapseCell = [SCExpandCollapseCell cellWithExpandText:summaryTitle collapseText:@"Closed" ownerSectionExpanded:NO];

NSArray *list = @[@"Line 1", @"Line 2", @"Line 3", @"Line 4"];
for (NSString *line in list) {
SCTableViewCell *cell = [SCTableViewCell cellWithText:line];
[syncSection addCell:cell];
}

[self.tableViewModel addSection:syncSection];
}

Edited by ozie, 22 November 2015 - 02:59 AM.

  • Tarek likes this

P.S. I hate Swift.. don't talk Swift.. Too old school to learn yet another programming language.


#3 Seth Vanderdrift

Seth Vanderdrift

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 108 posts
Reputation: 20
Excellent

Posted 22 November 2015 - 02:23 PM

Ozie, 

First of all thanks. I see what I had missed, BUT..

 

On my setup, STV 5.1.3 Static Framework, Xcode 7.1.  the below code still does not make a working expanding/collapsing section.  

 

I get the expand/collapse cell at the top, it toggles between open/closed state, but none of the rest of the section changes.

 

If I create the expand/collapse cell initially expanded (ownerSectionExpanded:YES), the other cells are ALWAYS displayed. The x/c cell toggles like expected, just doesn't do anything.

 

If I create the expand/collapse cell initially expanded (ownerSectionExpanded:NO), the other cells are NEVER displayed. 

 

The only code in MasterViewController in the Tasks.app sample app is as below (obviously with @end added at the end)

 

I've tried it on my iPod6 test device, iPhone 6s+ and simulator.  All iOS 9.1

 

I also made the section.expandCollapseCell change in the app I'm main app, and it operates the same in that app, so it's not a problem with tasks.app specifically.

 

Is that code working on your sample tasks.app?

 

 

 

need to add the expand cell to the section you want it to work with


@implementation MasterViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

self.tableViewModel = [SCTableViewModel modelWithTableView:self.tableView];

SCTableViewSection *syncSection = [SCTableViewSection sectionWithHeaderTitle:@"Sync Summary"];
NSInteger recordCount = 10;
NSString *summaryTitle = [NSString stringWithFormat:@"Total records to update : %i", recordCount];

syncSection.expandCollapseCell = [SCExpandCollapseCell cellWithExpandText:summaryTitle collapseText:@"Closed" ownerSectionExpanded:NO];

NSArray *list = @[@"Line 1", @"Line 2", @"Line 3", @"Line 4"];
for (NSString *line in list) {
SCTableViewCell *cell = [SCTableViewCell cellWithText:line];
[syncSection addCell:cell];
}

[self.tableViewModel addSection:syncSection];
}


#4 Seth Vanderdrift

Seth Vanderdrift

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 108 posts
Reputation: 20
Excellent

Posted 23 November 2015 - 07:44 AM

Ok, defiantly some bugs in the Expand/Collapse cells.  I filed a support request, but basically:

 

- If you scroll the table view before trying the expand/collapse cells, they will work correctly.

- Also, I made a section with SCArrayOfStrings, and with the expand/collapse cell added, the initial view has a cell sized gap between the section header and the expand/collapse cell at the top.

  If you scroll a bit to 'activate' the expand/collapse cells, and collapse the section with the gap between the header and e/c cell. The closing cells animate above the e/c cell.

- You also get a crash, if you change the expand/collapse cells before scrolling, then scroll, and try to expand/collapse again.  (Clearly the state is changing in the e/c cell, but not the actual tableview, so the tableview throws an internal consistency assert crash)

 

Hopefully it's a simple fix.

 

Seth


  • Tarek likes this

#5 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 01 December 2015 - 09:23 AM

Thank you very much Seth, I was able to replicate this using your sample. We'll provide a fix in our upcoming release.



#6 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 26 January 2016 - 06:59 PM

Has this issue been fixed where you have to scroll the table first before the expand/collapse works properly?

 

Also, it would be great if the section header itself had the arrow on it instead of a separate cell. I'm struggling right now because I want my cell to look just like a section header in a grouped table. But there's a horizontal line above the expand/collapse cell and I can't seem to shrink the section header/footer to 0. The minimum seems to be 1.

 

I thought maybe I could switch to a Plain table instead of a Grouped table style, but the expand/collapse cell doesn't seem to function on a Plain table style.

 

I'm using STV 5.2.1 Pro.

 

Thanks,

 

Brendan



#7 ozie

ozie

    ¯\_(ツ)_/¯

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 526 posts
  • LocationAustralia
Reputation: 169
Popular

Posted 26 January 2016 - 07:35 PM

 I can't seem to shrink the section header/footer to 0. The minimum seems to be 1.

the min is above one.. it can not be 0.. this is not to do with STV ( i think i always use 0.1f but 0.0000001 might work still)

 

as for the arrow being on the header.. there are discussions on this on forums (i did a quick search)

It has been awhile since i have used the expand cells, but it functions the same in both grouped or plain tables

 

for the header, you could create a custom header view and add your own button that when tapped expands or collapses the current section that header belongs to


Edited by ozie, 26 January 2016 - 07:39 PM.

  • Tarek likes this

P.S. I hate Swift.. don't talk Swift.. Too old school to learn yet another programming language.


#8 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 27 January 2016 - 03:50 AM

Hey guys,

 

Yes, all SCExpandCollapseCell issues have been resolved.

 

Re headerHeight: ozie is spot on. iOS assumes '0' to be default height and not zero height.



#9 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 27 January 2016 - 12:26 PM

Hey guys,

 

Yes, all SCExpandCollapseCell issues have been resolved.

 

Re headerHeight: ozie is spot on. iOS assumes '0' to be default height and not zero height.

 

Hi Tarek,

 

I still seem to have the issue where the expand/collapse doesn't happen unless I first scroll the table. I got the header/footer height issue resolved by setting it to 0.1.

 

Thanks,

 

Brendan



#10 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 27 January 2016 - 01:07 PM

Very strange, I'll check it out and we'll ship a fix in our next release.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users