iOS動畫上下文菜單:ContextMenu.iOS

y37f 9年前發布 | 25K 次閱讀 iOS開發 移動開發 ContextMenu.iOS

您可以輕松地在你的應用程序添加很棒的上下文動畫菜單。

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];
    }

iOS動畫上下文菜單:ContextMenu.iOS

項目主頁:http://www.baiduhome.net/lib/view/home/1426423020377

 本文由用戶 y37f 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!