You can easily add awesome animated context menu to your app.

Overview

Context-Menu.iOS

You can easily add awesome animated context menu to your app.

Made in Yalantis

Check this [project on dribbble] (https://dribbble.com/shots/1785274-Menu-Animation-for-Additional-Functions?list=users&offset=17)

Check this [project on Behance] (https://www.behance.net/gallery/20411445/Mobile-Animations-Interactions)

ContextMenu

Installation

CocoaPods

pod 'ContextMenu.iOS', '~> 1.1.0'

Manually

Copy all files from YALContextMenu folder to your xcode project.

Usage

Objective-C

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;
//optional - implement menu items layout
self.contextMenuTableView.menuItemsSide = Right;
self.contextMenuTableView.menuItemsAppearanceDirection = FromTopToBottom;

//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];
}
  • Use default UITableViewDataSource methods for additional set up and customisation of the cell.
  • Сall updateAlongsideRotation method before the rotation animation started and reloadData method after rotation animation finished or in UIViewControllerTransitionCoordinator's animateAlongsideTransition block for proper rotation animation.
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
//should be called after rotation animation completed
[self.contextMenuTableView reloadData];
}

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];

[self.contextMenuTableView updateAlongsideRotation];
}

- (void)viewWillTransitionToSize:(CGSize)size
withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {

[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];


[coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
//should be called after rotation animation completed
[self.contextMenuTableView reloadData];
}];
[self.contextMenuTableView updateAlongsideRotation];

}

Swift

You should add the following line to your bridging header:

@import ContextMenu_iOS;

Customisation

To customise menu items side position you can specify a 'menuItemsSide' property. When it set to 'Right' the first cell will be opened from right to left and selected cell will be closed vice versa and when it set to 'Left' the first cell will be opened from left to right and selected cell will be closed vice versa. Default - Right.

Also, to customise menu items appearance direction you can specify 'menuItemsAppearanceDirection' property. Default - FromTopToBottom.

To customise cell set up your custom drawables in the animated icon. Actually the cell design and layout is completely at your choice.

animationDuration is to be used for animation speed in seconds.

Compatibility

iOS 7, iOS 8, iOS 9

Version: 1.1.0

Let us know!

We’d be really happy if you sent us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding the animation.

P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for iOS (Android) better than better. Stay tuned!

License

Copyright 2017, Yalantis

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Comments
  • Cocoapods no longer working

    Cocoapods no longer working

    This worked perfectly via cocoapods until today.

    Now it says:

    Analyzing dependencies [!] Unable to satisfy the following requirements:

    • ContextMenu.iOS (~> 1.0.0) required by Podfile
    opened by pjebs 7
  • Does not work on iPad

    Does not work on iPad

    Menu cover the entire width and half the screen with white color and other half with semi transparent black color. Anyone have an idea how to solve this?

    opened by andresteves 6
  • App crash when there's another tableview in controller

    App crash when there's another tableview in controller

    i had to use context menu on multiple screens so i made

    @interface UIBaseControllerForMenu : UIViewController <UITableViewDelegate,UITableViewDataSource,YALContextMenuTableViewDelegate>

    and added all menu code in this controller's m file.didn't make xib file for this controller file.

    and where i needed to use it, i used @interface UIMyAppointmentViewController : UIBaseControllerForMenu

    and call the action button of UIBaseControllerForMenu from child controllers to show/init menu.it works fine in controllers without tableview of there own but crashes the app when there's a other tableview in them.issue is you are getting cell from visible cells function of tableview which returns the controller's own cell not the one belonging to menu. and try to call functions defined in YALContextMenuCell protocol and app crashes as other cells are not implementing this function.

    any solution to this???

    opened by sameer4 3
  • Constraints conflict when implementing into tableviewcontroller

    Constraints conflict when implementing into tableviewcontroller

    Got this problem when implementing contect-menu into my exsiting tableviewcontroller:

    http://pastebin.com/4Vfes3Tv

    The menu won't show at all

    However it works fine on normal UIViewController, any idea how to fix this?

    Thanks for your time and awsome project!

    opened by khalilleo 3
  • How to Disable Delete Option in ContextMenu

    How to Disable Delete Option in ContextMenu

    Another Issue I am facing is that I got two tableview in single screen,One is Context Menu and Other is of my Application, Now I am using "commitEditingStyle" to delete Table cell item by Swipe in my Application table but This Feature will obviously look odd when any user do swipe in ContextMenu so how to disable it for our ContextMenu Table. ios simulator screen shot apr 19 2015 10 14 03 pm

    opened by AmitAjmera 3
  • Background view not set fit to screen in iPad

    Background view not set fit to screen in iPad

    I have integrated this menu in my App. Its working fine in all iPhone but while using in iPad,If you tap on menu then Background of this menu not set fit to screen.

    opened by AmitAjmera 3
  • How to use this library in swift?

    How to use this library in swift?

    Hi all,

    I am new for developing the ios application. I have started to use this library. But I have used swift 2.0. In documentation don't have more details using of swift. can any one explain with examples.

    opened by varalakshmi090 2
  • Best way is to add the view in the UIWindow

    Best way is to add the view in the UIWindow

    When i user it, i found your demo is to hide the statusBar at the very beginning, i think it is not good. My solution is to add the view in the main window, and make the windowLevel high than the statusbar window level: kWindow.windowLevel = UIWindowLevelStatusBar + 1; contextMenuTableView.showInView(kWindow, withEdgeInsets: UIEdgeInsetsZero, animated: true). When hide the view: kWindow.windowLevel = originalWindowLevel

    opened by fu-xianfeng 2
  • animation direction depending on menu position(Right - Left)

    animation direction depending on menu position(Right - Left)

    Added animation direction that resolves issue #21 for menu, that is located on the left side of the screen. Direction must be assigned in the 'showMenu' method.

    opened by EgorSobko 2
  • Dismiss Menu on outside click

    Dismiss Menu on outside click

    Is there any method to dismiss menu on outside click,I found whole cell clickable therefore on click empty space it handle menu action.

    Anyway,thanks for great menu.

    opened by girubhai 2
  • Cannot find an initializer for type in Swift

    Cannot find an initializer for type in Swift

    Hi Im using Context-Menu.iOS in my swift proyect but i get an error when i try to initialize it:

    let contextMenuTableView = YALContextMenuTableView(tableViewDelegateDataSource: self)

    and the error message:

    Cannot find an initializer for type 'YALContextMenuTableView' that accepts an argument list of type '(tableViewDelegateDataSource: ImageEditing -> () -> ImageEditing)'

    Thanks

    opened by sanarroya 2
  • App crash when there's another tableview in controller

    App crash when there's another tableview in controller

    i had to use context menu on multiple screens so i made

    @interface navigationMenu : UIViewController <UITableViewDelegate,UITableViewDataSource,YALContextMenuTableViewDelegate>

    and added all menu code in this controller's m file.didn't make xib file for this controller file.

    and where i needed to use it, i used @interface UIMyAppointmentViewController : navigationMenu

    and call the action button of navigationMenu from child controllers to show/init menu.it works fine in controllers without tableview of there own but crashes the app when there's a other tableview in them.issue is you are getting cell from visible cells function of tableview which returns the controller's own cell not the one belonging to menu. and try to call functions defined in YALContextMenuCell protocol and app crashes as other cells are not implementing this function.

    any solution to this???

    i have applied many solutions but current view controller data source and delegate reference not remove when load context menu again and tableview datasouce as well delegate method call of child view controller not parent view controller.

    please help me it's urgent.

    Thanks in advance.

    opened by shraddha-patel-1891 0
  • Menu does not open properly after second time

    Menu does not open properly after second time

    Everything was working fine until I updated the version of iOS, now the menu opens incorrectly from the second time.

    1 click: 52b5c87d-8384-4f20-98db-88b6f54bf689

    2 click: 0463c8ec-3f3d-462a-a7b3-f5c4c23f362d

    3 click: 6a85e95a-a4a3-40ad-821e-714ff71321b5

    If someone can help me fix this problem

    opened by GerlanStanley 2
  • not showing menu and + button in ios 11.2

    not showing menu and + button in ios 11.2

    not showing menu and + button in ios 11.2, work fine less than 11 version. How can i Fix this please help me. if Tapped 2nd timeon + Button it works,Not work in single Touch + Button. only + Button show when I rotate device then show.Thanks img_0046

    type: bug priority: medium status: queued 
    opened by Mrugenpatel 3
Releases(1.1.1)
Owner
Yalantis
Knowledge is power and the way to get power is by sharing knowledge. We are open source because this is a smart way to live, work and play.
Yalantis
RadialMenu is a custom control for providing a touch context menu (like iMessage recording in iOS 8) built with Swift & POP

RadialMenu Looking for help? For $150/hr I'll help with your RadialMenu problems including integrating it into your project. Email [email protected] t

Brad Jasper 297 Nov 27, 2022
An iOS context menu UI inspired by Things 3.

Contextual menus with delightful animations and styles Total control over menu contents using your own UIViewControllers Tons of feature and interacti

GitHawk 971 Nov 30, 2022
An easy way to use `canPerformAction` for context menu in SwiftUI.

Use canPerformAction for TextField/Editor in SwiftUI You know how a TextField displays a set of context menu? It doesn't matter if it's UIKit or Swift

StuFF mc 5 Dec 18, 2021
RadialMenu is a custom control for providing a touch context menu (like iMessage recording in iOS 8) built with Swift & POP

RadialMenu Looking for help? For $150/hr I'll help with your RadialMenu problems including integrating it into your project. Email [email protected] t

Brad Jasper 297 Nov 27, 2022
SwiftySideMenu is a lightweight and easy to use side menu controller to add left menu and center view controllers with scale animation based on Pop framework.

SwiftySideMenu SwiftySideMenu is a lightweight, fully customizable, and easy to use controller to add left menu and center view controllers with scale

Hossam Ghareeb 84 Feb 4, 2022
Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app small side menu. 🌶

RHSideButtons ?? Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app

Robert Herdzik 166 Nov 14, 2022
✨ Awesome Dropdown menu for iOS with Swift 5.0

The eligible dropdown menu for iOS, written in Swift 5, appears dropdown menu to display a view of related items when a user click on the dropdown menu. You can customize dropdown view whatever you like (e.g. UITableView, UICollectionView... etc)

Kyle Yi 1.3k Dec 26, 2022
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.

▤ SideMenu If you like SideMenu, give it a ★ at the top right of this page. SideMenu needs your help! If you're a skilled iOS developer and want to he

Jon Kent 5.4k Dec 29, 2022
Panels is a framework to easily add sliding panels to your application

Panels is a framework to easily add sliding panels to your application. It takes care of the safe area in new devices and moving your panel when the k

Antonio Casero 1.5k Dec 14, 2022
Animated side menu with customizable UI

Side Menu Animated side menu with customizable UI. Made in Yalantis. Check this project on dribbble. Check this project on Behance. Requirements iOS 7

Yalantis 2.7k Dec 27, 2022
Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift

Persei Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift! Made in Yalantis. Check this project on Dribbble Check th

Yalantis 3.4k Dec 14, 2022
A Slide Menu, written in Swift, inspired by Slide Menu Material Design

Swift-Slide-Menu (Material Design Inspired) A Slide Menu, written in Swift 2, inspired by Navigation Drawer on Material Design (inspired by Google Mat

Boisney Philippe 90 Oct 17, 2020
Slide-Menu - A Simple Slide Menu With Swift

Slide Menu!! Весь интерфейс создан через код

Kirill 0 Jan 8, 2022
EasyMenu - SwiftUI Menu but not only button (similar to the native Menu)

EasyMenu SwiftUI Menu but not only button (similar to the native Menu) You can c

null 10 Oct 7, 2022
Swift-sidebar-menu-example - Create amazing sidebar menu with animation using swift

 SWIFT SIDEBAR MENU EXAMPLE In this project I create a awesome side bar menu fo

Paolo Prodossimo Lopes 4 Jul 25, 2022
Hamburger Menu Button - A hamburger menu button with full customization

Hamburger Menu Button A hamburger menu button with full customization. Inspired by VinhLe's idea on the Dribble How to use it You can config the looks

Toan Nguyen 114 Jun 12, 2022
BottomSheet lets you add custom bottom sheets to your SwiftUI apps.

BottomSheet lets you add custom bottom sheets to your SwiftUI apps.

Daniel Saidi 174 Jan 2, 2023
Easily create dragabble menu with SwiftUI

SwiftUIDragMenu Easily create dragabble menu The gifs are not very good quality. Content is fluid. Sorry for this :( How to install this package Open

Mehmet ateş 1 Dec 5, 2022
A menu which can ... BOOM! - iOS

VHBoomMenuButton 2.0.0 Comes Finally After the version 2.0.0 has been published on Android platform, I started developing the new version for BMB on i

黄伟平 577 Nov 14, 2022