tgyhlsb / THTinderNavigationController

iOS navigation component based on Tinder app
MIT License
84 stars 11 forks source link

Hi! I have a little problem. #1

Closed xhzengAIB closed 9 years ago

xhzengAIB commented 9 years ago

Hi! @Tgy31

How to add when switching navbarItemViews zoom effect of the Item?

Jack

tgyhlsb commented 9 years ago

Hey !

Your item can implement - (void)updateViewWithRatio:(CGFloat)ratio from <THTinderNavigationBarItem>. I use it in the demo to change the color, but you can use it to change the size too.

Tell me if this is what you wanted ;)

Tanguy

xhzengAIB commented 9 years ago

Hi! @Tgy31

When rolling around ScrollView, I want the current item has a zoom effect.

Jack

tgyhlsb commented 9 years ago

Go in NavigationBarItem.m and change updateViewWithRatio:(CGFloat)ratio by:

- (void)updateViewWithRatio:(CGFloat)ratio
{
    ratio = ratio/2.0 + 0.5;
    CGFloat height = self.frame.size.height * ratio;
    CGFloat width = self.frame.size.width * ratio;
    CGFloat x = (self.frame.size.width - width) / 2.0;
    CGFloat y = (self.frame.size.height - height) / 2.0;
    self.coloredView.frame = CGRectMake(x, y, width, height);
    self.coloredView.layer.cornerRadius = height/2.0;
}

It will change the size of the orange view with a zoom effect.

xhzengAIB commented 9 years ago

@Tgy31 Ok! Thanks