UA-17470720-3

Jump to content


Photo
- - - - -

Styling Cells using a Theme.sct file

cells themes

  • Please log in to reply
16 replies to this topic

#1 David DelMonte

David DelMonte

    Forum Master

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

Posted 20 December 2014 - 01:18 PM

I am having mixed success applying a theme to my project.

 

The Theme has this content:

 

 

 

 


navigationItemTitleLabel
{
backgroundColor: clearColor;
font: HelveticaNeue 24;
textColor: blackColor;
}


UINavigationBar
{
backgroundImage: "ipad-menu-item-selected.png";

}

UITableView
{
backgroundView: "ipad-main-window-bg.png";
}



SCTableViewCell
{
backgroundView: "list-item.png";
selectedBackgroundView: "ipad-menu-item-selected.png";
font: HelveticaNeue 22;
textColor: blackColor;

}

SCImageView
{
backgroundView: "ipad-image-mask.png";
selectedBackgroundView: "ipad-image-mask.png";
}
 

 

 

This seems to work for the Master View. The background works for the Detail View, but I can't style the detail view fonts. I also can't style the NavigationView Fonts (Master and Detail).

 

What am I missing please 

 

 


Edited by David DelMonte, 20 December 2014 - 01:30 PM.


#2 David DelMonte

David DelMonte

    Forum Master

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

Posted 20 December 2014 - 01:36 PM

A second matter:

 

I find that 

 

 

font: HelveticaNeue 24;
 

 

 is ok, but

 

 

font: Helvetica-Neue 24;
 

 

 is not

 

 

font: HelveticaNeue-Thin 24;
 

 

 is ok too

 

 

font: Helvetica-Neue-Thin 24;
 

 

 nope



#3 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 20 December 2014 - 03:05 PM

i will start with the second post.. your font names are not valid

 

http://iosfonts.com a list of all the valid font names and info on what versions they work on etc


  • Tarek likes this

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 20 December 2014 - 07:39 PM

OK. What's wrong with the font name? In the docs, it states use "Helvetica-Neue". In iOSFonts and I agree, it should be "HelveticaNeue". 



#5 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 20 December 2014 - 08:29 PM

not sure what docs your referring to? I just always use the names as they are on that website and they always work

maybe there was a typo in the notes or the font name changed along the way or something


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 20 December 2014 - 10:50 PM

I'll look for the specific STV docs that I was referring to.  Meanwhile, here's how I styled the detail view:

 

 

 

SCTextFieldCell
{
textLabel.textColor: grayColor;
textField.textColor: redColor;
textField.tintColor: redColor;
textField.font: HelveticaNeue-Thin 22;

}

SCTextViewCell
{
textLabel.textColor: grayColor;
textView.textColor: redColor;
textView.font: HelveticaNeue-Thin 22;

}
 

 

 


Edited by David DelMonte, 20 December 2014 - 11:04 PM.


#7 David DelMonte

David DelMonte

    Forum Master

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

Posted 21 December 2014 - 07:33 PM

so, while the detailView is now styled, does anyone know how to style navigation and object selection items?

 

I have this:

 

 

SCSelectionCell
{
backgroundView: "list-item.png";
textLabel.textColor: grayColor;


}

SCObjectSelectionCell
{
backgroundView: "list-item.png";
textLabel.textColor: grayColor;

}


navigationItemTitleLabel
{
backgroundColor: clearColor;
font: Baskerville-BoldItalic 20;
shadowColor: blackColor;
textColor: whiteColor;
}
 

 

 
The (object)selection items work, but I don't know how how to call text fields. If I call them textFields, I get STV warnings. Similarly, I don't know what to call navigation items. No warnings, but no changes.
 
Thanks

Edited by David DelMonte, 21 December 2014 - 07:35 PM.


#8 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 22 December 2014 - 10:45 AM

Hi David,

 

Regarding the 1st part, Ozie is right about the font names not valid. What STV does is that it simply takes the font name from your Theme file then calls [UIFont fontWithName:...], so you should be supplying a font name that iOS recognizes. The http://iosfonts.com website is a great resource to check that. If you search the fonts there, you won't find "Helvetica-Neue", for instance.

 

