iOS动画上下文菜单:ContextMenu.iOS
y37f
10年前
您可以轻松地在你的应用程序添加很棒的上下文动画菜单。
Usage:
You are welcome to see the sample of the project for fully operating sample in the Example folder.
- Add folder YALContextMenu to your project.
- #import “YALContextMenuTableView.h”to your view controller
- Create custom UITableViewCell with UIView property for rotation animation and UIView property for fade out animation.
- Your custom cell should implement YALContextMenuCell protocol
@protocol YALContextMenuCell <NSObject> - (UIView *)animatedIcon; - (UIView *)animatedContent; @end
- Use the following code sample to start menu
- (IBAction)presentMenuButtonTapped:(UIBarButtonItem *)sender { // init YALContextMenuTableView tableView if (!self.contextMenuTableView) { self.contextMenuTableView = [[YALContextMenuTableView alloc]initWithTableViewDelegateDataSource:self]; self.contextMenuTableView.animationDuration = 0.15; //optional - implement custom YALContextMenuTableView custom protocol self.contextMenuTableView.yalDelegate = self; //register nib UINib *cellNib = [UINib nibWithNibName:@"ContextMenuCell" bundle:nil]; [self.contextMenuTableView registerNib:cellNib forCellReuseIdentifier:@"contextMenuCellReuseId"]; } // it is better to use this method only for proper animation [self.contextMenuTableView showInView:self.navigationController.view withEdgeInsets:UIEdgeInsetsZero animated:YES]; }