forked from romaonthego/REMenu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRootViewController.m
More file actions
84 lines (68 loc) · 3.26 KB
/
RootViewController.m
File metadata and controls
84 lines (68 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// RootViewController.m
// REMenuExample
//
// Created by Roman Efimov on 2/20/13.
// Copyright (c) 2013 Roman Efimov. All rights reserved.
//
#import "RootViewController.h"
@implementation RootViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor colorWithWhite:0.902 alpha:1.000];
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0 green:179/255.0 blue:134/255.0 alpha:1];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStyleBordered target:self action:@selector(showMenu)];
}
- (void)showMenu
{
if (_menu.isOpen)
return [_menu close];
// Sample icons from http://icons8.com/download-free-icons-for-ios-tab-bar
//
REMenuItem *homeItem = [[REMenuItem alloc] initWithTitle:@"Home"
image:[UIImage imageNamed:@"Icon_Home"]
highlightedImage:nil
action:^(REMenuItem *item) {
NSLog(@"Item: %@", item);
}];
REMenuItem *exploreItem = [[REMenuItem alloc] initWithTitle:@"Explore"
image:[UIImage imageNamed:@"Icon_Explore"]
highlightedImage:nil
action:^(REMenuItem *item) {
NSLog(@"Item: %@", item);
}];
REMenuItem *activityItem = [[REMenuItem alloc] initWithTitle:@"Activity"
image:[UIImage imageNamed:@"Icon_Activity"]
highlightedImage:nil
action:^(REMenuItem *item) {
NSLog(@"Item: %@", item);
}];
REMenuItem *profileItem = [[REMenuItem alloc] initWithTitle:@"Profile"
image:[UIImage imageNamed:@"Icon_Profile"]
highlightedImage:nil
action:^(REMenuItem *item) {
NSLog(@"Item: %@", item);
}];
homeItem.tag = 0;
exploreItem.tag = 1;
activityItem.tag = 2;
profileItem.tag = 3;
_menu = [[REMenu alloc] initWithItems:@[homeItem, exploreItem, activityItem, profileItem]];
_menu.cornerRadius = 4;
_menu.shadowColor = [UIColor blackColor];
_menu.shadowOffset = CGSizeMake(0, 2);
_menu.shadowOpacity = 0.7;
[_menu showFromNavigationController:self.navigationController];
}
#pragma mark -
#pragma mark Rotation
- (BOOL)shouldAutorotate
{
return YES;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
}
@end