Skip to content

Better tint support#298

Open
ScottFerwerda wants to merge 6 commits intotombenner:masterfrom
Joulebug:tint-support
Open

Better tint support#298
ScottFerwerda wants to merge 6 commits intotombenner:masterfrom
Joulebug:tint-support

Conversation

@ScottFerwerda
Copy link
Copy Markdown

We had a need for better support for the tint options in iOS. I added code to make that happen. In some cases, the tint color was being controlled by the NUI background-tint-color property. This struck me as poorly named, since the tint color doesn't always affect just the background. I renamed these to tint-color where appropriate. I did leave support for the old name, but the new name will supersede the old if both exist in the configuration.

@Stunner
Copy link
Copy Markdown
Collaborator

Stunner commented Jul 9, 2015

Failed the test due to #302.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need an intermediary release of your own fork, please make such changes on a different branch than you're using to file a pull request.

@timbodeit
Copy link
Copy Markdown
Collaborator

The tintColor attribute on UIView is only available on iOS 7 or higher. Classes that didn't have this attribute before and are now getting tint-color support would need appropriate safety checks, to make sure this doesn't crash on a lower iOS Version.

The identically named attributes already existed on some other classes such as UIBarButtonItem or UINavigationBar since iOS 5.

When the tintColor attribute was introduced on UIView, the old tintColor attibutes on the following classes where more or less renamed to barTintColor:

  • UINavigationBar
  • UISearchBar
  • UITabBar
  • UIToolBar

My suggestion would be to set the barTintColor with the background-color attribute on iOS 7 and higher for these classes, instead of the tintColor.

For UIBarButtonItem, UISegmentedControl I think your way of adding the tint-color attribute and deprecating the background-tint-color is the right way to go.

@timbodeit
Copy link
Copy Markdown
Collaborator

Note: #if __IPHONE_OS_VERSION_MIN_REQUIRED < 70000 is a compile time check. This means that the condition doesn't evaluate the iOS version of the device, that an app is run on, but rather the minimum version the app supports.

While this shouldn't be a big problem for NUI, it would be better to check for capabilities at runtime by calling respondsToSelector: when adding more checks for code that requires a minimum iOS Version.

@joeboyscout04
Copy link
Copy Markdown

I'm the lead on this project now (wow, it's been awhile). I see the previous PR added bar-tint-color for UISearchBar, could we do something similar for the other Bar classes?

# Conflicts:
#	Demo/NUIDemo.xcworkspace/xcshareddata/NUIDemo.xccheckout
#	NUI/Core/Renderers/NUINavigationBarRenderer.m
#	NUI/Core/Renderers/NUITabBarRenderer.m
#	NUI/Core/Renderers/NUITextViewRenderer.m
#	README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants