diff --git a/NUI/Core/NUIAppearance.m b/NUI/Core/NUIAppearance.m index 22b0be5d..c0cb750e 100644 --- a/NUI/Core/NUIAppearance.m +++ b/NUI/Core/NUIAppearance.m @@ -20,12 +20,11 @@ + (void)initUIBarButtonItem NSString *className = @"BarButton:BarButtonBack"; Class uiClass = [UIBarButtonItem class]; - NSDictionary *titleTextAttributes = [NUIUtilities titleTextAttributesForClass:className]; - - if ([[titleTextAttributes allKeys] count] > 0) { - [[uiClass appearance] setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal]; - } - + [self setTitleTextAttributesForClass:uiClass nuiClass:className suffix:nil state:UIControlStateNormal]; + [self setTitleTextAttributesForClass:uiClass nuiClass:className suffix:@"selected" state:UIControlStateSelected]; + [self setTitleTextAttributesForClass:uiClass nuiClass:className suffix:@"highlighted" state:UIControlStateHighlighted]; + [self setTitleTextAttributesForClass:uiClass nuiClass:className suffix:@"disabled" state:UIControlStateDisabled]; + if ([NUISettings hasProperty:@"background-tint-color" withClass:className]) { [[uiClass appearance] setTintColor:[NUISettings getColor:@"background-tint-color" withClass:className]]; } @@ -50,4 +49,17 @@ + (void)initUIBarButtonItem } ++ (void)setTitleTextAttributesForClass:(Class)uiClass nuiClass:(NSString *)nuiClass suffix:(NSString *)suffix state:(UIControlState)controlState +{ + NSDictionary *textAttributes; + if (suffix) { + textAttributes = [NUIUtilities titleTextAttributesForClass:nuiClass withSuffix:suffix]; + } else { + textAttributes = [NUIUtilities titleTextAttributesForClass:nuiClass]; + } + + if ([[textAttributes allKeys] count] > 0) { + [[uiClass appearance] setTitleTextAttributes:textAttributes forState:controlState]; + } +} @end diff --git a/NUI/Core/Renderers/NUIBarButtonItemRenderer.m b/NUI/Core/Renderers/NUIBarButtonItemRenderer.m index a9795f22..90bc76d6 100644 --- a/NUI/Core/Renderers/NUIBarButtonItemRenderer.m +++ b/NUI/Core/Renderers/NUIBarButtonItemRenderer.m @@ -88,6 +88,11 @@ + (void)render:(UIBarButtonItem*)item withClass:(NSString*)className [item setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal]; } + NSDictionary *selectedTextAttributes = [NUIUtilities titleTextAttributesForClass:className withSuffix:@"selected"]; + + if ([[selectedTextAttributes allKeys] count] > 0) { + [item setTitleTextAttributes:selectedTextAttributes forState:UIControlStateSelected]; + } } @end diff --git a/README.md b/README.md index 32d46d11..3be8a4cf 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ To see all of the available properties and values, see the Style Classes and Sty ### Creating Custom Style Classes -You can give elements custom style classes (e.g. `LargeButton`), and make those classes inherit from one or more other style classes by using the form `Button:LargeButton`. To bypass NUI's styling for a particular element, set the class to `none`. You can set an element's style class either in Interface Builder or programmatically: +You can give elements custom style classes (e.g. `LargeButton`), and make those classes inherit from one or more other style classes by using the form `Button:LargeButton`. To bypass NUI's styling for a particular element, set the class to `none`. You can set an element's style class either in Interface Builder or programmatically: #### Setting an Element's Style Class in Interface Builder @@ -190,6 +190,21 @@ Below are all of the currently available style classes, their corresponding UI c * font-size *(Number)* * text-shadow-color *(Color)* * text-shadow-offset *(Offset)* +* font-color-selected *(Color)* +* font-name-selected *(FontName)* +* font-size-selected *(Number)* +* text-shadow-color-selected *(Color)* +* text-shadow-offset-selected *(Offset)* +* font-color-highlighted *(Color)* +* font-name-highlighted *(FontName)* +* font-size-highlighted *(Number)* +* text-shadow-color-highlighted *(Color)* +* text-shadow-offset-highlighted *(Offset)* +* font-color-disabled *(Color)* +* font-name-disabled *(FontName)* +* font-size-disabled *(Number)* +* text-shadow-color-disabled *(Color)* +* text-shadow-offset-disabled *(Offset)* #### BarButtonBack @@ -207,6 +222,21 @@ Below are all of the currently available style classes, their corresponding UI c * font-size *(Number)* * text-shadow-color *(Color)* * text-shadow-offset *(Offset)* +* font-color-selected *(Color)* +* font-name-selected *(FontName)* +* font-size-selected *(Number)* +* text-shadow-color-selected *(Color)* +* text-shadow-offset-selected *(Offset)* +* font-color-highlighted *(Color)* +* font-name-highlighted *(FontName)* +* font-size-highlighted *(Number)* +* text-shadow-color-highlighted *(Color)* +* text-shadow-offset-highlighted *(Offset)* +* font-color-disabled *(Color)* +* font-name-disabled *(FontName)* +* font-size-disabled *(Number)* +* text-shadow-color-disabled *(Color)* +* text-shadow-offset-disabled *(Offset)* #### Button