-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPAGlobalNavigationController.m
More file actions
132 lines (115 loc) · 3.99 KB
/
Copy pathPAGlobalNavigationController.m
File metadata and controls
132 lines (115 loc) · 3.99 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//
// PAGlobalNavigationController.m
// prayApp
//
// Created by Jeff Wang on 2/3/14.
// Copyright (c) 2014 Jeff Wang. All rights reserved.
//
#import "PAGlobalNavigationController.h"
#import <FacebookSDK/FacebookSDK.h>
#define kMenuWidth 260
@interface PAGlobalNavigationController ()
@end
@implementation PAGlobalNavigationController
@synthesize menuView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
isMenuRevealed = NO;
prayerGroupList = @[@"Canaan Church", @"Family", @"ACF"];
if (menuView == nil){
menuView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kMenuWidth, self.view.bounds.size.height)];
[self.view insertSubview:menuView atIndex:0];
}
menuTableView = [[UITableView alloc] initWithFrame:menuView.frame style:UITableViewStylePlain];
menuTableView.delegate = self;
menuTableView.dataSource = self;
menuTableView.backgroundColor = [UIColor darkGrayColor];
[menuTableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
[menuView addSubview:menuTableView];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)toggleMenu{
if (isMenuRevealed == NO){
[self slideRightToRevealMenu];
}
else{
[self slideLeftToHideMenu];
}
}
- (void)slideRightToRevealMenu{
if (isMenuRevealed == NO){
isMenuRevealed = YES;
[UIView animateWithDuration:0.35 animations:^{
for (UIView* view in self.view.subviews){
if (view != menuView){
CGRect frame = view.frame;
frame.origin.x += kMenuWidth;
view.frame = frame;
}
}
}];
}
}
- (void)slideLeftToHideMenu{
if (isMenuRevealed == YES){
isMenuRevealed = NO;
[UIView animateWithDuration:0.35 animations:^{
for (UIView* view in self.view.subviews){
if (view != menuView){
CGRect frame = view.frame;
frame.origin.x -= kMenuWidth;
view.frame = frame;
}
}
}];
}
}
#pragma TableViewDelegate
//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
//
//}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [prayerGroupList count];
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 100;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 100;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
UIView* footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kMenuWidth, 100)];
// FBProfilePictureView* profileView = [[FBProfilePictureView alloc] initWithProfileID:(NSString *) pictureCropping];
return footerView;
}
//
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView* headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kMenuWidth, 100)];
UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(5, 5 + 20, kMenuWidth, 20)];
label.text = @"My PrayerList";
[headerView addSubview:label];
return headerView;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
}
cell.textLabel.text = [prayerGroupList objectAtIndex:indexPath.row];
return cell;
}
@end