romaonthego / REFrostedViewController

iOS 7/8 style blurred view controller that appears on top of your view controller.
MIT License
2.96k stars 494 forks source link

Changing default tint color and blur will be black and white #26

Closed BootMaker closed 10 years ago

BootMaker commented 10 years ago

Changing default tint color and blur will be black and white, for example with

_blurTintColor = [UIColor colorWithWhite:0.8 alpha:0.73];

screen shot 2013-10-23 at 1 34 01

romaonthego commented 10 years ago

This is how UIToolbar tinting works, theres's no workaround. You can disable live blur, it should work there.

jamesharnett-zz commented 10 years ago

So you can change the tint color of the toolbar through blurTintColor?

BootMaker commented 10 years ago

Thanks for the quick replay, appreciate it, BUT the issue is not solved.

I asked differently. I'd like the same effect as the one you have mentioned as credit. Exactly same blur function, same settings! Please see the attached picture.

screen shot 2013-10-23 at 10 28 56

Check the color on the face and the nice blurred text, which is a problem too, as if you place a label on your own picture the will be not blurred (between Profile and Chats)

screen shot 2013-10-23 at 10 39 05

romaonthego commented 10 years ago

I'm using UIToolbar for live blurring under iOS 7, when you adjust blur tint color, it adjusts barTintColor of the toolbar. Disable it and it will fall back to the static blurring function, same as in the another poject. Is that clear?

BootMaker commented 10 years ago

Ok, how to disable? My problem is that I couldn't change the opacity/alpha or color as in the "another project". In the other project there is a line:

_tintColor = [UIColor colorWithWhite:0.8 alpha:0.73];

, where I can set it and it changes, in yours there is no any effect cjhanging this line

_blurTintColor = REUIKitIsFlatMode() ? nil : [UIColor colorWithWhite:1 alpha:0.75f];

even I disable this line:

    if ([toolbar respondsToSelector:@selector(setBarTintColor:)])
        [toolbar performSelector:@selector(setBarTintColor:) withObject:self.frostedViewController.blurTintColor];

Could you comment your code how is it possible?

romaonthego commented 10 years ago

frostedViewController.liveBlur = NO;

BootMaker commented 10 years ago

TRIED IT AND IT'S NOT WORKING!!! Inserting self.liveBlur = NO; into the REFrostedViewController and there is no any effect on the tint color and alpha, even the color is back.

THE PROBLEM: It's not possible to change the opacity and the tint color as in the case of the original one RNSwipeViewController, even I tried with changing [UIColor colorWithWhite:1 alpha:0.75f] anywhere. In the Ryan Nystrom's solution it's easy to change one line of code to achieve this and this is important fine tuning so lacking this draw back your code's usability. I think it could improve the usability of your code if you comment this issue which is quite important if anybody would like to use it.

romaonthego commented 10 years ago

I think you didn't try hard enough.

Go to Simple example project folder, open DEMOAppDelegate.m and add these lines before // Make it a root controller:

frostedViewController.liveBlur = NO;
frostedViewController.blurTintColor = [UIColor colorWithRed:0.9 green:0.5 blue:0.4 alpha:0.75f];

If you're using Storyboards, go to Storyboards folder, open DEMORootViewController.m and add these lines to awakeFromNib:

self.liveBlur = NO;
self.blurTintColor = [UIColor colorWithRed:0.9 green:0.5 blue:0.4 alpha:0.75f];
BootMaker commented 10 years ago

Accept the "didn't try hard" :)

Now it's working with your original storyboard example well.

Just to explain that it was my fault, your code worked well: My problem came from my own installation, as I use a custom controller - behaving like a navigation controller - laying above all other view controllers with a tab bar and a navigation bar and transparent in the middle section, exactly like the original one. This custom controller which became the subclass of the RNFrostedViewController is just a child view controller in the big hierarchy so it's not at the top level and couldn't become root view controller so I have to solve somehow how to blur other view controllers' view which are not its child views.

Thanks again for your kind responsiveness!