UA-17470720-3

Jump to content


Photo
- - - - -

AccesoryView in DetailTableView

cells view-controllers

  • Please log in to reply
27 replies to this topic

#1 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 06 February 2015 - 12:11 PM

How do I affect the Detail view accessory type - without affecting the Main View. Thanks

 

I'm trying to fix this:

 

 

 

Attached File  Screen Shot 2015-02-06 at 3.08.50 PM.png   5.59K   17 downloads



#2 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 07 February 2015 - 06:34 PM

bump.. help! please



#3 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 08 February 2015 - 12:07 AM

what do you mean by "affect the Detail view accessory type"??

you want to make it a checkmark or detailbutton ??

you want to change the background colour to clear??

 

changes by code or by IB??


Edited by ozie, 08 February 2015 - 12:08 AM.

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


#4 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 08 February 2015 - 03:53 AM

Hi Oz. Either code or IB is fine. I want to have no accessoryType. If not possible, I want the accessory type background to be black.



#5 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 08 February 2015 - 04:16 AM

in IB click the custom cell in the detail view and change its accessoryType in the property panel to none

 

or in code something like this..you can add more testing to style only the cells you want

    self.tableViewModel.sectionActions.detailModelConfigured = ^(SCTableViewSection *section, SCTableViewModel *detailModel, NSIndexPath *indexPath)
    {
        detailModel.cellActions.willDisplay = ^(SCTableViewCell *cell, NSIndexPath *indexPath)
        {
            cell.accessoryType = UITableViewCellAccessoryNone;
        };

    };

Edited by ozie, 08 February 2015 - 04:19 AM.

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


#6 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 08 February 2015 - 06:25 AM

Thanks for trying Ozie. I've tried both those techniques- neither work. I'm pouring through STV source code.. (That feels a bit like going through someone's drawers)



#7 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 11 February 2015 - 08:28 AM

I am still a bit lost on what you're trying to do. Are you trying to change the accessory of the detail view resulting from an SCArrayOfObjectsCell?



#8 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 11 February 2015 - 12:28 PM

exactly. I've tried in code and in IB. I've even tried painting dots on my monitor.

 

Actually, to be clearer, the specific cell is an SCObjectSelectionCell


Edited by David DelMonte, 11 February 2015 - 02:38 PM.


#9 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 11 February 2015 - 04:32 PM

I am sure there are many ways to do this. Here is what first comes to mind for our TasksApp sample:

 

    SCDataDefinition *taskDef = [self dataDefinitionWithIBName:@"Task"];
    SCPropertyDefinition *stepsPDef = [taskDef propertyDefinitionWithName:@"taskSteps"];
    stepsPDef.cellActions.detailModelWillPresent = ^(SCTableViewCell *cell, NSIndexPath *indexPath, SCTableViewModel *detailModel)
    {
        SCArrayOfObjectsSection *taskStepsSection = (SCArrayOfObjectsSection *)[detailModel sectionAtIndex:0];
        taskStepsSection.itemsAccessoryType = UITableViewCellAccessoryDetailDisclosureButton;
    };


#10 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 11 February 2015 - 04:44 PM

i have find that itemsAccessoryType causes many problems.. for example it overrides what i set within IB for a customcell as its property for accessoryType.. it think i remember that it also overrides the cell willConfigure, and can only be changed in the willDisplay


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


#11 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 11 February 2015 - 08:29 PM

I'm open to ideas, but I've worked through just about all the detail view options*, short of creating a separate controller. Seems a pity to do that. Everything else is ok.

 

 

cellActions.detailModelConfigured = ^(SCTableViewCell *cell, NSIndexPath *indexPath, SCTableViewModel *detailModel)

cellActions.detailModelWillPresent = ^(SCTableViewCell *cell, NSIndexPath *indexPath, SCTableViewModel *detailModel)

cellActions.detailModelDidPresent = ^(SCTableViewCell *cell, NSIndexPath *indexPath, SCTableViewModel *detailModel)

 

I actually don't see an option for SCObjectSelectionCells. I've probably misconfigured something, but it's a bit frustrating.

 

Oh, and I need to be able to just change the detail view -- I can change the root view but don't want that.


Edited by David DelMonte, 11 February 2015 - 08:38 PM.


#12 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 11 February 2015 - 08:41 PM

using one of the methods above, test if the indexpath is the row you want to change.. then cast that cell to the SCSelectionCell *sCell = (SCSelectionCell*)cell etc etc


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


#13 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 18 February 2015 - 09:05 AM

Hi David,

 

From your PM to me, I now understand that your problem is that the background color or the accessory view (white) is not the same as the cell (black), is that correct? I initially thought you actually did this on purpose using an accessory view, as setting the cell's background color should automatically also set the accessory background color as well. Do you have a sample that you can attach that replicates this? (this probably has nothing to do with STV BTW)



#14 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 18 February 2015 - 05:48 PM

Thanks Tarek. I'll put something small together to PM you.

 

(sent)


Edited by David DelMonte, 19 February 2015 - 03:16 AM.


#15 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 19 February 2015 - 09:52 AM

Hi David,

 

I got your PM on how to replicate this in our CoreDataApp sample. It seems that you're selecting and changing the background of the cell's "Content View", and not the cell itself. Make sure to select the whole cell (from IB's document outline) then change the background from there.



#16 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 19 February 2015 - 09:57 AM

I have changed every element of the cell.. No joy. Could you possibly send me a small sample with the accessory changed. Then I can see what I'm missing.. DD



#17 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 19 February 2015 - 10:12 AM

Please find attached a modified version of our CoreDataApp. This is how the cells render:

 

Attached File  BlackCells.png   10.79K   6 downloads

Attached Files



#18 David DelMonte

David DelMonte

    Forum Master

  • STV 4.0 Pro
  • PipPipPipPipPipPipPip
  • 527 posts
Reputation: 41
Excellent

Posted 19 February 2015 - 10:23 AM

Thanks Tarek, have you tried that in the iPad sim?

 

I get the same result as in my own project. iPhone is ok, iPad is not


Edited by David DelMonte, 19 February 2015 - 10:26 AM.


#19 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 19 February 2015 - 10:50 AM

There seems to be a crazy iPad simulator bug that is ignoring cell background color changes. I even added the following code to MasterViewController.m and it still ignores it:

 

- (void)viewDidLoad {
    [super viewDidLoad];
    
    SCDataDefinition *taskEntityDef = [self dataDefinitionWithIBName:@"TaskEntity"];
    taskEntityDef.cellActions.willDisplay = ^(SCTableViewCell *cell, NSIndexPath *indexPath)
    {
        if([cell isKindOfClass:[SCArrayOfObjectsCell class]])
            cell.backgroundColor = [UIColor blackColor];
    };
}

 

 

All renders perfectly on my iPad device:

Attached File  iPadDeviceSS.png   26.24K   7 downloads



#20 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 19 February 2015 - 10:53 AM

Update: iPad simulator works fine if the cells aren't generated in IB. Very strange.







Also tagged with one or more of these keywords: cells, view-controllers

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users