Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add it to UITabbarController like path #64

Open
sushipan opened this issue Mar 13, 2015 · 1 comment
Open

How to add it to UITabbarController like path #64

sushipan opened this issue Mar 13, 2015 · 1 comment

Comments

@sushipan
Copy link

I want to do the effect like Path ,and how to add it to UITabbarController?
when I add it to UITabbarController,I can't add the gray background view to the key window correctly ,because when I use PushView Controller,the AwesomeMenu will not disappear.

@sushipan
Copy link
Author

I find a solution

Notice this: “self” is a UIView,the custom tabbar
-(void)iniMenu:(CGFloat )itemWidth{

CGFloat delta = [UIScreen mainScreen].bounds.size.height-64-self.bounds.size.height;
self.menu = [[AwesomeMenu alloc] initWithFrame:CGRectMake(0, -delta, self.bounds.size.width, delta+self.bounds.size.height) startItem:self.startMenuItem menuItems:self.menuItems];
self.menu.delegate = self;


CGPoint startPoint =  CGPointMake((itemWidth-self.startMenuItem.bounds.size.width)/2.0,(self.bounds.size.height-self.startMenuItem.bounds.size.height)/2.0+delta);

self.menu.startPoint = startPoint;

self.menu.menuWholeAngle = M_PI_2;

self.menu.timeOffset = 0.0;

[self addSubview:self.menu];

}
-(id)hitTest:(CGPoint)point withEvent:(UIEvent *)event {

CGPoint hitpoint = [self convertPoint:point fromView:self];

if ([self pointInside:hitpoint withEvent:event]) {//hit custom tabbar

    return [super hitTest:point withEvent:event];
}

for (AwesomeMenu Item *item in self.menu.menuItems) {

    CGPoint hitPoint = [item convertPoint:point fromView:self];
    if ([item pointInside:hitPoint withEvent:event]){
        NSLog(@"item");
        return item;
    }

}

if(self.menuReallyExpanded){//because one tap will call this method two times ,so we have to detect if the menu is really expanded or really close 
    [self.menu close];
    return self;
}else{
    return [super hitTest:point withEvent:event];
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant