All Projects → lobianco → ALButtonMenu

lobianco / ALButtonMenu

Licence: MIT license
A simple, fully customizable menu solution for iOS.

Programming Languages

objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to ALButtonMenu

BDLocalizedDevicesModels
Apple devices model names localized.
Stars: ✭ 23 (-48.89%)
Mutual labels:  apple, iphone, ipad
Open Source Xamarin Apps
📱 Collaborative List of Open Source Xamarin Apps
Stars: ✭ 318 (+606.67%)
Mutual labels:  apple, iphone, ipad
Uicollectionviewsplitlayout
UICollectionViewSplitLayout makes collection view more responsive.
Stars: ✭ 226 (+402.22%)
Mutual labels:  uikit, iphone, ipad
Knphotobrowser
📷 图片 || 视频 浏览器(本地和网络) , UIViewController + CollectionView , 完美适配 iPhone 以及 iPad ,屏幕旋转功能 , 适配SDWebImage 5.0
Stars: ✭ 296 (+557.78%)
Mutual labels:  iphone, ipad, uiviewcontroller
Hackers
Hackers is an elegant iOS app for reading Hacker News written in Swift.
Stars: ✭ 513 (+1040%)
Mutual labels:  apple, iphone, ipad
Xhlaunchad
🔥The screen opening advertising solutions - 开屏广告、启动广告解决方案-支持静态/动态图片广告,mp4视频广告,全屏/半屏广告、兼容iPhone/iPad. 【 Github下载不了/下载慢 可以访问国内下载地址: https://gitee.com/CoderZhuXH/XHLaunchAd】
Stars: ✭ 3,578 (+7851.11%)
Mutual labels:  apple, iphone, ipad
ios code sign
iOS 签名简介
Stars: ✭ 23 (-48.89%)
Mutual labels:  apple, iphone, ipad
Apple Device Model List
All Apple devices model name list. 通过内部编号判断 iOS 设备型号。
Stars: ✭ 149 (+231.11%)
Mutual labels:  apple, iphone, ipad
BJOTPViewController
Entering OTP made simpler.
Stars: ✭ 42 (-6.67%)
Mutual labels:  uikit, iphone, ipad
Shortcutsdirectory
A collection of user-submitted shortcuts for Shortcuts for iOS.
Stars: ✭ 376 (+735.56%)
Mutual labels:  apple, iphone, ipad
Open Source Ios Apps
📱 Collaborative List of Open-Source iOS Apps
Stars: ✭ 28,826 (+63957.78%)
Mutual labels:  apple, iphone, ipad
Meme-Maker-iOS
Meme Maker open source iOS app made in Swift.
Stars: ✭ 59 (+31.11%)
Mutual labels:  apple, iphone, ipad
Shukofukurou-iOS
The Ultimate Open Source AniList, Kitsu, and MyAnimeList Tracker for iOS/iPadOS written in Objective-C
Stars: ✭ 29 (-35.56%)
Mutual labels:  iphone, ipad
SwiftyJot
Use your finger to annotate images.
Stars: ✭ 14 (-68.89%)
Mutual labels:  iphone, ipad
iOSShortcuts
A collection of shortcuts for the Shortcuts app.
Stars: ✭ 60 (+33.33%)
Mutual labels:  iphone, ipad
iPatch
Patch iPA Files With Dynamic Libraries
Stars: ✭ 29 (-35.56%)
Mutual labels:  iphone, ipad
SignTools-CI
Sign iOS apps on demand using CI. Part of: https://github.com/SignTools/SignTools
Stars: ✭ 145 (+222.22%)
Mutual labels:  iphone, ipad
YMTGetDeviceName
Get device name from model number
Stars: ✭ 27 (-40%)
Mutual labels:  iphone, ipad
KeyCommandAlertController
UIAlertController wrapper to add keyboard shortcuts easily
Stars: ✭ 16 (-64.44%)
Mutual labels:  uikit, ipad
TOFileSystemObserver
A bullet-proof mechanism for detecting any changes made to the contents of a folder in iOS and macOS.
Stars: ✭ 35 (-22.22%)
Mutual labels:  iphone, ipad

ALButtonMenu

ALButtomMenu is a fast, customizable, fully documented menu solution for iOS.

Preview

Preview1 Preview2

Installation

Installation is easy.

Cocoapods

  1. pod 'ALButtonMenu' in your Podfile
  2. #import <ALButtonMenu/ALButtonMenu.h> in your view of choice