Regarding the 2nd part, what exactly is "navigationItemTitleLabel"? Remember that each theme block must start with an actual existing class in your project. I doubt that "navigationItemTitleLabel" is a class existing anywhere there.



#9 David DelMonte

David DelMonte

    Forum Master

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

Posted 22 December 2014 - 11:05 AM

Hi Tarek, I got the "navigationItemTitleLabel" code from one of the old themes (I think Blogspot or Foody). That's gone now.

 

What I have is as follows:

 

 

 

 

UINavigationBar
{
backgroundImage: "menubar.png";
tintColor: redColor;
}

UITableView
{
backgroundView: "bg.png";

}

SCTableViewCell
{
backgroundView: "list-item.png";
selectedBackgroundView: "ipad-menu-item-selected.png";
font: HelveticaNeue 22;
textColor: blackColor;

}


SCTextFieldCell
{
backgroundView: "list-item.png";
textLabel.textColor: grayColor;
textField.textColor: blackColor;
textField.font: HelveticaNeue 22;

}

SCTextViewCell
{
backgroundView: "list-item.png";
textLabel.textColor: grayColor;
textView.textColor: blackColor;
textView.font: HelveticaNeue 22;

}

SCSelectionCell
{
backgroundView: "list-item.png";
textLabel.textColor: grayColor;


}

SCObjectSelectionCell
{
backgroundView: "list-item.png";
textLabel.textColor: grayColor;

}


SCImageView
{
backgroundView: "ipad-image-mask.png";
selectedBackgroundView: "ipad-image-mask.png";
}


 

 

As I said above, I don't know what to call items within the navigation bar items, nor the SCSelectionCell / SCObjectSelectionCell items. For each, I would like to be able to change fonts and colors (fonts and background).
Apologies f I wasn't clear above...


#10 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 22 December 2014 - 11:27 AM

Hi David,

 

Both your UINavigationBar code and the cells code should work in both root views and detail views. Having said that, I am suspecting that you're viewing this on an iPad with a split view controller, in which case DetailViewController is a separate view controller and you should be setting the theme there too:

 

// DetailViewController.m

- (void)viewDidLoad
{
  ...

  self.tableViewModel.theme = [SCTheme themeWithPath:@"MyTheme.sct"];  

  ...
}


#11 David DelMonte

David DelMonte

    Forum Master

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

Posted 22 December 2014 - 12:32 PM

OK.. But with this code:

 

 

SCSelectionCell
{
backgroundView: "list-item.png";
textLabel.textColor: grayColor;
textField.font: HelveticaNeue 22;

}

SCObjectSelectionCell
{
backgroundView: "list-item.png";
textLabel.textColor: grayColor;
textField.font: HelveticaNeue 22;
}

 

 

 

 

 

I get this warning (and no style obviously)

 

 

**STV** Warning: unable to set style value '<UICTFont: 0x797543d0> font-family: "Helvetica Neue"; font-weight: normal; font-style: normal; font-size: 22.00pt' for property 'textField.font' in class 'SCObjectSelectionCell'
 

 

 

 
DD


#12 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 22 December 2014 - 02:02 PM

does SCObjectSelectionCell have a control textField ?? that might be the problem.. it might be called something else


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


#13 David DelMonte

David DelMonte

    Forum Master

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

Posted 23 December 2014 - 07:42 AM

Ozie, I think you're right. I'lll look for  it..



#14 David DelMonte

David DelMonte

    Forum Master

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

Posted 27 January 2015 - 01:00 PM

i will start with the second post.. your font names are not valid

 

http://iosfonts.com a list of all the valid font names and info on what versions they work on etc

 

Quick follow up Ozie: I like this site a lot for colors -- it gives the full RGB codes and is nice and easy to use..



#15 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 28 January 2015 - 12:36 AM

i use this.. copies to clipboard etc in the format i want.. quick and simple

https://itunes.apple...507257563?mt=12


Edited by ozie, 28 January 2015 - 12:36 AM.

  • David DelMonte likes this

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


#16 David DelMonte

David DelMonte

    Forum Master

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

Posted 28 January 2015 - 03:56 AM

That's nice. Do you have the pro version? Is it worth it?



#17 ozie

ozie

    ¯\_(ツ)_/¯

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

Posted 28 January 2015 - 03:59 AM

i just use the standard  version.. i dont think i would use the pro features at all


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






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