UA-17470720-3

Jump to content


Photo
- - - - -

use theme to control cell height?

cells themes

  • Please log in to reply
6 replies to this topic

#1 markr

markr

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 41 posts
Reputation: 5
Good

Posted 23 March 2014 - 05:42 PM

SHORT VERSION - Does STV automatically resize the image used for the arrow on the right edge in an SCObjectSelectionCell when cell.height is set?  If not, how do I resize this to make the cell be shorter than the original image?

 

Hi All -

 

First - apologies for re-writing this text several times - I'm continuing to research this...

 

I'm trying to get rid of unnecessary white space in selection cells to maximize the amount of screen real estate allocated to the content based on the selections.  At the moment, I have three selection cells each of which has white space inside it both above and below the label displaying the current selection.

 

I have a theme file containing the following which I'm applying to the cells:

 

MyCellStyle

{

    label.font: Arial 8;

    label.textAlignment: 1;

    label.numberOfLines: 1;

}

 

The font works.  The textAlignment works (1 = center - unable to get NSTextAlignmentCenter to work...).

 

Then, I have:

 

myChooser.cellActions.willStyle = ^(SCTableViewCell *cell, NSIndexPath *indexPath)

{

     if (indexPath.row == 1) {

             cell.themeStyle = @"MyCellStyle";

             cell.height = 20;

             SCControlCell *controlCell = (SCControlCell *)cell;

             controlCell.controlMargin = 0;

     }

};

 

I'm still getting white space above the selected value.  The only other thing in each SCObjectSelectionCell in addition to the selected value is the image with the arrow providing a UI indicator to tap to open the detail view controller to make a selection.  Is it possible that STV is not resizing this image based on cell.height?

 

Help would be much appreciated as I'm guessing this is a simple newbie error of not knowing what to put in the theme file or what property to set on the cell.

 

Thanks,

Mark


Edited by markr, 23 March 2014 - 06:32 PM.


#2 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 23 March 2014 - 06:36 PM

since you are styling the cell.. you should not have to put in cell.height as cell is itself..

instead i think its just "height: 10;"

you only denote an object that is inside the cell like so

 

MyCell
{
    contentView.backgroundColor: #9D3937;
    textLabel.font: EuphemiaUCAS-Bold 16;
    textLabel.color: whiteColor;
    detailTextLabel.font: EuphemiaUCAS-Bold 12;
    detailTextLabel.color: whiteColor;
    accessoryType: UITableViewCellAccessoryNone;
}

  • Tarek likes this

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


#3 markr

markr

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 41 posts
Reputation: 5
Good

Posted 24 March 2014 - 11:53 AM

Hi Ozie -

 

Thank you!  I'm still trying to get this to work.  accessoryType:UITableViewAccessoryNone; lets me turn off the disclosureIndicator in SCObjectSelectionCells.  However, turning it off unfortunately does not solve the problem with padding above the label being used to display the selected value.  Cell height is still not

 

I'm still looking...there's got to be a way to kill the extra white space...I found a discussion of similar issues here http://stackoverflow...e-uitableviewst

 

FYI...accessoryType:UITableViewAccessoryDisclosureIndicator for an SCDateCell does NOT display the disclosureIndicator...

 

Thanks,

Mark



#4 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 25 March 2014 - 04:06 AM

my sample was not implied to solve your problem, but as a guide on how you can control objects with theme files

 

can you be more specific as to your reference to "white space" to do with selected values.. a pic would be good.. then i might be able to point in to how to solve it


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


#5 markr

markr

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 41 posts
Reputation: 5
Good

Posted 25 March 2014 - 07:18 AM

Picture = 1000 words, text graphic = 100 words?  Will try to do a picture in a moment (have to figure out attachments here which I haven't done before)...in the meantime - DI = disclosureIndicator arrow which is actually centered vertically within the cell (i.e. not as shown on second text line)...cell-labels appear as shown here (just above the separator line between cells) OR get pushed partially or fully below the separator line...one other detail - "label" as used here is selection-value NOT the STV label...

 

=========================

Nav-Bar with Segment Control

-------------------------------------

{TRYING TO REMOVE THIS}

      first-cell-label      

-------------------------------------

{AND THIS}

     second-cell-label         DI

-------------------------------------

{AND THIS}

     third-cell-label              DI

-------------------------------------

 

fourth cell with UIWebView

which shows HTML and

scrolls correctly

 

 

 

------------------------------------

Tab-Bar

========================


Edited by markr, 25 March 2014 - 07:20 AM.


#6 markr

markr

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 41 posts
Reputation: 5
Good

Posted 26 March 2014 - 10:22 AM

Ping - anything anybody???

 

Thanks,

Mark



#7 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 541 posts
  • LocationIreland
Reputation: 134
Popular

Posted 27 March 2014 - 12:05 AM

Hi markr,

 

The StackOverflow page you linked to is to do with section headers and table headers, not white space in individual cells. Are your first, second, and third cells in different sections? I find it helpful to set the background colours for different cells and/or headers to see which bit is what on the screen. And there are some applications that can show you the views in your app in real time, so you could see where the white space is coming from:

 

 

http://revealapp.com

 

 

http://sparkinspector.com

 

 

And a picture is really going to help! 

 

STV documentation says that cellActions.willConfigure is the place to set the height of the cell. Have you tried it there?


Cheers,

Dave

www.dgapps.ie





Also tagged with one or more of these keywords: cells, themes

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users