Comments (19)
Hey Dmitri! Thanks for the comment!
They already do! Since they icons are displayed within a standard UINavigationController
, they already automatically conform to the global app-wide [UIView setTintColor]
or the more local [UINavigationBar setBarTintColor]
properties of iOS 7.
I'm running the latest version of TOWebViewController in the latest build of one of my apps and I was able to re-tint all of the icons to red with no worries.
All the info on setting the iOS 7 tint properties are on the Apple site: https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/AppearanceCustomization.html
Let me know if you still have any troubles with it!
from towebviewcontroller.
I tried with setBarTint
but it adds this color as background:
TOWebViewController *webViewCtrl = [[TOWebViewController alloc] initWithURL:url];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:webViewCtrl];
[nav.navigationBar setBarTintColor:[UIColor redColor]];
[self presentViewController:nav animated:YES completion:nil];
from towebviewcontroller.
Oops! My bad! I got my methods mixed up. Sorry! It's just tintColor
, not barTintColor
! So confusing! ^_^;
If it's just the one web view controller you want to tint, you can simply do this:
nav.view.tintColor = [UIColor redColor];
That'll tint both the navigation bar and the tool bar.
If you want the red tinting across the whole app, in your app delegate, apply the [UIColor redColor] to the main UIWindow object in the application:didFinishLaunchingWithOptions:
method.
Let me know how you go!
from towebviewcontroller.
@TimOliver worked pretty well with nav.view.tintColor = [UIColor redColor];
, thanks!
from towebviewcontroller.
Awesome! Glad to hear that worked!
My pleasure! Enjoy!
from towebviewcontroller.
;)
from towebviewcontroller.
Personally I would like to be able to tint the navigation buttons (back/next load etc) without also tinting the Navigation Bar. Could you expose the buttons as properties so this can be done via xxxxxButton.tintColor
from towebviewcontroller.
Thanks for the reply Michael!
Ah okay! Tinting the bar button items on iOS 7 is actually an automatic process, hence why there are no properties regarding them in this controller. The system itself actually recolours the icons itself based off their alpha channels, so changing the colours of the icons from the UIImage category won't do anything.
Apple have outlined how the system works here:
https://developer.apple.com/Library/ios/documentation/UserExperience/Conceptual/TransitionGuide/AppearanceCustomization.html#//apple_ref/doc/uid/TP40013174-CH15-SW3
If you want to recolour JUST this view controller, you just have to call setTintColor:
on its UINavigationController
view
property.
Hope that helped!
from towebviewcontroller.
Hi Tim,
Thanks for the reply.
I mean if you can expose the buttons as properties then I can apply tintColor per button as I need.
At the moment I have to subclass and override your setUpNavigationButtons method and then once the button are created, set the tintColor accordingly.
Remember setting a tintColor on an object will override any tint colour set by by any view higher the view hierarchy etc. So for example in my subclassed method, I currently do this (see the last line):
UIImage *backButtonImage = [UIImage TOWebViewControllerIcon_backButtonWithAttributes:self.buttonThemeAttributes];
if (self.backButton == nil) {
self.backButton = [UIButton buttonWithType:buttonType];
[self.backButton setFrame:buttonFrame];
[self.backButton setShowsTouchWhenHighlighted:YES];
}
[self.backButton setImage:backButtonImage forState:UIControlStateNormal];
self.backButton.tintColor = [UIColor redColour]; // OVERRIDE TINT COLOUR
obviously it would be much nicer to have a property to set the buttons as a whole or to access them individually rather than subclassing and overriding.
Thanks again for a great framework.
regards, Michael.
from towebviewcontroller.
No worries!
Uhh, hang on. What are you trying to do exactly? Do you want to set the tint colour of the navigation buttons to something other than the the global tint colour? And are you on iPad, iPhone or both?
Thanks a lot! Glad you're enjoying it! :)
from towebviewcontroller.
Yes exactly. Global tint colour is white but designer wants other elements like these types of buttons to be a different colour.
I know it's not a common approach but Apple do allow it :-)
from towebviewcontroller.
Ohh I see. Fair enough! Sorry about the confusion!
Done! :)
Let me know how that goes! Enjoy! :)
from towebviewcontroller.
Wow - you are a star!
I will test out a bit later. Thanks again. Michael.
from towebviewcontroller.
No worries Michael! My pleasure! :)
Let me know how it goes!
from towebviewcontroller.
I will do. BTW Any idea when the cocoapod might be updated?
from towebviewcontroller.
I updated the podspec and did another push when I uploaded it, so if you do another 'pod install', it SHOULD come down already. :)
from towebviewcontroller.
Brilliant thanks.
from towebviewcontroller.
Just tested. Works perfectly. Thanks again for doing this.
from towebviewcontroller.
Awesome! I'm really glad to hear that!
My pleasure Michael! Good luck with the app! :)
On 27 August 2014 00:37, Michael Kaye [email protected] wrote:
Just tested. Works perfectly. Thanks again for doing this.
—
Reply to this email directly or view it on GitHub
#11 (comment)
.
from towebviewcontroller.
Related Issues (20)
- Tips: How to hide system back button HOT 1
- Getting Error: 'codesign failed with exit code 1' when building with simulator HOT 1
- Xcode warning that umbrella header is missing some header includes HOT 1
- Support https website HOT 3
- Issue with Photo Library ? HOT 1
- Left Bar Button Item is still missing HOT 3
- Google Forms and browser compatibility HOT 2
- XCode 8.3 warnings HOT 2
- toolbarItems not visible when presented in UIPageViewController HOT 1
- url didn't change if the web page url is set and loaded by javascript HOT 2
- Setting statusbar style HOT 1
- 在iPhone X上显示不正确 HOT 3
- how to customize the webViewController? HOT 1
- Cocoapods HOT 2
- The bottom toolbar not hiding after screen dismissing any reason. HOT 2
- No voice in ipad device HOT 1
- 2.2.7 UI Error on iOS 11 HOT 5
- bottom toolbar below bottom safe area iPhone X HOT 2
- Crash when running UI Tests that close TOWebViewController while page still loading HOT 1
- 没人反应移除UIWebview的问题么 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from towebviewcontroller.