Permalink
Browse files

updating psstylesheet

  • Loading branch information...
1 parent 1efa114 commit cf3bcb76bde2d345642aadee9d1f0de211ff5ff7 Peter Shih committed Feb 24, 2012
Showing with 218 additions and 283 deletions.
  1. +0 −175 PSStyleSheet-Default.plist
  2. +42 −2 PSStyleSheet.h
  3. +176 −102 PSStyleSheet.m
  4. +0 −4 README.md
View
@@ -1,175 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>text</key>
- <dict>
- <key>fontName</key>
- <string>HelveticaNeue-Bold</string>
- <key>fontSize</key>
- <integer>16</integer>
- <key>textColor</key>
- <string>0xefefef</string>
- <key>highlightedTextColor</key>
- <string>0xefefef</string>
- <key>textAlignment</key>
- <string>left</string>
- <key>shadowColor</key>
- <string>0x000000</string>
- <key>shadowOffset</key>
- <string>{0,1}</string>
- </dict>
- <key>navigationTitleLabel</key>
- <dict>
- <key>fontName</key>
- <string>HelveticaNeueLT-MediumCond</string>
- <key>fontSize</key>
- <integer>20</integer>
- <key>textColor</key>
- <string>0x000000</string>
- <key>highlightedTextColor</key>
- <string>0x000000</string>
- <key>textAlignment</key>
- <string>center</string>
- <key>shadowColor</key>
- <string>0x999999</string>
- <key>shadowOffset</key>
- <string>{0, 0}</string>
- <key>numberOfLines</key>
- <integer>5</integer>
- </dict>
- <key>loadMoreLabel</key>
- <dict>
- <key>fontName</key>
- <string>HelveticaNeue-Bold</string>
- <key>fontSize</key>
- <integer>16</integer>
- <key>textColor</key>
- <string>0xefefef</string>
- <key>shadowColor</key>
- <string>0x000000</string>
- <key>shadowOffset</key>
- <string>{0,1}</string>
- </dict>
- <key>pullRefreshWhiteLabel</key>
- <dict>
- <key>fontName</key>
- <string>HelveticaNeueLT-MediumCond</string>
- <key>fontSize</key>
- <integer>18</integer>
- <key>textColor</key>
- <string>0xefefef</string>
- <key>shadowColor</key>
- <string>0xefefef</string>
- <key>shadowOffset</key>
- <string>{0,0}</string>
- </dict>
- <key>pullRefreshBlackLabel</key>
- <dict>
- <key>fontName</key>
- <string>HelveticaNeueLT-MediumCond</string>
- <key>fontSize</key>
- <integer>18</integer>
- <key>textColor</key>
- <string>0x000000</string>
- <key>shadowColor</key>
- <string>0xefefef</string>
- <key>shadowOffset</key>
- <string>{0,0}</string>
- </dict>
- <key>searchField</key>
- <dict>
- <key>fontName</key>
- <string>HelveticaNeue</string>
- <key>fontSize</key>
- <integer>14</integer>
- <key>textColor</key>
- <string>0xcdcdcd</string>
- <key>shadowColor</key>
- <string>0x000000</string>
- <key>shadowOffset</key>
- <string>{0,0}</string>
- </dict>
- <key>nullViewTitle</key>
- <dict>
- <key>fontName</key>
- <string>HelveticaNeue-Bold</string>
- <key>fontSize</key>
- <integer>18</integer>
- <key>textColor</key>
- <string>0xffffff</string>
- <key>textAlignment</key>
- <string>center</string>
- <key>shadowColor</key>
- <string>0x000000</string>
- <key>shadowOffset</key>
- <string>{0,1}</string>
- </dict>
- <key>nullViewSubtitle</key>
- <dict>
- <key>fontName</key>
- <string>HelveticaNeue</string>
- <key>fontSize</key>
- <real>14</real>
- <key>textColor</key>
- <string>0xffffff</string>
- <key>textAlignment</key>
- <string>center</string>
- <key>shadowColor</key>
- <string>0x000000</string>
- <key>shadowOffset</key>
- <string>{0,1}</string>
- </dict>
- <key>filmViewHeader</key>
- <dict>
- <key>fontName</key>
- <string>HelveticaNeueLT-Condensed</string>
- <key>fontSize</key>
- <integer>16</integer>
- <key>textColor</key>
- <string>0x000000</string>
- <key>highlightedTextColor</key>
- <string>0x000000</string>
- <key>textAlignment</key>
- <string>center</string>
- <key>shadowColor</key>
- <string>0x000000</string>
- <key>shadowOffset</key>
- <string>{0,0}</string>
- </dict>
- <key>filmViewFooter</key>
- <dict>
- <key>fontName</key>
- <string>HelveticaNeueLT-Condensed</string>
- <key>fontSize</key>
- <integer>16</integer>
- <key>textColor</key>
- <string>0x000000</string>
- <key>highlightedTextColor</key>
- <string>0x000000</string>
- <key>textAlignment</key>
- <string>center</string>
- <key>shadowColor</key>
- <string>0x000000</string>
- <key>shadowOffset</key>
- <string>{0,0}</string>
- </dict>
- <key>popoverTitleLabel</key>
- <dict>
- <key>fontName</key>
- <string>HelveticaNeueLT-MediumCond</string>
- <key>fontSize</key>
- <integer>18</integer>
- <key>textColor</key>
- <string>0xefefef</string>
- <key>shadowColor</key>
- <string>0xefefef</string>
- <key>shadowOffset</key>
- <string>{0,0}</string>
- <key>textAlignment</key>
- <string>center</string>
- <key>numberOfLines</key>
- <integer>1</integer>
- </dict>
-</dict>
-</plist>
View
@@ -10,10 +10,52 @@
@interface PSStyleSheet : NSObject
+
+/**
+ PSStyleSheet is a plist driven label/button configuration class
+ It tries to remedy the lack of a true stylesheet (like CSS) in UIKit
+
+ How to use:
+ 1. UILabel *myLabel = ...
+ 2. [PSStyleSheet applyStyle:@"myLabelStyle" forLabel:myLabel];
+ 3. ???
+ 4. Profit!
+
+ 1. UIButton *myButton = ...
+ 2. [PSStyleSheet applyStyle:@"myButtonStyle" forButton:myButton];
+ 3. ???
+ 4. Profit!
+
+ Future enhancements:
+ - CSS to PLIST conversion script
+ - Automated stylesheet updating by detecting when the stylesheet file is changed
+ */
+
+
+/**
+ Loads styles from a plist file name
+ */
+ (void)setStyleSheet:(NSString *)styleSheet;
+
+/**
+ Apply a style to a UILabel
+ */
+ (void)applyStyle:(NSString *)style forLabel:(UILabel *)label;
+
+/**
+ Appy a style to a UIButton
+ */
+ (void)applyStyle:(NSString *)style forButton:(UIButton *)button;
+/**
+ Calculate the size required for a string of text bounded by a width given a style.
+ Note: this is useful in table view dynamic row height calculations
+*/
++ (CGSize)sizeForText:(NSString *)text width:(CGFloat)width style:(NSString *)style;
+
+/**
+ Below are individual components of a "Style", might make this private in the future
+ */
+ (UIFont *)fontForStyle:(NSString *)style;
+ (UIColor *)textColorForStyle:(NSString *)style;
+ (UIColor *)highlightedTextColorForStyle:(NSString *)style;
@@ -24,6 +66,4 @@
+ (NSInteger)numberOfLinesForStyle:(NSString *)style;
+ (UILineBreakMode)lineBreakModeForStyle:(NSString *)style;
-+ (CGSize)sizeForText:(NSString *)text width:(CGFloat)width style:(NSString *)style;
-
@end
Oops, something went wrong.

0 comments on commit cf3bcb7

Please sign in to comment.