-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRightViewController.m
92 lines (65 loc) · 2.44 KB
/
RightViewController.m
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
//
// RightViewController.m
// WeiChi
//
// Created by imac on 15/9/9.
// Copyright (c) 2015年 imac. All rights reserved.
//
#import "RightViewController.h"
#import "ThemeButton.h"
#import "SendViewController.h"
#import "ThemeManager.h"
#import "MMDrawerController.h"
#import "UIViewController+MMDrawerController.h"
#import "BaseNavController.h"
@interface RightViewController ()
{
NSArray *_array;
}
@end
@implementation RightViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setBgImage];
self.view.backgroundColor = [UIColor clearColor];
[self _createButton];
}
-(void)_createButton{
_array = @[@"newbar_icon_1.png",@"newbar_icon_2.png",@"newbar_icon_3.png",@"newbar_icon_4.png",@"newbar_icon_5.png"];
// CGFloat height = (kScreenHeight -300)/5;
for (int i=1;i<=5;i++){
ThemeButton *button = [[ThemeButton alloc]initWithFrame: CGRectMake(20, 20+50*(i-1), 40, 40)];
[button setNormalImageName:_array[i-1]];
//NSString *imageName = [NSString stringWithFormat:@"newbar_icon_%d.png",i];
button.tag=i;
[button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
}
}
-(void)buttonAction:(UIButton *)button{
if (button.tag == 1) {
// 发送微博
[self.mm_drawerController toggleDrawerSide:MMDrawerSideRight animated:YES completion:^(BOOL finished) {
// 弹出发送微博控制器
SendViewController *senderVc = [[SendViewController alloc] init];
senderVc.title = @"发送微博";
// 创建导航控制器
BaseNavController *baseNav = [[BaseNavController alloc] initWithRootViewController:senderVc];
[self.mm_drawerController presentViewController:baseNav animated:YES completion:nil];
}];
}
}
- (void)setBgImage{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_loadImage) name:kThemeDidChangeNotificationName object:nil];
[self _loadImage];
}
- (void)_loadImage{
ThemeManager *manager = [ThemeManager shareInstance];
UIImage *img = [manager getThemeImage:@"bg_home.jpg"];
self.view.backgroundColor = [UIColor colorWithPatternImage:img];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end