Manually

  1. Download the .zip from Github and copy ALButtonMenu/Source directory to your project
  2. #import "ALButtonMenu.h" in your view of choice

Example Usage

Refer to the demo project for an interactive example, or just take a look at the code and comments below.

//
//  MyRootViewController.m
//

// this, or whatever init method you choose to use
- (instancetype)init 
{
    if ((self = [super init]) == NO)
    {
        return nil;
    }

    // the layout that we'll use for the menu view controller
    ALMenuViewControllerLayout layout;

    // the menu items will be displayed in a grid with this many columns. however, in landscape mode, 
    // this value will be used for the number of rows instead.
    //
    layout.columns = 2;

    // the spacing between menu items
    layout.itemSpacing = 15.f;

    // the size of the menu items
    layout.itemSize = CGSizeMake(100.f, 100.f);

    // can be an array of any number of items that inherit from ALButton or conform to the <ALMenuItem> protocol
    NSArray<UIView<ALMenuItem> *> *items = [self allMenuItems];

    // create the view model for the menu view controller
    ALMenuViewControllerViewModel *menuViewModel = [[ALMenuViewControllerViewModel alloc] initWithItems:items layout:layout];

    // tweak the default values. see ALMenuViewControllerViewModel.h for configurable properties
    menuViewModel.appearingAnimation = ALMenuViewControllerAppearingAnimationOrigin;

    // the menu view controller can be an instance of ALMenuViewController, or any class that conforms
    // to the <ALMenuViewController> protocol
    //
    ALMenuViewController *menuViewController = [[ALMenuViewController alloc] initWithViewModel:menuViewModel];

    // an instance of your view controller class
    MyViewController *viewController = [[MyViewController alloc] init];

    // create the view model for the navigation coordinator
    ALNavigationCoordinatorViewModel *navViewModel = [[ALNavigationCoordinatorViewModel alloc] init];

    // tweak the default values. see ALNavigationCoordinatorViewModel.h for configurable properties. 
    navViewModel.buttonCanBeRepositioned = YES;

    // create the navigation coordinator with the menu view controller and your app's root view controller. the 
    // root view controller can be an instance of UIViewController or UINavigationController
    //
    _navigationCoordinator = [[ALNavigationCoordinator alloc] initWithViewModel:navViewModel menuViewController:menuViewController rootViewController:rootViewController];

    // and be sure to assign yourself as the delegate. if you configure the navigation coordinator with a navigation
    // controller (instead of a root view controller), the coordinator will need to assign itself as that navigation 
    // controller's delegate, so you can optionally receive those delegate callbacks via this assignment. just 
    // implement the methods. 
    //
    _navigationCoordinator.delegate = self;

    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    // the navigation coordinator creates a navigation controller configured with the provided 
    // menu view controller and root view controller. we need to add that navigation controller
    // to the view heirarchy
    //
    UIViewController *childViewController = self.navigationCoordinator.navigationController;

    // then add it as a child view controller
    [self addChildViewController:childViewController];
    [self.view addSubview:childViewController.view];
    [childViewController didMoveToParentViewController:self];

    // then notify the navigation coordinator about our viewDidLoad event
    [self.navigationCoordinator viewDidLoad];
}

#pragma mark - ALNavigationCoordinatorDelegate

// be sure to implement the navigation coordinator's delegate method. it will fire when an item in the menu view controller is 
// tapped. return your specific UIViewController instance for that index. 
//
- (UIViewController *)navigationCoordinator:(ALNavigationCoordinator *)navigationCoordinator viewControllerForMenuItemAtIndex:(NSUInteger)index
{
    return [[MyViewController alloc] init];
}

#pragma mark - Status bar

// optionally, return the menu view controller in this method to hide the status bar when the menu is shown. 
- (UIViewController *)childViewControllerForStatusBarHidden
{
    return self.navigationCoordinator.menuViewController;
}

#pragma mark - Rotation

// be sure to alert the navigation coordinator about size change events.
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];

    [self.navigationCoordinator viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}

Contact Me

You can reach me anytime at the addresses below. If you use ALButtonMenu, feel free to give me a shoutout on Twitter to let me know how you like it. I'd love to hear your thoughts!

Github: lobianco
Email: [email protected]

Credits & License

ALButtonMenu is developed and maintained by Anthony Lobianco. Licensed under the MIT License. Basically, I would appreciate attribution if you use it.

Enjoy!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].