diff --git a/Demo/NUIDemo.xcworkspace/xcshareddata/NUIDemo.xccheckout b/Demo/NUIDemo.xcworkspace/xcshareddata/NUIDemo.xccheckout new file mode 100644 index 00000000..5d291c3f --- /dev/null +++ b/Demo/NUIDemo.xcworkspace/xcshareddata/NUIDemo.xccheckout @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + A46DCE8E-2747-4AE8-B2D7-5BEE7F39F863 + IDESourceControlProjectName + NUIDemo + IDESourceControlProjectOriginsDictionary + + 2F95D1B34DFEF3E924668F657F0C00B5BE26A2AC + ssh://github.com/squarefrog/nui.git + + IDESourceControlProjectPath + Demo/NUIDemo.xcworkspace + IDESourceControlProjectRelativeInstallPathDictionary + + 2F95D1B34DFEF3E924668F657F0C00B5BE26A2AC + ../.. + + IDESourceControlProjectURL + ssh://github.com/squarefrog/nui.git + IDESourceControlProjectVersion + 111 + IDESourceControlProjectWCCIdentifier + 2F95D1B34DFEF3E924668F657F0C00B5BE26A2AC + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 2F95D1B34DFEF3E924668F657F0C00B5BE26A2AC + IDESourceControlWCCName + nui + + + + diff --git a/NUI.podspec b/NUI.podspec index 28d63efe..368435ad 100644 --- a/NUI.podspec +++ b/NUI.podspec @@ -3,10 +3,10 @@ Pod::Spec.new do |s| s.version = "0.5.5" s.summary = "Style iOS apps with a stylesheet, similar to CSS." s.description = "NUI is a drop-in UI kit for iOS that lets you style UI elements using a stylesheet, similar to CSS. It lets you style an entire app in minutes." - s.homepage = "https://github.com/tombenner/nui" + s.homepage = "https://github.com/Joulebug/nui" s.license = { :type => 'MIT', :file => 'LICENSE.txt' } s.author = { "Tom Benner" => "tombenner@gmail.com" } - s.source = { :git => "https://github.com/tombenner/nui.git", :tag => "v0.5.5" } + s.source = { :git => "https://github.com/Joulebug/nui.git", :tag => "v0.5.6" } s.platform = :ios, '5.1' s.source_files = 'NUI', 'NUI/**/*.{h,m}' diff --git a/NUI/Core/NUIAppearance.m b/NUI/Core/NUIAppearance.m index 22b0be5d..0ccb4f30 100644 --- a/NUI/Core/NUIAppearance.m +++ b/NUI/Core/NUIAppearance.m @@ -26,7 +26,9 @@ + (void)initUIBarButtonItem [[uiClass appearance] setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal]; } - if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [[uiClass appearance] setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } else if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { [[uiClass appearance] setTintColor:[NUISettings getColor:@"background-tint-color" withClass:className]]; } diff --git a/NUI/Core/Renderers/NUIBarButtonItemRenderer.m b/NUI/Core/Renderers/NUIBarButtonItemRenderer.m index 2e2152d9..d901ddf7 100644 --- a/NUI/Core/Renderers/NUIBarButtonItemRenderer.m +++ b/NUI/Core/Renderers/NUIBarButtonItemRenderer.m @@ -16,8 +16,6 @@ + (void)render:(UIBarButtonItem*)item withClass:(NSString*)className if ([NUISettings hasProperty:@"background-image" withClass:className]) { [item setBackgroundImage:[NUISettings getImage:@"background-image" withClass:className] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; - } else if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { - [item setTintColor:[NUISettings getColor:@"background-tint-color" withClass:className]]; } else if ([NUISettings hasProperty:@"background-color" withClass:className] || [NUISettings hasProperty:@"background-color-top" withClass:className]) { CALayer *layer = [CALayer layer]; @@ -86,6 +84,11 @@ + (void)render:(UIBarButtonItem*)item withClass:(NSString*)className [item setBackgroundImage:highlightedImage forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; } } + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [item setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } else if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { + [item setTintColor:[NUISettings getColor:@"background-tint-color" withClass:className]]; + } NSDictionary *titleTextAttributes = [NUIUtilities titleTextAttributesForClass:className]; diff --git a/NUI/Core/Renderers/NUIButtonRenderer.m b/NUI/Core/Renderers/NUIButtonRenderer.m index 40fdf9b8..d937fe45 100644 --- a/NUI/Core/Renderers/NUIButtonRenderer.m +++ b/NUI/Core/Renderers/NUIButtonRenderer.m @@ -30,6 +30,11 @@ + (void)render:(UIButton*)button withClass:(NSString*)className [button setTitleEdgeInsets:[NUISettings getEdgeInsets:@"padding" withClass:className]]; } + // Set tint + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [button setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } + // Set background color if ([NUISettings hasProperty:@"background-color" withClass:className]) { [button setBackgroundColor:[NUISettings getColor:@"background-color" withClass:className]]; diff --git a/NUI/Core/Renderers/NUIControlRenderer.m b/NUI/Core/Renderers/NUIControlRenderer.m index 74b8dc0f..1211c2e2 100644 --- a/NUI/Core/Renderers/NUIControlRenderer.m +++ b/NUI/Core/Renderers/NUIControlRenderer.m @@ -18,6 +18,11 @@ + (void)render:(UIControl*)control withClass:(NSString*)className } else if ([NUISettings hasProperty:@"background-color" withClass:className]) { [control setBackgroundColor: [NUISettings getColor:@"background-color" withClass: className]]; } + + // Set tint + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [control setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } [NUIViewRenderer renderBorder:control withClass:className]; [NUIViewRenderer renderShadow:control withClass:className]; diff --git a/NUI/Core/Renderers/NUILabelRenderer.m b/NUI/Core/Renderers/NUILabelRenderer.m index ed0d418f..c7fb9b9f 100644 --- a/NUI/Core/Renderers/NUILabelRenderer.m +++ b/NUI/Core/Renderers/NUILabelRenderer.m @@ -31,6 +31,11 @@ + (void)render:(UILabel*)label withClass:(NSString*)className withSuffix:(NSStri } } + // Set tint + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [label setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } + if ([NUISettings hasProperty:@"font-color" withClass:className]) { label.textColor = [NUISettings getColor:@"font-color" withClass:className]; } diff --git a/NUI/Core/Renderers/NUINavigationBarRenderer.m b/NUI/Core/Renderers/NUINavigationBarRenderer.m index b63f6e85..8d66fa85 100644 --- a/NUI/Core/Renderers/NUINavigationBarRenderer.m +++ b/NUI/Core/Renderers/NUINavigationBarRenderer.m @@ -12,6 +12,12 @@ @implementation NUINavigationBarRenderer + (void)render:(UINavigationBar*)bar withClass:(NSString*)className { + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [bar setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } else if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { + [bar setTintColor:[NUISettings getColor:@"background-tint-color" withClass:className]]; + } + if ([bar respondsToSelector:@selector(setBarTintColor:)]) { if ([NUISettings hasProperty:@"bar-tint-color" withClass:className]) { [bar setBarTintColor:[NUISettings getColor:@"bar-tint-color" withClass:className]]; @@ -21,10 +27,6 @@ + (void)render:(UINavigationBar*)bar withClass:(NSString*)className if ([NUISettings hasProperty:@"background-color" withClass:className]) { [bar setBackgroundColor:[NUISettings getColor:@"background-color" withClass:className]]; } - - if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { - [bar setTintColor:[NUISettings getColor:@"background-tint-color" withClass:className]]; - } if ([NUISettings hasProperty:@"background-image" withClass:className]) { [bar setBackgroundImage:[NUISettings getImage:@"background-image" withClass:className] forBarMetrics:UIBarMetricsDefault]; diff --git a/NUI/Core/Renderers/NUISearchBarRenderer.m b/NUI/Core/Renderers/NUISearchBarRenderer.m index 1fad51ce..a18afead 100644 --- a/NUI/Core/Renderers/NUISearchBarRenderer.m +++ b/NUI/Core/Renderers/NUISearchBarRenderer.m @@ -16,7 +16,9 @@ + (void)render:(UISearchBar*)bar withClass:(NSString*)className [bar setBackgroundImage:[NUISettings getImageFromColor:@"background-color" withClass:className]]; } - if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [bar setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } else if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { [bar setTintColor:[NUISettings getColor:@"background-tint-color" withClass:className]]; } @@ -32,6 +34,10 @@ + (void)render:(UISearchBar*)bar withClass:(NSString*)className [bar setBackgroundImage:[NUISettings getImage:@"background-image" withClass:className]]; } + if ([NUISettings hasProperty:@"bar-tint-color" withClass:className]) { + [bar setBarTintColor:[NUISettings getColor:@"bar-tint-color" withClass:className]]; + } + // Render scope bar if ([NUISettings hasProperty:@"scope-background-color" withClass:className]) { diff --git a/NUI/Core/Renderers/NUISegmentedControlRenderer.m b/NUI/Core/Renderers/NUISegmentedControlRenderer.m index 20019e22..f902f831 100644 --- a/NUI/Core/Renderers/NUISegmentedControlRenderer.m +++ b/NUI/Core/Renderers/NUISegmentedControlRenderer.m @@ -45,8 +45,14 @@ + (void)render:(UISegmentedControl*)control withClass:(NSString*)className [control setDividerImage:[NUISettings getImageFromColor:@"divider-color" withClass:className] forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; } - // Set background tint color - if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { +#if __IPHONE_OS_VERSION_MIN_REQUIRED < 70000 + // UISegmentedControlStyleBar is necessary for setTintColor to take effect + control.segmentedControlStyle = UISegmentedControlStyleBar; +#endif + [control setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } else if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { + // Set background tint color #if __IPHONE_OS_VERSION_MIN_REQUIRED < 70000 // UISegmentedControlStyleBar is necessary for setTintColor to take effect control.segmentedControlStyle = UISegmentedControlStyleBar; diff --git a/NUI/Core/Renderers/NUITabBarRenderer.m b/NUI/Core/Renderers/NUITabBarRenderer.m index d244b3fb..84130dc7 100644 --- a/NUI/Core/Renderers/NUITabBarRenderer.m +++ b/NUI/Core/Renderers/NUITabBarRenderer.m @@ -17,6 +17,12 @@ + (void)render:(UITabBar*)bar withClass:(NSString*)className [bar setBackgroundImage:[NUISettings getImage:property withClass:className]]; } + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [bar setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } else if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { + [bar setTintColor:[NUISettings getColor:@"background-tint-color" withClass:className]]; + } + property = @"selected-image"; if ([NUISettings hasProperty:property withClass:className]) { [bar setSelectionIndicatorImage:[NUISettings getImage:property withClass:className]]; diff --git a/NUI/Core/Renderers/NUITableViewCellRenderer.m b/NUI/Core/Renderers/NUITableViewCellRenderer.m index 672d14a3..02e30abc 100644 --- a/NUI/Core/Renderers/NUITableViewCellRenderer.m +++ b/NUI/Core/Renderers/NUITableViewCellRenderer.m @@ -75,6 +75,12 @@ + (void)renderSizeDependentProperties:(UITableViewCell*)cell frame:cell.bounds]; cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:gradientImage]; } + + // Set tint + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [cell setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } + } @end diff --git a/NUI/Core/Renderers/NUITableViewRenderer.m b/NUI/Core/Renderers/NUITableViewRenderer.m index 8c2117cc..a8181d46 100644 --- a/NUI/Core/Renderers/NUITableViewRenderer.m +++ b/NUI/Core/Renderers/NUITableViewRenderer.m @@ -12,6 +12,11 @@ @implementation NUITableViewRenderer + (void)render:(UITableView*)tableView withClass:(NSString*)className { + // Set tint + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [tableView setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } + // Set seperator style if ([NUISettings hasProperty:@"separator-style" withClass:className]) { [tableView setSeparatorStyle:[NUISettings getSeparatorStyle:@"separator-style" withClass:className]]; diff --git a/NUI/Core/Renderers/NUITextFieldRenderer.m b/NUI/Core/Renderers/NUITextFieldRenderer.m index eedcf214..8b64535d 100644 --- a/NUI/Core/Renderers/NUITextFieldRenderer.m +++ b/NUI/Core/Renderers/NUITextFieldRenderer.m @@ -14,6 +14,11 @@ @implementation NUITextFieldRenderer + (void)render:(UITextField*)textField withClass:(NSString*)className { + // Set tint + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [textField setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } + if ([NUISettings hasFontPropertiesWithClass:className]) { [textField setFont:[NUISettings getFontWithClass:className baseFont:textField.font]]; } diff --git a/NUI/Core/Renderers/NUITextViewRenderer.m b/NUI/Core/Renderers/NUITextViewRenderer.m index cbb06f2d..a903f685 100644 --- a/NUI/Core/Renderers/NUITextViewRenderer.m +++ b/NUI/Core/Renderers/NUITextViewRenderer.m @@ -8,6 +8,12 @@ + (void)render:(UITextView*)textView withClass:(NSString*)className [super render:textView withClass: className]; + // Set tint + property = @"tint-color"; + if ([NUISettings hasProperty:property withClass:className]) { + textView.tintColor = [NUISettings getColor:property withClass:className]; + } + property = @"font-color"; if ([NUISettings hasProperty:property withClass:className]) { textView.textColor = [NUISettings getColor:property withClass:className]; diff --git a/NUI/Core/Renderers/NUIToolbarRenderer.m b/NUI/Core/Renderers/NUIToolbarRenderer.m index 038c1667..729a0583 100644 --- a/NUI/Core/Renderers/NUIToolbarRenderer.m +++ b/NUI/Core/Renderers/NUIToolbarRenderer.m @@ -18,7 +18,9 @@ + (void)render:(UIToolbar*)bar withClass:(NSString*)className [bar setBackgroundImage:[NUISettings getImageFromColor:@"background-color" withClass:className] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault]; } - if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [bar setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } else if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { [bar setTintColor:[NUISettings getColor:@"background-tint-color" withClass:className]]; } diff --git a/NUI/Core/Renderers/NUIViewRenderer.m b/NUI/Core/Renderers/NUIViewRenderer.m index 06e3f873..f98cec53 100644 --- a/NUI/Core/Renderers/NUIViewRenderer.m +++ b/NUI/Core/Renderers/NUIViewRenderer.m @@ -21,6 +21,9 @@ + (void)render:(UIView*)view withClass:(NSString*)className } else if ([NUISettings hasProperty:@"background-color" withClass:className]) { [view setBackgroundColor: [NUISettings getColor:@"background-color" withClass: className]]; } + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [view setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } [self renderSize:view withClass:className]; [self renderBorder:view withClass:className]; diff --git a/NUI/Core/Renderers/NUIWindowRenderer.m b/NUI/Core/Renderers/NUIWindowRenderer.m index cda5280d..a1390bd4 100644 --- a/NUI/Core/Renderers/NUIWindowRenderer.m +++ b/NUI/Core/Renderers/NUIWindowRenderer.m @@ -14,6 +14,12 @@ + (void)render:(UIWindow*)window withClass:(NSString*)className if ([NUISettings hasProperty:@"background-color" withClass:className]) { [window.rootViewController.view setBackgroundColor:[NUISettings getColor:@"background-color" withClass:className]]; } + + // Set tint + if ([NUISettings hasProperty:@"tint-color" withClass:className]) { + [window.rootViewController.view setTintColor:[NUISettings getColor:@"tint-color" withClass:className]]; + } + } @end diff --git a/README.md b/README.md index e96a177f..4e9a3cb3 100644 --- a/README.md +++ b/README.md @@ -228,7 +228,7 @@ Below are all of the currently available style classes, their corresponding UI c * background-color-highlighted *(Color)* * background-image *(Image)* * background-image-insets *(Box)* -* background-tint-color *(Color)* +* ~~background-tint-color *(Color)*~~ _deprecated; use tint-color_ * border-color *(Color)* * border-width *(Number)* * corner-radius *(Number)* @@ -237,6 +237,7 @@ Below are all of the currently available style classes, their corresponding UI c * font-size *(Number)* * text-shadow-color *(Color)* * text-shadow-offset *(Offset)* +* tint-color *(Color)* _new_ #### BarButtonBack @@ -245,7 +246,7 @@ Below are all of the currently available style classes, their corresponding UI c * background-color *(Color)* * background-image *(Image)* * background-image-insets *(Box)* -* background-tint-color *(Color)* +* ~~background-tint-color *(Color)*~~ _deprecated; use tint-color_ * border-color *(Color)* * border-width *(Number)* * corner-radius *(Number)* @@ -254,6 +255,7 @@ Below are all of the currently available style classes, their corresponding UI c * font-size *(Number)* * text-shadow-color *(Color)* * text-shadow-offset *(Offset)* +* tint-color *(Color)* _new_ #### Button @@ -318,6 +320,7 @@ Below are all of the currently available style classes, their corresponding UI c * text-shadow-color-selected-highlighted *(Color)* * text-shadow-offset *(Offset)* * text-transform *(TextTransform)* +* tint-color *(Color)* _new_ * title-insets *(Box)* * width *(Number)* @@ -334,6 +337,7 @@ Below are all of the currently available style classes, their corresponding UI c * shadow-offset *(Offset)* * shadow-opacity *(Number)* * shadow-radius *(Number)* +* tint-color *(Color)* _new_ #### Label @@ -359,6 +363,7 @@ Below are all of the currently available style classes, their corresponding UI c * text-shadow-color *(Color)* * text-shadow-offset *(Offset)* * text-transform *(TextTransform)* +* tint-color *(Color)* _new_ * width *(Number)* #### NavigationBar @@ -370,13 +375,14 @@ Below are all of the currently available style classes, their corresponding UI c * background-color-top/background-color-bottom *(Gradient)* * background-image *(Image)* * background-image-insets *(Box)* -* background-tint-color *(Color)* +* ~~background-tint-color *(Color)*~~ _deprecated; use tint-color_ * font-color *(Color)* * font-name *(FontName)* * font-size *(Number)* * shadow-image *(Image)* * text-shadow-color *(Color)* * text-shadow-offset *(Offset)* +* tint-color *(Color)* _new_ * title-vertical-offset *(Number)* #### PageControl @@ -403,9 +409,11 @@ Below are all of the currently available style classes, their corresponding UI c * background-color *(Color)* * background-color-top/background-color-bottom *(Gradient)* * background-image *(Image)* -* background-tint-color *(Color)* +* ~~background-tint-color *(Color)*~~ _deprecated; use tint-color_ +* bar-tint-color *(Color)* * scope-background-color *(Color)* * scope-background-image *(Image)* +* tint-color *(Color)* _new_ #### SearchBarButton @@ -429,7 +437,7 @@ See SegmentedControl * background-image-insets *(Box)* * background-image-selected *(Image)* * background-image-selected-insets *(Box)* -* background-tint-color *(Color)* +* ~~background-tint-color *(Color)*~~ _deprecated; use tint-color_ * border-color *(Color)* * border-width *(Number)* * corner-radius *(Number)* @@ -443,6 +451,7 @@ See SegmentedControl * text-shadow-color-selected *(Color)* * text-shadow-offset *(Offset)* * text-shadow-offset-selected *(Offset)* +* tint-color *(Color)* _new_ #### Slider @@ -477,9 +486,10 @@ See SegmentedControl * background-color-top/background-color-bottom *(Gradient)* * background-image *(Image)* * background-image-insets *(Box)* -* background-tint-color *(Color)* +* ~~background-tint-color *(Color)*~~ _deprecated; use tint-color_ * selected-image *(Image)* * selected-image-tint-color *(Color)* +* tint-color *(Color)* _new_ #### TabBarItem @@ -506,6 +516,7 @@ See SegmentedControl * row-height *(Number)* * separator-color *(Color)* * separator-style *(SeparatorStyle)* +* tint-color *(Color)* _new_ #### TableCell @@ -525,6 +536,7 @@ See SegmentedControl * text-auto-fit *(Boolean)* * text-shadow-color *(Color)* * text-shadow-offset *(Offset)* +* tint-color *(Color)* _new_ #### TableCellContentView @@ -555,10 +567,11 @@ The detail label of a *UITableViewCell* * background-image-bottom *(Image)* * background-image-top-landscape *(Image)* * background-image-bottom-landscape *(Image)* -* background-tint-color *(Color)* +* ~~background-tint-color *(Color)*~~ _deprecated; use tint-color_ * shadow-image *(Image)* * shadow-image-top *(Image)* * shadow-image-bottom *(Image)* +* tint-color *(Color)* _new_ #### TextField @@ -614,6 +627,7 @@ The detail label of a *UITableViewCell* * shadow-offset *(Offset)* * shadow-opacity *(Number)* * shadow-radius *(Number)* +* tint-color *(Color)* _new_ * width *(Number)* #### Window @@ -621,6 +635,7 @@ The detail label of a *UITableViewCell* *UIWindow* * background-color *(Color)* +* tint-color *(Color)* _new_ Style Value Types -----------------