类似Pininterest应用弹出菜单(Menu)效果
应用介绍
类似Pininterest应用弹出菜单(Menu)效果,源码PininterestLikeMenu,实现Pininterest应用的弹出菜单的方式。长按屏幕弹出按钮,弹出的三个按钮可随着手指移动进行一些动画。另外,弹出菜单的位置会随touch位置的变动自适应。 A kind of pop-up menu How to: First, the menu can be initialized with: 源码 PininterestLikeMenuItem *item0 = [[PininterestLikeMenuItem alloc] initWithImage:[UIImage imageNamed:@"center"] selctedImage:[UIImage imageNamed:@"center-highlighted"] selectedBlock:^(void) { NSLog(@"item 0 selected"); }]; PininterestLikeMenuItem *item1 = [[PininterestLikeMenuItem alloc] initWithImage:[UIImage imageNamed:@"center"] selctedImage:[UIImage imageNamed:@"center-highlighted"] selectedBlock:^(void) { NSLog(@"item 1 selected"); }]; PininterestLikeMenuItem *item2 = [[PininterestLikeMenuItem alloc] initWithImage:[UIImage imageNamed:@"center"] selctedImage:[UIImage imageNamed:@"center-highlighted"] selectedBlock:^(void) { NSLog(@"item 2 selcted"); }]; NSArray *submenus = @[item0, item1, item2]; self.menu = [[PininterestLikeMenu alloc] initWithSubmenus:submenus]; To use this pop-up menu, you should add a long press gesture recognizer to the target view with: 源码: - (void)popPininterestMenu:(UIGestureRecognizer *)gesture { CGPoint location = [gesture locationInView:self.view.window]; if (gesture.state == UIGestureRecognizerStateBegan) { // set the start point where the menu showing up self.menu.startPoint = location; [self.menu show]; } else if (gesture.state == UIGestureRecognizerStateChanged) { [self.menu updataLocation:location]; } else { [self.menu finished]; self.menu = nil; } }

©软件著作权归作者所有。本站所有内容均来源于网络,不得违法使用,仅供学习使用,请支持正版!
转载请注明出处: 662P » 类似Pininterest应用弹出菜单(Menu)效果
发表评论 取消回复