├── IMFiveApp.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ │ └── IMFiveApp.xccheckout
│ └── xcuserdata
│ │ ├── adansonia.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── chen.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── xcuserdata
│ ├── adansonia.xcuserdatad
│ └── xcschemes
│ │ ├── IMFiveApp.xcscheme
│ │ └── xcschememanagement.plist
│ └── chen.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ ├── IMFiveApp.xcscheme
│ └── xcschememanagement.plist
├── IMFiveApp
├── AppDelegate.h
├── AppDelegate.m
├── ContactsViewController.h
├── ContactsViewController.m
├── DynamicViewController.h
├── DynamicViewController.m
├── IMFiveApp-Info.plist
├── IMFiveApp-Prefix.pch
├── IMObject.h
├── IMObject.m
├── Images.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── LaunchImage.launchimage
│ │ └── Contents.json
├── LeftViewController.h
├── LeftViewController.m
├── MLBlackTransition
│ ├── MLBlackTransition.h
│ └── MLBlackTransition.m
├── MLTransition
│ ├── MLTransitionAnimation.h
│ ├── MLTransitionAnimation.m
│ ├── UIViewController+MLTransition.h
│ └── UIViewController+MLTransition.m
├── MainTabViewController.h
├── MainTabViewController.m
├── MessagesViewController.h
├── MessagesViewController.m
├── QHUtills
│ ├── QHCommonUtil.h
│ ├── QHCommonUtil.m
│ ├── QHConfiguredObj.h
│ ├── QHConfiguredObj.m
│ └── QHViewTag.h
├── RectViewForMessage.h
├── RectViewForMessage.m
├── SelectThemeCollectionViewCell.h
├── SelectThemeCollectionViewCell.m
├── SelectThemeViewController.h
├── SelectThemeViewController.m
├── SliderViewController
│ ├── SliderViewController.h
│ └── SliderViewController.m
├── ViewExtend
│ ├── QHBasicViewController.h
│ ├── QHBasicViewController.m
│ ├── UIView+KGViewExtend.h
│ └── UIView+KGViewExtend.m
├── ZipArchive
│ ├── ZipArchive.h
│ ├── ZipArchive.mm
│ └── minizip
│ │ ├── crypt.h
│ │ ├── ioapi.c
│ │ ├── ioapi.h
│ │ ├── mztools.c
│ │ ├── mztools.h
│ │ ├── unzip.c
│ │ ├── unzip.h
│ │ ├── zip.c
│ │ └── zip.h
├── en.lproj
│ └── InfoPlist.strings
├── main.m
└── resource
│ ├── Default
│ ├── aio_face_manage_cover_default@2x.png
│ ├── aio_icon_more@2x.png
│ ├── buddy_cell_nor@2x.png
│ ├── buddy_header_arrow@2x.png
│ ├── buddy_header_icon_addressBook@2x.png
│ ├── buddy_header_icon_discussGroup@2x.png
│ ├── buddy_header_icon_group@2x.png
│ ├── buddy_header_icon_public@2x.png
│ ├── buddy_header_icon_qq@2x.png
│ ├── buddy_header_icon_qzone@2x.png
│ ├── buddy_header_nor@2x.png
│ ├── buddy_header_press@2x.png
│ ├── buddy_list_seperator_bg@2x.png
│ ├── chat_bottom_smile_nor@2x.png
│ ├── chat_bottom_smile_press@2x.png
│ ├── common_green_checkbox@2x.png
│ ├── header_bg@2x.png
│ ├── header_bg_ios7@2x.png
│ ├── menu_bg_pressed@2x.png
│ ├── menu_icon_QR@2x.png
│ ├── menu_icon_bulb@2x.png
│ ├── menu_icon_bulb_pressed@2x.png
│ ├── menu_icon_c2c_shortcut@2x.png
│ ├── menu_icon_camera@2x.png
│ ├── menu_icon_chat@2x.png
│ ├── menu_icon_createDiscuss@2x.png
│ ├── menu_icon_group_shortcut@2x.png
│ ├── menu_icon_groupaudio@2x.png
│ ├── mulchat_header_icon_circle@2x.png
│ ├── mulchat_header_icon_discuss@2x.png
│ ├── mulchat_header_icon_group@2x.png
│ ├── offical_account_icon@2x.png
│ ├── qv_msg_bar_vip.png
│ ├── shortNoti_fail@2x.png
│ ├── sidebar_album@2x.png
│ ├── sidebar_bg@2x.jpg
│ ├── sidebar_bg_mask@2x.png
│ ├── sidebar_business@2x.png
│ ├── sidebar_decoration@2x.png
│ ├── sidebar_favorit@2x.png
│ ├── sidebar_file@2x.png
│ ├── sidebar_nightmode_loading@2x.png
│ ├── sidebar_nightmode_off@2x.png
│ ├── sidebar_nightmode_on@2x.png
│ ├── sidebar_purse@2x.png
│ ├── sidebar_setting@2x.png
│ ├── sidebar_signature_nor@2x.png
│ ├── sidebar_signature_other@2x.png
│ ├── svip_shadow@2x.png
│ ├── tab_buddy_nor@2x.png
│ ├── tab_buddy_press@2x.png
│ ├── tab_me_nor@2x.png
│ ├── tab_me_press@2x.png
│ ├── tab_qworld_nor@2x.png
│ ├── tab_qworld_press@2x.png
│ ├── tab_recent_nor@2x.png
│ ├── tab_recent_press@2x.png
│ ├── tabbar_bg@2x.png
│ ├── table_arrow@2x.png
│ ├── table_arrow_press@2x.png
│ ├── usersummary_icon_lv_moon@2x.png
│ ├── usersummary_icon_lv_star@2x.png
│ ├── usersummary_icon_lv_sun@2x.png
│ └── vip_shadow@2x.png
│ ├── theme_icon
│ ├── theme_icon@2x.png
│ ├── theme_icon_penguin@2x.png
│ ├── theme_icon_sea@2x.png
│ ├── theme_icon_universe@2x.png
│ └── theme_icon_yellowduck@2x.png
│ └── theme_zip
│ ├── com.skin.1098.zip
│ ├── com.skin.1108.zip
│ ├── com.skin.1110.zip
│ └── com.skin.1114.zip
├── IMFiveAppTests
├── IMFiveAppTests-Info.plist
├── IMFiveAppTests.m
└── en.lproj
│ └── InfoPlist.strings
├── README.md
└── screenshots
└── IMFiveAppGif.gif
/IMFiveApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/IMFiveApp.xcodeproj/project.xcworkspace/xcshareddata/IMFiveApp.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | 30D296E7-9DBE-41A1-B5F7-BECEF8A82978
9 | IDESourceControlProjectName
10 | IMFiveApp
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 31A8805725E7AF5943661D01783D061C2B974AC9
14 | https://github.com/bigday/IMFiveApp.git
15 |
16 | IDESourceControlProjectPath
17 | IMFiveApp.xcodeproj
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 31A8805725E7AF5943661D01783D061C2B974AC9
21 | ../..
22 |
23 | IDESourceControlProjectURL
24 | https://github.com/bigday/IMFiveApp.git
25 | IDESourceControlProjectVersion
26 | 111
27 | IDESourceControlProjectWCCIdentifier
28 | 31A8805725E7AF5943661D01783D061C2B974AC9
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 31A8805725E7AF5943661D01783D061C2B974AC9
36 | IDESourceControlWCCName
37 | IMFiveApp
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/IMFiveApp.xcodeproj/project.xcworkspace/xcuserdata/adansonia.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp.xcodeproj/project.xcworkspace/xcuserdata/adansonia.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/IMFiveApp.xcodeproj/project.xcworkspace/xcuserdata/chen.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp.xcodeproj/project.xcworkspace/xcuserdata/chen.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/IMFiveApp.xcodeproj/xcuserdata/adansonia.xcuserdatad/xcschemes/IMFiveApp.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
94 |
100 |
101 |
102 |
103 |
105 |
106 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/IMFiveApp.xcodeproj/xcuserdata/adansonia.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | IMFiveApp.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 7430603619A44EEB00D3625F
16 |
17 | primary
18 |
19 |
20 | 7430605119A44EEB00D3625F
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/IMFiveApp.xcodeproj/xcuserdata/chen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/IMFiveApp.xcodeproj/xcuserdata/chen.xcuserdatad/xcschemes/IMFiveApp.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/IMFiveApp.xcodeproj/xcuserdata/chen.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | IMFiveApp.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 7430603619A44EEB00D3625F
16 |
17 | primary
18 |
19 |
20 | 7430605119A44EEB00D3625F
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/IMFiveApp/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // IMFiveApp
4 | //
5 | // Created by chen on 14-8-20.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/IMFiveApp/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // IMFiveApp
4 | //
5 | // Created by chen on 14-8-20.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | #import "SliderViewController.h"
12 | #import "LeftViewController.h"
13 | #import "MainTabViewController.h"
14 | #import "MLBlackTransition.h"
15 |
16 | @implementation AppDelegate
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
19 | {
20 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
21 | // Override point for customization after application launch.
22 | self.window.backgroundColor = [UIColor whiteColor];
23 |
24 | LeftViewController *leftVC = [[LeftViewController alloc] init];
25 | [SliderViewController sharedSliderController].LeftVC = leftVC;
26 | [SliderViewController sharedSliderController].MainVC = [[MainTabViewController alloc] init];
27 | [SliderViewController sharedSliderController].LeftSContentOffset=275;
28 | [SliderViewController sharedSliderController].LeftContentViewSContentOffset = 90;
29 | [SliderViewController sharedSliderController].LeftSContentScale=0.77;
30 | [SliderViewController sharedSliderController].LeftSJudgeOffset=160;
31 | [SliderViewController sharedSliderController].changeLeftView = ^(CGFloat sca, CGFloat transX)
32 | {
33 | // leftVC.contentView.layer.anchorPoint = CGPointMake(1, 1);
34 | CGAffineTransform ltransS = CGAffineTransformMakeScale(sca, sca);
35 | CGAffineTransform ltransT = CGAffineTransformMakeTranslation(transX, 0);
36 | CGAffineTransform lconT = CGAffineTransformConcat(ltransT, ltransS);
37 | leftVC.contentView.transform = lconT;
38 | };
39 |
40 | // [UIViewController validatePanPackWithMLTransitionGestureRecognizerType:MLTransitionGestureRecognizerTypePan];
41 | //手势返回更新为MLBlackTransition
42 | [MLBlackTransition validatePanPackWithMLBlackTransitionGestureRecognizerType:MLBlackTransitionGestureRecognizerTypePan];
43 |
44 | UINavigationController *naviC = [[UINavigationController alloc] initWithRootViewController:[SliderViewController sharedSliderController]];
45 |
46 | self.window.rootViewController = naviC;
47 |
48 | [self.window makeKeyAndVisible];
49 | return YES;
50 | }
51 |
52 | - (void)applicationWillResignActive:(UIApplication *)application
53 | {
54 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
55 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
56 | }
57 |
58 | - (void)applicationDidEnterBackground:(UIApplication *)application
59 | {
60 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
61 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
62 | }
63 |
64 | - (void)applicationWillEnterForeground:(UIApplication *)application
65 | {
66 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
67 | }
68 |
69 | - (void)applicationDidBecomeActive:(UIApplication *)application
70 | {
71 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
72 | }
73 |
74 | - (void)applicationWillTerminate:(UIApplication *)application
75 | {
76 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
77 | }
78 |
79 | @end
80 |
--------------------------------------------------------------------------------
/IMFiveApp/ContactsViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ContactsViewController.h
3 | // IMApp
4 | //
5 | // Created by chen on 14/7/20.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 | @interface ContactsViewController : QHBasicViewController
9 |
10 | @end
11 |
--------------------------------------------------------------------------------
/IMFiveApp/ContactsViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ContactsViewController.m
3 | // IMApp
4 | //
5 | // Created by chen on 14/7/20.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "ContactsViewController.h"
10 |
11 | #import "MainTabViewController.h"
12 |
13 | #import "RectViewForMessage.h"
14 |
15 | @interface ContactsViewController ()
16 | {
17 | UISegmentedControl *_selectTypeSegment;
18 | UITableView *_tableV;
19 |
20 | NSMutableArray *_arData;
21 | NSArray *_arKey;
22 | NSMutableDictionary *_dicData;
23 | NSMutableDictionary *_dicShowRow;
24 |
25 | UIView *_tableHeaderV;
26 | UISearchBar *_searchB;
27 | UISearchDisplayController *_searchDisplayC;
28 |
29 | NSArray *_arMenuData;
30 | RectViewForMessage *_menuV;
31 | }
32 |
33 | @end
34 |
35 | @implementation ContactsViewController
36 |
37 | - (void)viewDidLoad
38 | {
39 | [super viewDidLoad];
40 |
41 | [self addObserver];
42 |
43 | [self createNavWithTitle:@"联系人" createMenuItem:^UIView *(int nIndex)
44 | {
45 | if (nIndex == 1)
46 | {
47 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
48 | // UIImage *i = [UIImage imageNamed:@"group_right_btn.png"];
49 | // [btn setImage:i forState:UIControlStateNormal];
50 | // [btn setFrame:CGRectMake(self.navView.width - i.size.width - 10, (self.navView.height - i.size.height)/2, i.size.width, i.size.height)];
51 | [btn setFrame:CGRectMake(self.navView.width - 60, (self.navView.height - 40)/2, 60, 40)];
52 | [btn setTitle:@"添加" forState:UIControlStateNormal];
53 | [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
54 |
55 | return btn;
56 | }
57 | return nil;
58 | }];
59 |
60 | // _selectTypeSegment = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"分组", @"全部", nil]];
61 | // [_selectTypeSegment setFrame:CGRectMake((CGRectGetWidth(self.view.frame) - 120)/2, 8, 120, 28)];
62 | // [_selectTypeSegment setSelectedSegmentIndex:0];
63 | // [self.navView addSubview:_selectTypeSegment];
64 |
65 | _searchB = [[UISearchBar alloc] initWithFrame:CGRectMake(0, self.navView.bottom, self.view.width, 44)];
66 | [_searchB setPlaceholder:@"搜索"];
67 | [_searchB setSearchBarStyle:UISearchBarStyleDefault];
68 |
69 | _searchDisplayC = [[UISearchDisplayController alloc] initWithSearchBar:_searchB contentsController:self];
70 | _searchDisplayC.active = NO;
71 | _searchDisplayC.delegate = self;
72 | _searchDisplayC.searchResultsDataSource =self;
73 | _searchDisplayC.searchResultsDelegate =self;
74 | [self.view addSubview:_searchDisplayC.searchBar];
75 |
76 | _tableHeaderV = [[UIView alloc] initWithFrame:CGRectMake(0, _searchB.bottom, self.view.width, 106)];
77 | [_tableHeaderV setBackgroundColor:[UIColor whiteColor]];
78 |
79 | UIView *titleV = [[UIView alloc] initWithFrame:CGRectMake(0, _tableHeaderV.height - 25, self.view.width, 25)];
80 | [titleV setBackgroundColor:RGBA(235, 235, 235, 1)];
81 | UILabel *titleL = [[UILabel alloc] initWithFrame:titleV.bounds];
82 | [titleL setBackgroundColor:[UIColor clearColor]];
83 | [titleL setText:@" 好友分组"];
84 | [titleL setFont:[UIFont systemFontOfSize:13]];
85 | [titleV addSubview:titleL];
86 | [_tableHeaderV addSubview:titleV];
87 |
88 | _arMenuData = @[@[@"人脉圈", @"mulchat_header_icon_circle.png"],
89 | @[@"通讯录", @"buddy_header_icon_addressBook.png"],
90 | @[@"群组", @"buddy_header_icon_group.png"],
91 | @[@"生活服务", @"buddy_header_icon_public.png"]];
92 | _menuV = [[RectViewForMessage alloc] initWithFrame:CGRectMake(0, 0, _tableHeaderV.width, _tableHeaderV.height - titleV.height) ar:_arMenuData showSpera:NO bg:@"buddy_header_nor.png"];
93 | [_tableHeaderV addSubview:_menuV];
94 |
95 | _tableV = [[UITableView alloc] initWithFrame:CGRectMake(0, _searchB.bottom, self.view.width, self.view.height - _searchB.bottom - self.tabBarController.tabBar.height) style:UITableViewStylePlain];
96 | _tableV.dataSource = self;
97 | _tableV.delegate = self;
98 | [_tableV setBackgroundColor:[UIColor clearColor]];
99 | [self.view addSubview:_tableV];
100 |
101 | _tableV.tableHeaderView = _tableHeaderV;
102 |
103 | [self initData];
104 | }
105 |
106 | - (void)initData
107 | {
108 | __async_opt__, ^
109 | {
110 | _arKey = @[@"我的设备", @"朋友", @"兄弟", @"家人", @"同学", @"同事", @"长辈", @"兼职", @"陌生人", @"黑名单"];
111 | _dicData = [NSMutableDictionary new];
112 | _dicShowRow = [NSMutableDictionary new];
113 |
114 | [_arKey enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop)
115 | {
116 | NSMutableArray *ar = [NSMutableArray new];
117 | // srand((unsigned)time(0)); //不加这句每次产生的随机数不变
118 | int c = rand() % 10 + 1;
119 | // int c = arc4random() % 10 + 1;
120 | for (int i = 1; i < c; i++)
121 | {
122 | [ar addObject:[NSString stringWithFormat:@"%d", i]];
123 | }
124 | [_dicData setObject:ar forKey:obj];
125 | [_dicShowRow setObject:[NSNumber numberWithBool:NO] forKey:obj];
126 | }];
127 |
128 | __async_main__, ^
129 | {
130 | [_tableV reloadData];
131 | });
132 | });
133 | }
134 |
135 | #pragma mark - action
136 |
137 | - (void)showRow:(UIButton *)btn
138 | {
139 | NSString *key = [_arKey objectAtIndex:(btn.tag - 1)];
140 | BOOL b = [[_dicShowRow objectForKey:key] boolValue];
141 | [_dicShowRow setObject:[NSNumber numberWithBool:!b] forKey:key];
142 | [_tableV reloadSections:[NSIndexSet indexSetWithIndex:(btn.tag - 1)] withRowAnimation:UITableViewRowAnimationNone];
143 | }
144 |
145 | #pragma mark - UITableViewDataSource
146 |
147 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
148 | {
149 | if (tableView == _searchDisplayC.searchResultsTableView)
150 | {
151 | return 0;
152 | }
153 | return [_arKey count];
154 | }
155 |
156 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
157 | {
158 | if (tableView == _searchDisplayC.searchResultsTableView)
159 | {
160 | return 0;
161 | }
162 | NSString *key = [_arKey objectAtIndex:section];
163 | BOOL bShowRow = [[_dicShowRow objectForKey:key] boolValue];
164 | if (bShowRow)
165 | {
166 | return [[_dicData objectForKey:[_arKey objectAtIndex:section]] count];
167 | }
168 | return 0;
169 | }
170 |
171 | //- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
172 | //{
173 | // return [_arKey objectAtIndex:section];
174 | //}
175 |
176 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
177 | {
178 | NSString *reuseIdentifier = @"cell";
179 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
180 | if (!cell)
181 | {
182 | int w = tableView.width/6;
183 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
184 |
185 | UIImage *i = [UIImage imageNamed:@"aio_face_manage_cover_default.png"];
186 | UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(10, (50 - w + 15)/2, w - 15, w - 15)];
187 | iv.layer.masksToBounds = YES;
188 | iv.layer.cornerRadius = 6.0;
189 | iv.layer.borderWidth = 1.0;
190 | iv.layer.borderColor = [[UIColor whiteColor] CGColor];
191 | [iv setImage:i];
192 | iv.tag = 1;
193 | [cell.contentView addSubview:iv];
194 |
195 | UILabel *nameL = [[UILabel alloc] initWithFrame:CGRectMake(w + 5, 0, w*4 - 5, 30)];
196 | [nameL setBackgroundColor:[UIColor clearColor]];
197 | [nameL setTextAlignment:NSTextAlignmentNatural];
198 | [nameL setFont:[UIFont systemFontOfSize:18]];
199 | nameL.tag = 2;
200 | [cell.contentView addSubview:nameL];
201 |
202 | UILabel *stateL = [[UILabel alloc] initWithFrame:CGRectMake(w + 5, 25, w*4 - 5, 20)];
203 | [stateL setBackgroundColor:[UIColor clearColor]];
204 | [stateL setFont:[UIFont systemFontOfSize:12]];
205 | [stateL setTextColor:[UIColor grayColor]];
206 | stateL.tag = 3;
207 | [stateL setText:@"[离线]这家伙很吊,什么也没有留下"];
208 | [cell.contentView addSubview:stateL];
209 | }
210 | NSString *key = [_arKey objectAtIndex:[indexPath section]];
211 | BOOL bShowRow = [[_dicShowRow objectForKey:key] boolValue];
212 | if (bShowRow)
213 | ((UILabel *)[cell.contentView viewWithTag:2]).text = [[_dicData objectForKey:key] objectAtIndex:indexPath.row];
214 |
215 | return cell;
216 | }
217 |
218 | #pragma mark - UITableViewDelegate
219 |
220 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
221 | {
222 | return 50;
223 | }
224 |
225 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
226 | {
227 | return 44;
228 | }
229 |
230 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
231 | {
232 | int w = tableView.width/7;
233 | UIView *headV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.width, 44)];
234 | [headV setBackgroundColor:[UIColor whiteColor]];
235 |
236 | NSString *key = [_arKey objectAtIndex:section];
237 | BOOL bShowRow = [[_dicShowRow objectForKey:key] boolValue];
238 |
239 | UIImage *i = [QHCommonUtil imageNamed:@"buddy_header_arrow.png"];
240 | UIImageView *arrowIV = [[UIImageView alloc] initWithFrame:CGRectMake((w - i.size.width)/2, (44 - i.size.height)/2, i.size.width, i.size.height)];
241 | [arrowIV setImage:i];
242 | [headV addSubview:arrowIV];
243 | if (bShowRow)
244 | arrowIV.transform = CGAffineTransformMakeRotation(M_PI_2);
245 |
246 | UILabel *titleL = [[UILabel alloc] initWithFrame:CGRectMake(w, 2, w * 4, 40)];
247 | [titleL setText:[_arKey objectAtIndex:section]];
248 | [titleL setFont:[UIFont systemFontOfSize:16]];
249 | [titleL setUserInteractionEnabled:NO];
250 | [headV addSubview:titleL];
251 |
252 | UIView *lineHV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.width, 0.5)];
253 | [lineHV setBackgroundColor:[UIColor grayColor]];
254 | [headV addSubview:lineHV];
255 |
256 | if (bShowRow)
257 | {
258 | UIView *lineBV = [[UIView alloc] initWithFrame:CGRectMake(0, 44 - 0.5, tableView.width, 0.5)];
259 | [lineBV setBackgroundColor:[UIColor grayColor]];
260 | [headV addSubview:lineBV];
261 | }
262 |
263 | UILabel *sumL = [[UILabel alloc] initWithFrame:CGRectMake(w * 5, 2, w * 2 - 5, 40)];
264 | [sumL setTextColor:[UIColor grayColor]];
265 | [sumL setText:[NSString stringWithFormat:@"%d/%d", 0, [[_dicData objectForKey:[_arKey objectAtIndex:section]] count]]];
266 | [sumL setTextAlignment:NSTextAlignmentRight];
267 | [sumL setFont:[UIFont systemFontOfSize:14]];
268 | [sumL setUserInteractionEnabled:NO];
269 | [headV addSubview:sumL];
270 |
271 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
272 | [btn setFrame:headV.bounds];
273 | btn.tag = section + 1;
274 | [headV addSubview:btn];
275 | [btn addTarget:self action:@selector(showRow:) forControlEvents:UIControlEventTouchUpInside];
276 |
277 | return headV;
278 | }
279 |
280 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
281 | {
282 | [tableView deselectRowAtIndexPath:indexPath animated:YES];
283 | }
284 |
285 | #pragma mark - UISearchDisplayDelegate
286 |
287 | - (void) searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller
288 | {
289 | [UIView animateWithDuration:0.2 animations:^
290 | {
291 | self.navView.top -= 64;
292 | _searchB.top -= 44;
293 | _tableV.top -= 44;
294 | }completion:^(BOOL finished)
295 | {
296 | [self.navView setHidden:YES];
297 | _tableV.height += 44;
298 | }];
299 |
300 | controller.searchBar.showsCancelButton = YES;
301 | for(UIView *subView in [[controller.searchBar.subviews objectAtIndex:0] subviews])
302 | {
303 | if([subView isKindOfClass:UIButton.class])
304 | {
305 | [(UIButton*)subView setTitle:@"取消" forState:UIControlStateNormal];
306 | }
307 | }
308 | }
309 |
310 | - (void) searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller
311 | {
312 | [self.navView setHidden:NO];
313 | [UIView animateWithDuration:0.2 animations:^
314 | {
315 | self.navView.top += 64;
316 | _searchB.top += 44;
317 | _tableV.top += 44;
318 | }completion:^(BOOL finished)
319 | {
320 | _tableV.height -= 44;
321 | }];
322 | }
323 |
324 | - (void)reloadImage
325 | {
326 | [super reloadImage];
327 |
328 | [_menuV reloadMenuImage];
329 | [_tableV reloadData];
330 | }
331 |
332 | @end
333 |
--------------------------------------------------------------------------------
/IMFiveApp/DynamicViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // DynamicViewController.h
3 | // IMApp
4 | //
5 | // Created by chen on 14-7-21.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 | @interface DynamicViewController : QHBasicViewController
9 |
10 | @end
11 |
--------------------------------------------------------------------------------
/IMFiveApp/DynamicViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // DynamicViewController.m
3 | // IMApp
4 | //
5 | // Created by chen on 14-7-21.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "DynamicViewController.h"
10 |
11 | @interface DynamicViewController ()
12 | {
13 | UITableView *_tableV;
14 | NSMutableArray *_arData;
15 | }
16 |
17 | @end
18 |
19 | @implementation DynamicViewController
20 |
21 | - (void)viewDidLoad
22 | {
23 | [super viewDidLoad];
24 |
25 | [self addObserver];
26 |
27 | [self createNavWithTitle:@"动态" createMenuItem:^UIView *(int nIndex)
28 | {
29 | return nil;
30 | }];
31 |
32 | _tableV = [[UITableView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.navView.frame), CGRectGetWidth(self.view.frame), self.view.height - self.navView.bottom - self.tabBarController.tabBar.height) style:UITableViewStyleGrouped];
33 | _tableV.dataSource = self;
34 | _tableV.delegate = self;
35 | [self.view addSubview:_tableV];
36 |
37 | [self initData];
38 | }
39 |
40 | - (void)initData
41 | {
42 | __async_opt__, ^
43 | {
44 | _arData = [NSMutableArray new];
45 |
46 | NSArray *ar1 = @[@"好友动态"];
47 | NSArray *ar2 = @[@"游戏", @"福利", @"阅读"];
48 | NSArray *ar3 = @[@"文件/照片 助手", @"吃喝玩乐", @"扫一扫", @"热门活动", @"腾讯新闻"];
49 | NSArray *ar4 = @[@"附近的人", @"附近的群", @"兴趣部落"];
50 |
51 | [_arData addObject:ar1];
52 | [_arData addObject:ar2];
53 | [_arData addObject:ar3];
54 | [_arData addObject:ar4];
55 |
56 | __async_main__, ^
57 | {
58 | [_tableV reloadData];
59 | });
60 | });
61 | }
62 |
63 | #pragma mark - action
64 |
65 | #pragma mark - UITableViewDataSource
66 |
67 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
68 | {
69 | return [_arData count];
70 | }
71 |
72 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
73 | {
74 | return [[_arData objectAtIndex:section] count];
75 | }
76 |
77 | //- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
78 | //{
79 | // return [_arKey objectAtIndex:section];
80 | //}
81 |
82 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
83 | {
84 | NSString *reuseIdentifier = @"cell";
85 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
86 | if (!cell)
87 | {
88 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
89 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
90 | }
91 | cell.textLabel.text = [[_arData objectAtIndex:[indexPath section]] objectAtIndex:indexPath.row];
92 |
93 | return cell;
94 | }
95 |
96 | #pragma mark - UITableViewDelegate
97 |
98 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
99 | {
100 | return 45;
101 | }
102 |
103 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
104 | {
105 | if (section == 0)
106 | {
107 | return 19;
108 | }
109 | return 18;
110 | }
111 |
112 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
113 | {
114 | return 1;
115 | }
116 |
117 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
118 | {
119 | [tableView deselectRowAtIndexPath:indexPath animated:YES];
120 | }
121 |
122 | @end
123 |
--------------------------------------------------------------------------------
/IMFiveApp/IMFiveApp-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | com.chen.${PRODUCT_NAME:rfc1034identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | LSRequiresIPhoneOS
26 |
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/IMFiveApp/IMFiveApp-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #import
8 |
9 | #ifndef __IPHONE_3_0
10 | #warning "This project uses features only available in iOS SDK 3.0 and later."
11 | #endif
12 |
13 | #ifdef __OBJC__
14 | #import
15 | #import
16 |
17 | #import "UIView+KGViewExtend.h"
18 | #import "QHViewTag.h"
19 | #import "QHCommonUtil.h"
20 | #import "MLTransitionAnimation.h"
21 | #import "UIViewController+MLTransition.h"
22 |
23 | #import "QHBasicViewController.h"
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/IMFiveApp/IMObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // IMObject.h
3 | // IMFiveApp
4 | //
5 | // Created by chen on 14-8-29.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface IMObject : NSObject
12 |
13 | @property (nonatomic, assign) int nTheme;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/IMFiveApp/IMObject.m:
--------------------------------------------------------------------------------
1 | //
2 | // IMObject.m
3 | // IMFiveApp
4 | //
5 | // Created by chen on 14-8-29.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "IMObject.h"
10 |
11 | @implementation IMObject
12 |
13 | - (id)init
14 | {
15 | self = [super init];
16 |
17 | _nTheme = 0;
18 |
19 | return self;
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/IMFiveApp/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "40x40",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "60x60",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/IMFiveApp/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "orientation" : "portrait",
12 | "idiom" : "iphone",
13 | "subtype" : "retina4",
14 | "extent" : "full-screen",
15 | "minimum-system-version" : "7.0",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/IMFiveApp/LeftViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LeftViewController.h
3 | // WYApp
4 | //
5 | // Created by chen on 14-7-17.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LeftViewController : QHBasicViewController
12 |
13 | @property (nonatomic, retain) UIView *contentView;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/IMFiveApp/LeftViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // LeftViewController.m
3 | // WYApp
4 | //
5 | // Created by chen on 14-7-17.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "LeftViewController.h"
10 |
11 | #import "SliderViewController.h"
12 | #import "SelectThemeViewController.h"
13 |
14 | @interface LeftViewController ()
15 | {
16 | NSArray *_arData;
17 | NSDictionary *_dicData;
18 | UITableView *_tableView;
19 | }
20 |
21 | @property (nonatomic, strong) UIImageView *headerIV;
22 |
23 | @end
24 |
25 | @implementation LeftViewController
26 |
27 | - (void)dealloc {
28 | _arData = nil;
29 | _dicData = nil;
30 | _tableView = nil;
31 | self.headerIV = nil;
32 | }
33 |
34 | - (void)viewDidLoad
35 | {
36 | [super viewDidLoad];
37 |
38 | [self addObserver];
39 |
40 | _arData = @[@[@"开通会员", @"vip_shadow.png"],
41 | @[@"QQ钱包", @"sidebar_purse.png"],
42 | @[@"网上营业厅", @"sidebar_business.png"],
43 | @[@"个性装饰", @"sidebar_decoration.png"],
44 | @[@"我的收藏", @"sidebar_favorit.png"],
45 | @[@"我的相册", @"sidebar_album.png"],
46 | @[@"我的文件", @"sidebar_file.png"]];
47 |
48 | [self.view setBackgroundColor:[UIColor clearColor]];
49 |
50 | float hHeight = 90;
51 | UIImageView *imageBgV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height/4 + 10)];
52 | imageBgV.tag = 18;
53 | [self.view addSubview:imageBgV];
54 |
55 | hHeight = imageBgV.bottom - 80;
56 | UIImageView *imageBgV2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, hHeight, self.view.width, self.view.height - hHeight)];
57 | imageBgV2.tag = 19;
58 | [imageBgV2 setBackgroundColor:[UIColor clearColor]];
59 | [self.view addSubview:imageBgV2];
60 |
61 | _contentView = [[UIView alloc] initWithFrame:self.view.bounds];
62 | _contentView.backgroundColor = [UIColor clearColor];
63 | [self.view addSubview:_contentView];
64 | // NSLog(@"%f", _contentView.layer.anchorPoint.x);
65 |
66 | self.headerIV = [[UIImageView alloc] initWithFrame:CGRectMake(25, 60, 70, 70)];
67 | self.headerIV.layer.cornerRadius = self.headerIV.width/2;
68 | self.headerIV.tag = 20;
69 | self.headerIV.userInteractionEnabled = YES;
70 | self.headerIV.clipsToBounds = YES;
71 | [_contentView addSubview:self.headerIV];
72 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(takePhoto)];
73 | [self.headerIV addGestureRecognizer:tap];
74 |
75 | _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, imageBgV.bottom + 10, self.view.width, self.view.height - imageBgV.bottom - 80) style:UITableViewStylePlain];
76 | _tableView.dataSource = self;
77 | _tableView.delegate = self;
78 | [_tableView setBackgroundColor:[UIColor clearColor]];
79 | _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
80 | [_contentView addSubview:_tableView];
81 |
82 | [self reloadImage];
83 | }
84 |
85 | - (void)backAction:(UIButton *)btn
86 | {
87 | [[SliderViewController sharedSliderController] closeSideBar];
88 | }
89 |
90 | - (void)toNewViewbtn:(UIButton *)btn
91 | {
92 | [[SliderViewController sharedSliderController] closeSideBarWithAnimate:YES complete:^(BOOL finished)
93 | {
94 | }];
95 | }
96 |
97 | #pragma mark - UITableViewDataSource
98 |
99 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
100 | {
101 | return [_arData count];
102 | }
103 |
104 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
105 | {
106 | NSString *reuseIdetify = @"left";
107 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdetify];;
108 |
109 | if (cell == nil)
110 | {
111 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdetify];
112 | [cell setBackgroundColor:[UIColor clearColor]];
113 | [cell.textLabel setTextColor:[UIColor whiteColor]];
114 | [cell setSelectionStyle:UITableViewCellSelectionStyleBlue];
115 | }
116 |
117 | NSArray *ar = [_arData objectAtIndex:indexPath.row];
118 | cell.imageView.image = [QHCommonUtil imageNamed:[ar objectAtIndex:1]];
119 | cell.textLabel.text = [ar objectAtIndex:0];
120 |
121 | return cell;
122 | }
123 |
124 | #pragma mark - UITableViewDelegate
125 |
126 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
127 | {
128 | return 47;
129 | }
130 |
131 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
132 | {
133 | [tableView deselectRowAtIndexPath:indexPath animated:YES];
134 |
135 | switch (indexPath.row)
136 | {
137 | case 3:
138 | {
139 | SelectThemeViewController *themeVC = [[SelectThemeViewController alloc] init];
140 | [[SliderViewController sharedSliderController] closeSideBarWithAnimate:YES complete:^(BOOL finished)
141 | {
142 | [[SliderViewController sharedSliderController].navigationController pushViewController:themeVC animated:YES];
143 | }];
144 | break;
145 | }
146 | default:
147 | [self backAction:nil];
148 | break;
149 | }
150 | }
151 |
152 | #pragma mark - super
153 |
154 | - (void)reloadImage
155 | {
156 | [super reloadImage];
157 |
158 | UIImageView *imageBgV = (UIImageView *)[self.view viewWithTag:18];
159 | UIImage *image = [QHCommonUtil imageNamed:@"sidebar_bg.jpg"];
160 | [imageBgV setImage:image];
161 |
162 | UIImageView *imageBgV2 = (UIImageView *)[self.view viewWithTag:19];
163 | UIImage *image2 = [QHCommonUtil imageNamed:@"sidebar_bg_mask.png"];
164 | [imageBgV2 setImage:[image2 resizableImageWithCapInsets:UIEdgeInsetsMake(image2.size.height - 1, 0, 1, 0)]];
165 |
166 | UIImageView *headerIV = (UIImageView *)[self.view viewWithTag:20];
167 | UIImage *headerI = [QHCommonUtil imageNamed:@"chat_bottom_smile_nor.png"];
168 | [headerIV setImage:headerI];
169 |
170 | [_tableView reloadData];
171 | }
172 |
173 | - (void)reloadImage:(NSNotificationCenter *)notif
174 | {
175 | [self reloadImage];
176 | }
177 |
178 | #pragma mark - UIImagePickerControllerDelegate
179 | //后期异步处理
180 | - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
181 | UIImage *imageO = [info objectForKey:UIImagePickerControllerOriginalImage];
182 | self.headerIV.image = imageO;
183 | [self.navigationController dismissViewControllerAnimated:YES completion:^{}];
184 | }
185 |
186 | #pragma mark - Photo
187 |
188 | // 相册是否可用
189 | - (BOOL)isPhotoAvailable:(UIImagePickerControllerSourceType)type {
190 | return [UIImagePickerController isSourceTypeAvailable:type];
191 | }
192 |
193 | - (void)showPhoto:(UIImagePickerControllerSourceType)type viewcontroller:(UIViewController *)vc {
194 | if ([self isPhotoAvailable:type]) {
195 | UIImagePickerController *controller = [[UIImagePickerController alloc] init];
196 | [controller setSourceType:type];
197 | [controller setDelegate:(id)vc];
198 | [vc.navigationController presentViewController:controller animated:YES completion:^{}];
199 | }else {
200 | UIAlertView* alert = [[UIAlertView alloc] initWithTitle:UIImagePickerControllerSourceTypePhotoLibrary?@"相册":@"相机" message:@"不支持" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
201 | [alert show];
202 | }
203 | }
204 |
205 | #pragma mark - Action
206 |
207 | - (void)showPhotoLibrary:(UIViewController *)vc {
208 | [self showPhoto:UIImagePickerControllerSourceTypePhotoLibrary viewcontroller:vc];
209 | }
210 |
211 | - (void)takePhoto:(UIViewController *)vc {
212 | [self showPhoto:UIImagePickerControllerSourceTypeCamera viewcontroller:vc];
213 | }
214 |
215 | - (void)takePhoto {
216 | [self takePhoto:self];
217 | }
218 |
219 | @end
220 |
--------------------------------------------------------------------------------
/IMFiveApp/MLBlackTransition/MLBlackTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // MLBlackTransition.h
3 | // MLBlackTransition
4 | //
5 | // Created by molon on 7/8/14.
6 | // Copyright (c) 2014 molon. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef enum {
12 | MLBlackTransitionGestureRecognizerTypePan, //拖动模式
13 | MLBlackTransitionGestureRecognizerTypeScreenEdgePan, //边界拖动模式
14 | } MLBlackTransitionGestureRecognizerType;
15 |
16 | @interface MLBlackTransition : NSObject
17 |
18 | + (void)validatePanPackWithMLBlackTransitionGestureRecognizerType:(MLBlackTransitionGestureRecognizerType)type;
19 |
20 | @end
21 |
22 | @interface UIView(__MLBlackTransition)
23 |
24 | //使得此view不响应拖返
25 | @property (nonatomic, assign) BOOL disableMLBlackTransition;
26 |
27 | @end
28 |
29 | @interface UINavigationController(DisableMLBlackTransition)
30 |
31 | - (void)enabledMLBlackTransition:(BOOL)enabled;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/IMFiveApp/MLBlackTransition/MLBlackTransition.m:
--------------------------------------------------------------------------------
1 | //
2 | // MLBlackTransition.m
3 | // MLBlackTransition
4 | //
5 | // Created by molon on 7/8/14.
6 | // Copyright (c) 2014 molon. All rights reserved.
7 | //
8 |
9 | #import "MLBlackTransition.h"
10 | #import
11 | #import
12 |
13 | //设置一个默认的全局使用的type,默认是普通拖返模式
14 | static MLBlackTransitionGestureRecognizerType __MLBlackTransitionGestureRecognizerType = MLBlackTransitionGestureRecognizerTypePan;
15 |
16 | #pragma mark - hook大法
17 | //静态就交换静态,实例方法就交换实例方法
18 | void __MLBlackTransition_Swizzle(Class c, SEL origSEL, SEL newSEL)
19 | {
20 | //获取实例方法
21 | Method origMethod = class_getInstanceMethod(c, origSEL);
22 | Method newMethod = nil;
23 | if (!origMethod) {
24 | //获取静态方法
25 | origMethod = class_getClassMethod(c, origSEL);
26 | newMethod = class_getClassMethod(c, newSEL);
27 | }else{
28 | newMethod = class_getInstanceMethod(c, newSEL);
29 | }
30 |
31 | if (!origMethod||!newMethod) {
32 | return;
33 | }
34 |
35 | //自身已经有了就添加不成功,直接交换即可
36 | if(class_addMethod(c, origSEL, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))){
37 | //添加成功一般情况是因为,origSEL本身是在c的父类里。这里添加成功了一个继承方法。
38 | class_replaceMethod(c, newSEL, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
39 | }else{
40 | method_exchangeImplementations(origMethod, newMethod);
41 | }
42 | }
43 |
44 | @interface NSString (__MLBlackTransition_Encrypt)
45 |
46 | - (NSString *)__mlEncryptString;
47 | - (NSString *)__mlDecryptString;
48 |
49 | @end
50 |
51 | @implementation NSString (__MLBlackTransition_Encrypt)
52 |
53 | - (NSString *)__mlRot13
54 | {
55 | const char *source = [self cStringUsingEncoding:NSASCIIStringEncoding];
56 | char *dest = (char *)malloc((self.length + 1) * sizeof(char));
57 | if (!dest) {
58 | return nil;
59 | }
60 |
61 | NSUInteger i = 0;
62 | for ( ; i < self.length; i++) {
63 | char c = source[i];
64 | if (c >= 'A' && c <= 'Z') {
65 | c = (c - 'A' + 13) % 26 + 'A';
66 | }
67 | else if (c >= 'a' && c <= 'z') {
68 | c = (c - 'a' + 13) % 26 + 'a';
69 | }
70 | dest[i] = c;
71 | }
72 | dest[i] = '\0';
73 |
74 | NSString *result = [[NSString alloc] initWithCString:dest encoding:NSASCIIStringEncoding];
75 | free(dest);
76 |
77 | return result;
78 | }
79 |
80 | - (NSString *)__mlEncryptString
81 | {
82 | NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding];
83 | NSString *base64 = [data base64EncodedStringWithOptions:0];
84 | return [base64 __mlRot13];
85 | }
86 |
87 | - (NSString *)__mlDecryptString
88 | {
89 | NSString *rot13 = [self __mlRot13];
90 | NSData *data = [[NSData alloc] initWithBase64EncodedString:rot13 options:0];
91 | return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
92 | }
93 |
94 | @end
95 |
96 | #pragma mark - UIView category implementation
97 | NSString * const kMLBlackTransition_UIView_DisableMLBlackTransition = @"__MLBlackTransition_UIView_DisableMLBlackTransition";
98 | @implementation UIView(__MLBlackTransition)
99 |
100 | - (BOOL)disableMLBlackTransition
101 | {
102 | return [objc_getAssociatedObject(self, &kMLBlackTransition_UIView_DisableMLBlackTransition) boolValue];
103 | }
104 |
105 | - (void)setDisableMLBlackTransition:(BOOL)disableMLBlackTransition
106 | {
107 | [self willChangeValueForKey:kMLBlackTransition_UIView_DisableMLBlackTransition];
108 | objc_setAssociatedObject(self, &kMLBlackTransition_UIView_DisableMLBlackTransition, @(disableMLBlackTransition), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
109 | [self didChangeValueForKey:kMLBlackTransition_UIView_DisableMLBlackTransition];
110 | }
111 |
112 | @end
113 |
114 | #pragma mark - UIGestureRecognizer category interface
115 | @interface UIGestureRecognizer(__MLBlackTransition)
116 |
117 | @property (nonatomic, assign) UINavigationController *__MLBlackTransition_NavController;
118 |
119 | @end
120 |
121 | #pragma mark - UIGestureRecognizer category implementation
122 | NSString * const kMLBlackTransition_NavController_OfPan = @"__MLBlackTransition_NavController_OfPan";
123 |
124 | @implementation UIGestureRecognizer(__MLBlackTransition)
125 |
126 | - (void)set__MLBlackTransition_NavController:(UINavigationController *)__MLBlackTransition_NavController
127 | {
128 | [self willChangeValueForKey:kMLBlackTransition_NavController_OfPan];
129 | objc_setAssociatedObject(self, &kMLBlackTransition_NavController_OfPan, __MLBlackTransition_NavController, OBJC_ASSOCIATION_ASSIGN);
130 | [self didChangeValueForKey:kMLBlackTransition_NavController_OfPan];
131 | }
132 |
133 | - (UIViewController *)__MLBlackTransition_NavController
134 | {
135 | return objc_getAssociatedObject(self, &kMLBlackTransition_NavController_OfPan);
136 | }
137 |
138 | @end
139 |
140 | #pragma mark - UIPercentDrivenInteractiveTransition category
141 | @interface UIPercentDrivenInteractiveTransition(__MLBlackTransition)
142 |
143 | @end
144 |
145 | @implementation UIPercentDrivenInteractiveTransition(__MLBlackTransition)
146 |
147 | - (void)handleNavigationTransition:(UIPanGestureRecognizer*)recognizer
148 | {
149 | if (recognizer.state == UIGestureRecognizerStateBegan) {
150 | //做个样子,也用来防止如果这个api系统改了名字,我们这边还是可用的。
151 | [recognizer.__MLBlackTransition_NavController popViewControllerAnimated:YES];
152 | }
153 | }
154 |
155 | @end
156 |
157 | #pragma mark - UINavigationController category interface
158 | @interface UINavigationController(__MLBlackTransition)
159 |
160 | /**
161 | * 每个导航器都添加一个拖动手势
162 | */
163 | @property (nonatomic, strong) UIPanGestureRecognizer *__MLBlackTransition_panGestureRecognizer;
164 |
165 | - (void)__MLBlackTransition_Hook_ViewDidLoad;
166 |
167 | @end
168 |
169 | #pragma mark - UINavigationController category implementation
170 | NSString * const k__MLBlackTransition_GestureRecognizer = @"__MLBlackTransition_GestureRecognizer";
171 |
172 | @implementation UINavigationController(__MLBlackTransition)
173 |
174 | #pragma mark getter and setter
175 | - (void)set__MLBlackTransition_panGestureRecognizer:(UIPanGestureRecognizer *)__MLBlackTransition_panGestureRecognizer
176 | {
177 | [self willChangeValueForKey:k__MLBlackTransition_GestureRecognizer];
178 | objc_setAssociatedObject(self, &k__MLBlackTransition_GestureRecognizer, __MLBlackTransition_panGestureRecognizer, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
179 | [self didChangeValueForKey:k__MLBlackTransition_GestureRecognizer];
180 | }
181 |
182 | - (UIPanGestureRecognizer *)__MLBlackTransition_panGestureRecognizer
183 | {
184 | return objc_getAssociatedObject(self, &k__MLBlackTransition_GestureRecognizer);
185 | }
186 |
187 | #pragma mark hook
188 | - (void)__MLBlackTransition_Hook_ViewDidLoad
189 | {
190 | [self __MLBlackTransition_Hook_ViewDidLoad];
191 |
192 | //初始化拖返手势
193 | if (!self.__MLBlackTransition_panGestureRecognizer&&[self.interactivePopGestureRecognizer.delegate isKindOfClass:[UIPercentDrivenInteractiveTransition class]]) {
194 | UIPanGestureRecognizer *gestureRecognizer = nil;
195 |
196 | #define kHandleNavigationTransitionKey [@"nTShMTkyGzS2nJquqTyioyElLJ5mnKEco246" __mlDecryptString]
197 | if (__MLBlackTransitionGestureRecognizerType == MLBlackTransitionGestureRecognizerTypeScreenEdgePan) {
198 | gestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self.interactivePopGestureRecognizer.delegate action:NSSelectorFromString(kHandleNavigationTransitionKey)];
199 | ((UIScreenEdgePanGestureRecognizer*)gestureRecognizer).edges = UIRectEdgeLeft;
200 | }else{
201 | gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self.interactivePopGestureRecognizer.delegate action:NSSelectorFromString(kHandleNavigationTransitionKey)];
202 | }
203 |
204 | gestureRecognizer.delegate = self;
205 | gestureRecognizer.__MLBlackTransition_NavController = self;
206 |
207 | self.__MLBlackTransition_panGestureRecognizer = gestureRecognizer;
208 |
209 | self.interactivePopGestureRecognizer.enabled = NO;
210 | }
211 |
212 | [self.view addGestureRecognizer:self.__MLBlackTransition_panGestureRecognizer];
213 | }
214 |
215 | #pragma mark GestureRecognizer delegate
216 | - (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)recognizer
217 | {
218 | UINavigationController *navVC = self;
219 | if ([navVC.transitionCoordinator isAnimated]||
220 | navVC.viewControllers.count < 2) {
221 | return NO;
222 | }
223 |
224 | UIView* view = recognizer.view;
225 | CGPoint loc = [recognizer locationInView:view];
226 | UIView* subview = [view hitTest:loc withEvent:nil];
227 | if (subview.disableMLBlackTransition){ //这个view忽略了拖返
228 | return NO;
229 | }
230 |
231 | //普通拖曳模式,如果开始方向不对即不启用
232 | if (__MLBlackTransitionGestureRecognizerType==MLBlackTransitionGestureRecognizerTypePan){
233 | CGPoint velocity = [recognizer velocityInView:navVC.view];
234 | if(velocity.x<=0) {
235 | //NSLog(@"不是右滑的");
236 | return NO;
237 | }
238 |
239 | CGPoint translation = [recognizer translationInView:navVC.view];
240 | translation.x = translation.x==0?0.00001f:translation.x;
241 | CGFloat ratio = (fabs(translation.y)/fabs(translation.x));
242 | //因为上滑的操作相对会比较频繁,所以角度限制少点
243 | if ((translation.y>0&&ratio>0.618f)||(translation.y<0&&ratio>0.2f)) {
244 | //NSLog(@"右滑角度不在范围内");
245 | return NO;
246 | }
247 | }
248 |
249 | return YES;
250 | }
251 | @end
252 |
253 | @implementation UINavigationController(DisableMLBlackTransition)
254 |
255 | #pragma mark - outcall
256 | - (void)enabledMLBlackTransition:(BOOL)enabled
257 | {
258 | self.__MLBlackTransition_panGestureRecognizer.enabled = enabled;
259 | }
260 |
261 | @end
262 |
263 | @implementation MLBlackTransition
264 |
265 | + (void)validatePanPackWithMLBlackTransitionGestureRecognizerType:(MLBlackTransitionGestureRecognizerType)type
266 | {
267 | //IOS7以下不可用
268 | if ([[[UIDevice currentDevice] systemVersion]floatValue]<7.0) {
269 | return;
270 | }
271 |
272 | //启用hook,自动对每个导航器开启拖返功能,整个程序的生命周期只允许执行一次
273 | static dispatch_once_t onceToken;
274 | dispatch_once(&onceToken, ^{
275 | //设置记录type,并且执行hook
276 | __MLBlackTransitionGestureRecognizerType = type;
277 |
278 | __MLBlackTransition_Swizzle([UINavigationController class],@selector(viewDidLoad),@selector(__MLBlackTransition_Hook_ViewDidLoad));
279 | });
280 | }
281 |
282 | @end
283 |
284 |
285 | #pragma mark - UIScrollView category ,可让scrollView在一个良好的关系下并存
286 | @interface UIScrollView(__MLTransistion)
287 |
288 | @end
289 |
290 | @implementation UIScrollView(__MLTransistion)
291 |
292 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
293 | {
294 | if ([gestureRecognizer isEqual:self.panGestureRecognizer]) {
295 | //如果此scrollView有横向滚动的可能当然就需要忽略了。
296 | if (CGAffineTransformEqualToTransform(CGAffineTransformMakeRotation(-M_PI*0.5),self.transform)||CGAffineTransformEqualToTransform(CGAffineTransformMakeRotation(M_PI*0.5),self.transform)) {
297 | // if (self.contentSize.height>self.frame.size.width) {
298 | //暂时对于这一种比较喜欢直接就不支持拖返吧,感觉体验好点。
299 | return NO;
300 | // }
301 | }else{
302 | if (self.contentSize.width>self.frame.size.width) {
303 | return NO;
304 | }
305 | }
306 | if (otherGestureRecognizer.__MLBlackTransition_NavController) {
307 | //说明这玩意是我们的手势
308 | return YES;
309 | }
310 | }
311 | return NO;
312 | }
313 |
314 | @end
315 |
316 |
317 |
--------------------------------------------------------------------------------
/IMFiveApp/MLTransition/MLTransitionAnimation.h:
--------------------------------------------------------------------------------
1 | //
2 | // MLTransitionAnimation.h
3 | // MLTransitionNavigationController
4 | //
5 | // Created by molon on 6/29/14.
6 | // Copyright (c) 2014 molon. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef enum {
12 | MLTransitionAnimationTypePush, //push
13 | MLTransitionAnimationTypePop, //pop
14 | } MLTransitionAnimationType;
15 |
16 | @interface MLTransitionAnimation : NSObject
17 |
18 | @property (nonatomic, assign) MLTransitionAnimationType type;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/IMFiveApp/MLTransition/MLTransitionAnimation.m:
--------------------------------------------------------------------------------
1 | //
2 | // MLTransitionAnimation.m
3 | // MLTransitionNavigationController
4 | //
5 | // Created by molon on 6/29/14.
6 | // Copyright (c) 2014 molon. All rights reserved.
7 | //
8 |
9 | #import "MLTransitionAnimation.h"
10 |
11 | //通常意义上的动画时间
12 | #define kMLTransitionConstant_TransitionDuration 0.25f
13 |
14 | //左VC移动的长度和其整个宽度的比例
15 | #define kMLTransitionConstant_LeftVC_Move_Ratio_Of_Width 0.29f
16 |
17 | //阴影相关
18 | #define kMLTransitionConstant_RightVC_ShadowOffset_Width (-0.4f)
19 | #define kMLTransitionConstant_RightVC_ShadowRadius 3.0f
20 | #define kMLTransitionConstant_RightVC_ShadowOpacity 0.3f
21 |
22 |
23 | @implementation MLTransitionAnimation
24 |
25 | - (void)animateTransition:(id)transitionContext {
26 | UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
27 | UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
28 | //可以理解为是动画进行中的view容器,当前fromVC.view已经在容器里了,但是toVC.view没有
29 | UIView *containerView = [transitionContext containerView];
30 |
31 | //设置阴影
32 | UIViewController *vc = nil;
33 | if (self.type==MLTransitionAnimationTypePush) {
34 | vc = toVC;
35 | }else{
36 | vc = fromVC;
37 | }
38 | vc.view.layer.shadowColor = [UIColor blackColor].CGColor;
39 | vc.view.layer.shadowOffset = CGSizeMake(kMLTransitionConstant_RightVC_ShadowOffset_Width,0);
40 | vc.view.layer.shadowRadius = kMLTransitionConstant_RightVC_ShadowRadius;
41 | vc.view.layer.shadowOpacity = kMLTransitionConstant_RightVC_ShadowOpacity;
42 |
43 | if (self.type==MLTransitionAnimationTypePush) {
44 | //添加到容器View
45 | [containerView insertSubview:toVC.view aboveSubview:fromVC.view];
46 | //从右边推进来
47 | toVC.view.transform = CGAffineTransformMakeTranslation(toVC.view.frame.size.width, 0);
48 | }else{
49 | //放进容器
50 | [containerView insertSubview:toVC.view belowSubview:fromVC.view];
51 | //设置初始值
52 | toVC.view.transform = CGAffineTransformMakeTranslation(-toVC.view.frame.size.width*kMLTransitionConstant_LeftVC_Move_Ratio_Of_Width, 0);
53 | }
54 |
55 | [UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0.0f options:UIViewAnimationOptionCurveLinear animations:^{
56 | if (self.type == MLTransitionAnimationTypePush) {
57 | fromVC.view.transform = CGAffineTransformMakeTranslation(-fromVC.view.frame.size.width*kMLTransitionConstant_LeftVC_Move_Ratio_Of_Width, 0); //向左移10分之3的宽度位置
58 | }else{
59 | fromVC.view.transform = CGAffineTransformMakeTranslation(fromVC.view.frame.size.width, 0);
60 | }
61 | toVC.view.transform = CGAffineTransformIdentity;
62 |
63 | } completion:^(BOOL finished) {
64 | vc.view.layer.shadowOpacity = 0.0f;
65 |
66 | [transitionContext completeTransition:!transitionContext.transitionWasCancelled];
67 |
68 |
69 | fromVC.view.transform = CGAffineTransformIdentity; //重置回来,两个都重置是因为动画可能会被取消
70 | toVC.view.transform = CGAffineTransformIdentity;
71 | }];
72 | }
73 |
74 | - (NSTimeInterval)transitionDuration:(id)transitionContext {
75 | //设置一个动画时间。
76 | return kMLTransitionConstant_TransitionDuration;
77 | }
78 |
79 |
80 |
81 | @end
82 |
--------------------------------------------------------------------------------
/IMFiveApp/MLTransition/UIViewController+MLTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+MLTransition.h
3 | // MLTransitionNavigationController
4 | //
5 | // Created by molon on 6/28/14.
6 | // Copyright (c) 2014 molon. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef enum {
12 | MLTransitionGestureRecognizerTypePan, //拖动模式
13 | MLTransitionGestureRecognizerTypeScreenEdgePan, //边界拖动模式
14 | } MLTransitionGestureRecognizerType;
15 |
16 | @interface UIViewController (MLTransition)
17 |
18 | + (void)validatePanPackWithMLTransitionGestureRecognizerType:(MLTransitionGestureRecognizerType)type;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/IMFiveApp/MLTransition/UIViewController+MLTransition.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+MLTransition.m
3 | // MLTransitionNavigationController
4 | //
5 | // Created by molon on 6/28/14.
6 | // Copyright (c) 2014 molon. All rights reserved.
7 | //
8 |
9 | #import "UIViewController+MLTransition.h"
10 | #import
11 | #import "MLTransitionAnimation.h"
12 |
13 | //有效的向右拖动的最小速率,即为大于这个速率就认为想返回上一页罢了
14 | #define kMLTransitionConstant_Valid_MIN_Velocity 300.0f
15 |
16 | NSString * const kMLTransition_PercentDrivenInteractivePopTransition = @"__MLTransition_PercentDrivenInteractivePopTransition";
17 |
18 | NSString * const kMLTransition_GestureRecognizer = @"__MLTransition_GestureRecognizer";
19 |
20 | NSString * const kMLTransition_ViewController_OfPan = @"__MLTransition_ViewController_OfPan";
21 |
22 | //设置一个默认的全局使用的type
23 | static MLTransitionGestureRecognizerType __MLTransitionGestureRecognizerType = MLTransitionGestureRecognizerTypePan;
24 |
25 | //静态就交换静态,实例方法就交换实例方法
26 | void __MLTransition_Swizzle(Class c, SEL origSEL, SEL newSEL)
27 | {
28 | //获取实例方法
29 | Method origMethod = class_getInstanceMethod(c, origSEL);
30 | Method newMethod = nil;
31 | if (!origMethod) {
32 | //获取静态方法
33 | origMethod = class_getClassMethod(c, origSEL);
34 | newMethod = class_getClassMethod(c, newSEL);
35 | }else{
36 | newMethod = class_getInstanceMethod(c, newSEL);
37 | }
38 |
39 | if (!origMethod||!newMethod) {
40 | return;
41 | }
42 |
43 | //自身已经有了就添加不成功,直接交换即可
44 | if(class_addMethod(c, origSEL, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))){
45 | //添加成功一般情况是因为,origSEL本身是在c的父类里。这里添加成功了一个继承方法。
46 | class_replaceMethod(c, newSEL, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
47 | }else{
48 | method_exchangeImplementations(origMethod, newMethod);
49 | }
50 | }
51 |
52 | @interface UIGestureRecognizer(__MLTransistion)
53 |
54 | @property (nonatomic, assign) UIViewController *__MLTransition_ViewController;
55 |
56 | @end
57 |
58 | @implementation UIGestureRecognizer(__MLTransistion)
59 |
60 | - (void)set__MLTransition_ViewController:(UIViewController *)__MLTransition_ViewController
61 | {
62 | [self willChangeValueForKey:kMLTransition_ViewController_OfPan];
63 | objc_setAssociatedObject(self, &kMLTransition_ViewController_OfPan, __MLTransition_ViewController, OBJC_ASSOCIATION_ASSIGN);
64 | [self didChangeValueForKey:kMLTransition_ViewController_OfPan];
65 | }
66 |
67 | - (UIViewController *)__MLTransition_ViewController
68 | {
69 | return objc_getAssociatedObject(self, &kMLTransition_ViewController_OfPan);
70 | }
71 |
72 | @end
73 |
74 | //作为手势的delegate,原因是如果delegate是当前vc则可能产生子类覆盖的情况
75 | @interface __MLTransistion_Gesture_Delegate_Object : NSObject
76 |
77 | @end
78 |
79 | @implementation __MLTransistion_Gesture_Delegate_Object
80 |
81 | + (instancetype)shareInstance {
82 | static __MLTransistion_Gesture_Delegate_Object *_shareInstance = nil;
83 | static dispatch_once_t onceToken;
84 | dispatch_once(&onceToken, ^{
85 | _shareInstance = [[[self class] alloc]init];
86 | });
87 | return _shareInstance;
88 | }
89 |
90 |
91 | //直接在这处理的话对性能有好处。
92 | - (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer
93 | {
94 | UIViewController *vc = gestureRecognizer.__MLTransition_ViewController;
95 | if (!vc) {
96 | return NO;
97 | }
98 |
99 | if (!vc.navigationController||
100 | [vc.navigationController.transitionCoordinator isAnimated]||
101 | vc.navigationController.viewControllers.count < 2) {
102 | return NO;
103 | }
104 |
105 | //普通拖曳模式,如果开始方向不对即不启用
106 | if (__MLTransitionGestureRecognizerType==MLTransitionGestureRecognizerTypePan&&[gestureRecognizer velocityInView:vc.view].x<=0) {
107 | return NO;
108 | }
109 |
110 | return YES;
111 | }
112 |
113 | @end
114 |
115 | @interface UIViewController ()
116 |
117 | @property (nonatomic, strong) UIPercentDrivenInteractiveTransition *percentDrivenInteractivePopTransition;
118 | @property (nonatomic, strong) UIGestureRecognizer *MLTransition_gestureRecognizer;
119 |
120 | @end
121 |
122 | @implementation UIViewController (MLTransition)
123 |
124 | #pragma mark - outside call
125 | + (void)validatePanPackWithMLTransitionGestureRecognizerType:(MLTransitionGestureRecognizerType)type
126 | {
127 | //整个程序的生命周期只允许执行一次
128 | static dispatch_once_t onceToken;
129 | dispatch_once(&onceToken, ^{
130 | //设置记录type,并且执行hook
131 | __MLTransitionGestureRecognizerType = type;
132 |
133 | __MLTransition_Swizzle([self class],@selector(viewDidLoad),@selector(__MLTransition_Hook_ViewDidLoad));
134 | __MLTransition_Swizzle([self class],@selector(viewDidAppear:),@selector(__MLTransition_Hook_ViewDidAppear:));
135 | __MLTransition_Swizzle([self class],@selector(viewWillDisappear:),@selector(__MLTransition_Hook_ViewWillDisappear:));
136 | __MLTransition_Swizzle([self class], NSSelectorFromString(@"dealloc"),@selector(__MLTransition_Hook_Dealloc));
137 | });
138 | }
139 |
140 | #pragma mark - add property
141 | - (void)setPercentDrivenInteractivePopTransition:(UIPercentDrivenInteractiveTransition *)percentDrivenInteractivePopTransition
142 | {
143 | [self willChangeValueForKey:kMLTransition_PercentDrivenInteractivePopTransition];
144 | objc_setAssociatedObject(self, &kMLTransition_PercentDrivenInteractivePopTransition, percentDrivenInteractivePopTransition, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
145 | [self didChangeValueForKey:kMLTransition_PercentDrivenInteractivePopTransition];
146 | }
147 |
148 | - (UIPercentDrivenInteractiveTransition *)percentDrivenInteractivePopTransition
149 | {
150 | return objc_getAssociatedObject(self, &kMLTransition_PercentDrivenInteractivePopTransition);
151 | }
152 |
153 | - (void)setMLTransition_gestureRecognizer:(UIGestureRecognizer *)MLTransition_gestureRecognizer
154 | {
155 | [self willChangeValueForKey:kMLTransition_GestureRecognizer];
156 | objc_setAssociatedObject(self, &kMLTransition_GestureRecognizer, MLTransition_gestureRecognizer, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
157 | [self didChangeValueForKey:kMLTransition_GestureRecognizer];
158 | }
159 |
160 | - (UIGestureRecognizer *)MLTransition_gestureRecognizer
161 | {
162 | return objc_getAssociatedObject(self, &kMLTransition_GestureRecognizer);
163 | }
164 |
165 | #pragma mark - hook
166 | - (void)__MLTransition_Hook_ViewDidLoad
167 | {
168 | [self __MLTransition_Hook_ViewDidLoad];
169 |
170 | if ([self isKindOfClass:[UINavigationController class]]) {
171 | return;
172 | }
173 |
174 | if (!self.MLTransition_gestureRecognizer) {
175 | UIGestureRecognizer *gestureRecognizer = nil;
176 | if (__MLTransitionGestureRecognizerType == MLTransitionGestureRecognizerTypeScreenEdgePan) {
177 | gestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(__MLTransition_HandlePopRecognizer:)];
178 | ((UIScreenEdgePanGestureRecognizer*)gestureRecognizer).edges = UIRectEdgeLeft;
179 | }else{
180 | gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(__MLTransition_HandlePopRecognizer:)];
181 | }
182 |
183 | gestureRecognizer.__MLTransition_ViewController = self;
184 | gestureRecognizer.delegate = [__MLTransistion_Gesture_Delegate_Object shareInstance];
185 |
186 | self.MLTransition_gestureRecognizer = gestureRecognizer;
187 | [self.view addGestureRecognizer:gestureRecognizer];
188 | }
189 | }
190 |
191 | - (void)__MLTransition_Hook_ViewDidAppear:(BOOL)animated {
192 | [self __MLTransition_Hook_ViewDidAppear:animated];
193 |
194 | if (![self isKindOfClass:[UINavigationController class]]) {
195 | //经过测试,只有delegate是vc的时候vc的title或者navigationItem.titleView才会跟着移动。
196 | //所以在下并没有使用一个单例一直作为delegate存在,单例的话效果和新版QQ一样,title不会移动,但是也会有fade效果啦。
197 | self.navigationController.delegate = self;
198 | }
199 | }
200 |
201 | - (void)__MLTransition_Hook_ViewWillDisappear:(BOOL)animated {
202 | [self __MLTransition_Hook_ViewWillDisappear:animated];
203 |
204 | if (![self isKindOfClass:[UINavigationController class]]) {
205 | if (self.navigationController.delegate == self) {
206 | self.navigationController.delegate = nil;
207 | }
208 | }
209 | }
210 |
211 | - (void)__MLTransition_Hook_Dealloc
212 | {
213 | self.MLTransition_gestureRecognizer.delegate = nil;
214 | self.MLTransition_gestureRecognizer.__MLTransition_ViewController = nil;
215 |
216 | [self __MLTransition_Hook_Dealloc];
217 | }
218 |
219 | #pragma mark - UINavigationControllerDelegate
220 | - (id)navigationController:(UINavigationController *)navigationController
221 | animationControllerForOperation:(UINavigationControllerOperation)operation
222 | fromViewController:(UIViewController *)fromVC
223 | toViewController:(UIViewController *)toVC {
224 | if (fromVC == self) {
225 | if (operation == UINavigationControllerOperationPop) {
226 | MLTransitionAnimation *animationController = [MLTransitionAnimation new];
227 | animationController.type = MLTransitionAnimationTypePop;
228 | return animationController;
229 | }
230 | // else{
231 | // MLTransitionAnimation *animationController = [MLTransitionAnimation new];
232 | // animationController.type = MLTransitionAnimationTypePush;
233 | // return animationController;
234 | // }
235 | //Push的话,发现自定义的性能可能有点问题,由于这里需求和系统的效果一样,就默认使用系统的吧
236 | }
237 |
238 | return nil;
239 | }
240 |
241 | - (id)navigationController:(UINavigationController *)navigationController
242 | interactionControllerForAnimationController:(id)animationController {
243 | if ([animationController isKindOfClass:[MLTransitionAnimation class]]&&((MLTransitionAnimation*)animationController).type==MLTransitionAnimationTypePop) {
244 | return self.percentDrivenInteractivePopTransition;
245 | }
246 |
247 | return nil;
248 | }
249 |
250 | #pragma mark - UIGestureRecognizer handlers
251 | - (void)__MLTransition_HandlePopRecognizer:(UIPanGestureRecognizer*)recognizer {
252 | if (recognizer.state == UIGestureRecognizerStateBegan) {
253 | //建立一个transition的百分比控制对象
254 | self.percentDrivenInteractivePopTransition = [[UIPercentDrivenInteractiveTransition alloc] init];
255 | self.percentDrivenInteractivePopTransition.completionCurve = UIViewAnimationCurveLinear;
256 |
257 | [self.navigationController popViewControllerAnimated:YES];
258 | return;
259 | }
260 |
261 | if (!self.percentDrivenInteractivePopTransition) {
262 | return;
263 | }
264 |
265 |
266 | CGFloat progress = [recognizer translationInView:self.view].x / (self.view.bounds.size.width * 1.0f);
267 | progress = MIN(1.0, MAX(0.0, progress));
268 |
269 | if (recognizer.state == UIGestureRecognizerStateChanged) {
270 | //根据拖动调整transition状态
271 | [self.percentDrivenInteractivePopTransition updateInteractiveTransition:progress];
272 | }else if ((recognizer.state == UIGestureRecognizerStateEnded || recognizer.state == UIGestureRecognizerStateCancelled)) {
273 | //结束或者取消了手势,根据方向和速率来判断应该完成transition还是取消transition
274 | CGFloat velocity = [recognizer velocityInView:self.view].x; //我们只关心x的速率
275 |
276 | if (velocity > kMLTransitionConstant_Valid_MIN_Velocity) { //向右速率太快就完成
277 | self.percentDrivenInteractivePopTransition.completionSpeed /= 1.3f;
278 | [self.percentDrivenInteractivePopTransition finishInteractiveTransition];
279 | }else if (velocity < -kMLTransitionConstant_Valid_MIN_Velocity){ //向左速率太快就取消
280 | self.percentDrivenInteractivePopTransition.completionSpeed /= 1.8f;
281 | [self.percentDrivenInteractivePopTransition cancelInteractiveTransition];
282 | }else{
283 | BOOL isFinished = NO;
284 | if (progress > 0.8f || (progress>=0.2f&&velocity>0.0f)) {
285 | isFinished = YES;
286 | }
287 | if (isFinished) {
288 | self.percentDrivenInteractivePopTransition.completionSpeed /= 1.5f;
289 | [self.percentDrivenInteractivePopTransition finishInteractiveTransition];
290 | }else{
291 | self.percentDrivenInteractivePopTransition.completionSpeed /= 2.0f;
292 | [self.percentDrivenInteractivePopTransition cancelInteractiveTransition];
293 | }
294 | }
295 | self.percentDrivenInteractivePopTransition = nil;
296 | }
297 |
298 | }
299 |
300 | @end
301 |
--------------------------------------------------------------------------------
/IMFiveApp/MainTabViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // HomePageViewController.h
3 | // IMApp
4 | //
5 | // Created by chen on 14/7/20.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface MainTabViewController : QHBasicViewController
12 |
13 | + (MainTabViewController *)getMain;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/IMFiveApp/MainTabViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // HomePageViewController.m
3 | // IMApp
4 | //
5 | // Created by chen on 14/7/20.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "MainTabViewController.h"
10 |
11 | #import "MessagesViewController.h"
12 | #import "ContactsViewController.h"
13 | #import "DynamicViewController.h"
14 | //#import "MineViewController.h"
15 |
16 | @interface MainTabViewController ()
17 | {
18 | UITabBarController *_tabC;
19 | }
20 |
21 | @end
22 |
23 | @implementation MainTabViewController
24 |
25 | static MainTabViewController *main;
26 |
27 | + (MainTabViewController *)getMain
28 | {
29 | return main;
30 | }
31 |
32 | - (id)init
33 | {
34 | self = [super init];
35 |
36 | main = self;
37 |
38 | return self;
39 | }
40 |
41 | - (void)viewDidLoad
42 | {
43 | [super viewDidLoad];
44 |
45 | [self addObserver];
46 |
47 | _tabC = [[UITabBarController alloc] init];
48 | [_tabC.tabBar setBackgroundColor:[UIColor clearColor]];
49 | [_tabC.view setFrame:self.view.frame];
50 | [self.view addSubview:_tabC.view];
51 |
52 | MessagesViewController *f = [[MessagesViewController alloc] init];
53 | ContactsViewController *contactsVC = [[ContactsViewController alloc] init];
54 | DynamicViewController *t = [[DynamicViewController alloc] init];
55 |
56 | // MineViewController *ff = [[MineViewController alloc] init];
57 | // UITabBarItem *ffItem = [[UITabBarItem alloc]initWithTitle:@"svip" image:nil tag:1];
58 | // [ffItem setImage:[UIImage imageNamed:@"tab_me_svip_nor.png"]];
59 | // [ffItem setSelectedImage:[UIImage imageNamed:@"tab_me_svip_press.png"]];
60 | // ff.tabBarItem = ffItem;
61 |
62 | _tabC.viewControllers = @[f, contactsVC, t];
63 |
64 | [self reloadImage];
65 | // [[UITabBarItem appearance] setTitleTextAttributes:
66 | // [NSDictionary dictionaryWithObjectsAndKeys:RGBA(96, 164, 222, 1), UITextAttributeTextColor, nil]
67 | // forState:UIControlStateNormal];
68 | [[UITabBarItem appearance] setTitleTextAttributes:
69 | [NSDictionary dictionaryWithObjectsAndKeys:RGBA(96, 164, 222, 1), UITextAttributeTextColor, nil]
70 | forState:UIControlStateSelected];
71 | // [_tabC.tabBar setTintColor:RGBA(96, 164, 222, 1)];
72 |
73 | [_tabC setSelectedIndex:1];
74 | }
75 |
76 | - (void)reloadImage
77 | {
78 | [super reloadImage];
79 |
80 | NSString *imageName = nil;
81 | if (isIos7 >= 7 && __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1 && [QHConfiguredObj defaultConfigure].nThemeIndex != 0)
82 | {
83 | imageName = @"tabbar_bg_ios7.png";
84 | }else
85 | {
86 | imageName = @"tabbar_bg.png";
87 | }
88 | [_tabC.tabBar setBackgroundImage:[QHCommonUtil imageNamed:imageName]];
89 |
90 | NSArray *ar = _tabC.viewControllers;
91 | NSMutableArray *arD = [NSMutableArray new];
92 | [ar enumerateObjectsUsingBlock:^(UIViewController *viewController, NSUInteger idx, BOOL *stop)
93 | {
94 | // UITabBarItem *item = viewController.tabBarItem;
95 | UITabBarItem *item = nil;
96 | switch (idx)
97 | {
98 | case 0:
99 | {
100 | item = [[UITabBarItem alloc] initWithTitle:@"消息" image:[[QHCommonUtil imageNamed:@"tab_recent_nor.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[QHCommonUtil imageNamed:@"tab_recent_press.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
101 | break;
102 | }
103 | case 1:
104 | {
105 | item = [[UITabBarItem alloc] initWithTitle:@"联系人" image:nil tag:1];
106 | [item setImage:[[QHCommonUtil imageNamed:@"tab_buddy_nor.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
107 | [item setSelectedImage:[[QHCommonUtil imageNamed:@"tab_buddy_press.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
108 | break;
109 | }
110 | case 2:
111 | {
112 | item = [[UITabBarItem alloc]initWithTitle:@"动态" image:nil tag:1];
113 | [item setImage:[[QHCommonUtil imageNamed:@"tab_qworld_nor.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
114 | [item setSelectedImage:[[QHCommonUtil imageNamed:@"tab_qworld_press.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
115 | break;
116 | }
117 | }
118 | viewController.tabBarItem = item;
119 | [arD addObject:viewController];
120 | }];
121 | _tabC.viewControllers = arD;
122 | }
123 |
124 | @end
125 |
--------------------------------------------------------------------------------
/IMFiveApp/MessagesViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // MessagesViewController.h
3 | // IMApp
4 | //
5 | // Created by chen on 14-7-21.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "QHBasicViewController.h"
10 |
11 | @interface MessagesViewController : QHBasicViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/IMFiveApp/MessagesViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // MessagesViewController.m
3 | // IMApp
4 | //
5 | // Created by chen on 14-7-21.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "MessagesViewController.h"
10 |
11 | #import "MainTabViewController.h"
12 | #import "RectViewForMessage.h"
13 |
14 | @interface MessagesViewController ()
15 | {
16 | UISearchBar *_searchB;
17 | UITableView *_tableV;
18 | NSMutableArray *_arData;
19 | UISegmentedControl *_selectTypeSegment;
20 | UISearchDisplayController *_searchDisplayC;
21 |
22 | UIView *_maskV;
23 | RectViewForMessage *_menuV;
24 | NSArray *_arMenu;
25 | }
26 |
27 | @end
28 |
29 | @implementation MessagesViewController
30 |
31 | - (void)viewDidDisappear:(BOOL)animated
32 | {
33 | UIButton *btn = (UIButton *)self.rightV;
34 | if (btn.selected)
35 | {
36 | [btn setUserInteractionEnabled:NO];
37 | [btn setSelected:!btn.selected];
38 | [self showMenuWithBool:btn.selected complete:^()
39 | {
40 | [btn setUserInteractionEnabled:YES];
41 | }];
42 | }
43 | }
44 |
45 | - (void)viewDidLoad
46 | {
47 | [super viewDidLoad];
48 |
49 | [self addObserver];
50 |
51 | [self createNavWithTitle:@"消息" createMenuItem:^UIView *(int nIndex)
52 | {
53 | if (nIndex == 1)
54 | {
55 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
56 | UIImage *i = [QHCommonUtil imageNamed:@"menu_icon_bulb.png"];
57 | [btn setImage:i forState:UIControlStateNormal];
58 | [btn setFrame:CGRectMake(self.navView.width - i.size.width - 10, (self.navView.height - i.size.height)/2, i.size.width, i.size.height)];
59 | [btn setImage:[QHCommonUtil imageNamed:@"menu_icon_bulb_pressed.png"] forState:UIControlStateSelected];
60 | btn.tag = 989;
61 | [btn addTarget:self action:@selector(showMenu:) forControlEvents:UIControlEventTouchUpInside];
62 |
63 | return btn;
64 | }
65 | return nil;
66 | }];
67 | _searchB = [[UISearchBar alloc] initWithFrame:CGRectMake(0, self.navView.bottom, self.view.width, 44)];
68 | // [_searchB setShowsCancelButton:YES animated:YES];
69 | [_searchB setPlaceholder:@"搜索"];
70 | [_searchB setSearchBarStyle:UISearchBarStyleDefault];
71 | // [self.view addSubview:_searchB];
72 |
73 | // _selectTypeSegment = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"消息", @"通话", nil]];
74 | // [_selectTypeSegment setFrame:CGRectMake((CGRectGetWidth(self.view.frame) - 120)/2, 8, 120, 28)];
75 | // [_selectTypeSegment setSelectedSegmentIndex:0];
76 | // [self.navView addSubview:_selectTypeSegment];
77 |
78 | _tableV = [[UITableView alloc] initWithFrame:CGRectMake(0, _searchB.bottom, CGRectGetWidth(self.view.frame), self.view.height - _searchB.bottom - self.tabBarController.tabBar.height) style:UITableViewStylePlain];
79 | _tableV.dataSource = self;
80 | _tableV.delegate = self;
81 | [self.view addSubview:_tableV];
82 |
83 | _searchDisplayC = [[UISearchDisplayController alloc] initWithSearchBar:_searchB contentsController:self];
84 | // [searchDisplayC setActive:YES animated:YES];
85 | _searchDisplayC.active = NO;
86 | _searchDisplayC.delegate = self;
87 | _searchDisplayC.searchResultsDataSource =self;
88 | _searchDisplayC.searchResultsDelegate =self;
89 | [self.view addSubview:_searchDisplayC.searchBar];
90 |
91 | _maskV = [[UIView alloc] initWithFrame:CGRectMake(0, self.navView.bottom, self.view.width, self.view.height - self.navView.bottom - self.tabBarController.tabBar.height)];
92 | [_maskV setClipsToBounds:YES];
93 | [self.view addSubview:_maskV];
94 | [_maskV setHidden:YES];
95 |
96 | UIView *bg = [[UIView alloc] initWithFrame:_maskV.bounds];
97 | [bg setBackgroundColor:[UIColor blackColor]];
98 | [bg setAlpha:0.5];
99 | [_maskV addSubview:bg];
100 |
101 | UITapGestureRecognizer *tSM = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showMenuByTap:)];
102 | [bg addGestureRecognizer:tSM];
103 |
104 | _arMenu = @[@[@"建讨论组", @"menu_icon_createDiscuss.png"],
105 | @[@"多人通话", @"menu_icon_groupaudio.png"],
106 | @[@"共享照片", @"menu_icon_camera.png"],
107 | @[@"扫一扫", @"menu_icon_QR.png"]];
108 |
109 | _menuV = [[RectViewForMessage alloc] initWithFrame:CGRectMake(0, -75, self.view.width, 75) ar:_arMenu showSpera:NO bg:@"menu_bg_pressed.png"];
110 | _menuV.delegate = self;
111 | [_maskV addSubview:_menuV];
112 |
113 | [self initData];
114 | }
115 |
116 | - (void)initData
117 | {
118 | __async_opt__, ^
119 | {
120 | _arData = [NSMutableArray new];
121 |
122 | [_arData addObject:@"好友A"];
123 | [_arData addObject:@"陌生人C"];
124 | [_arData addObject:@"我的电脑"];
125 | [_arData addObject:@"群B"];
126 |
127 | __async_main__, ^
128 | {
129 | [_tableV reloadData];
130 | });
131 | });
132 | }
133 |
134 | - (void)showMenuWithBool:(BOOL)bShow complete:(void(^)())complete
135 | {
136 | if (bShow)
137 | {
138 | [_maskV setHidden:NO];
139 | [UIView animateWithDuration:0.3 animations:^
140 | {
141 | _menuV.top = 0;
142 | } completion:^(BOOL finished)
143 | {
144 | complete();
145 | }];
146 | }else
147 | {
148 | [UIView animateWithDuration:0.3 animations:^
149 | {
150 | _menuV.top = -_menuV.height;
151 | } completion:^(BOOL finished)
152 | {
153 | [_maskV setHidden:YES];
154 | complete();
155 | }];
156 | }
157 | }
158 |
159 | #pragma mark - action
160 |
161 | - (void)showMenu:(UIButton *)btn
162 | {
163 | [btn setUserInteractionEnabled:NO];
164 | [btn setSelected:!btn.selected];
165 |
166 | [self showMenuWithBool:btn.selected complete:^()
167 | {
168 | [btn setUserInteractionEnabled:YES];
169 | }];
170 | }
171 |
172 | - (void)showMenuByTap:(UITapGestureRecognizer *)tap
173 | {
174 | UIButton *btn = (UIButton *)self.rightV;
175 | [btn setUserInteractionEnabled:NO];
176 | [btn setSelected:!btn.selected];
177 | [self showMenuWithBool:btn.selected complete:^()
178 | {
179 | [btn setUserInteractionEnabled:YES];
180 | }];
181 | }
182 |
183 | #pragma mark - UITableViewDataSource
184 |
185 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
186 | {
187 | if (tableView == _searchDisplayC.searchResultsTableView)
188 | {
189 | return 0;
190 | }
191 | return [_arData count];
192 | }
193 |
194 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
195 | {
196 | NSString *reuseIdentifier = @"cell";
197 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
198 | if (!cell)
199 | {
200 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
201 | }
202 | cell.textLabel.text = [_arData objectAtIndex:indexPath.row];
203 |
204 | return cell;
205 | }
206 |
207 | #pragma mark - UITableViewDelegate
208 |
209 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
210 | {
211 | return 62;
212 | }
213 |
214 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
215 | {
216 | [tableView deselectRowAtIndexPath:indexPath animated:YES];
217 | }
218 |
219 | #pragma mark - UISearchDisplayDelegate
220 |
221 | - (void) searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller
222 | {
223 | [UIView animateWithDuration:0.2 animations:^
224 | {
225 | self.navView.top -= 64;
226 | _searchB.top -= 44;
227 | _tableV.top -= 44;
228 | }completion:^(BOOL finished)
229 | {
230 | [self.navView setHidden:YES];
231 | _tableV.height += 44;
232 | }];
233 |
234 | controller.searchBar.showsCancelButton = YES;
235 | for(UIView *subView in [[controller.searchBar.subviews objectAtIndex:0] subviews])
236 | {
237 | if([subView isKindOfClass:UIButton.class])
238 | {
239 | [(UIButton*)subView setTitle:@"取消" forState:UIControlStateNormal];
240 | }
241 | }
242 | }
243 |
244 | - (void) searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller
245 | {
246 | [self.navView setHidden:NO];
247 | [UIView animateWithDuration:0.2 animations:^
248 | {
249 | self.navView.top += 64;
250 | _searchB.top += 44;
251 | _tableV.top += 44;
252 | }completion:^(BOOL finished)
253 | {
254 | _tableV.height -= 44;
255 | }];
256 | }
257 |
258 | - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
259 | {
260 |
261 | [self filteredListContentForSearchText:searchString scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]];
262 | // [self filterContentForSearchText:searchString];
263 | //
264 | // if ([filteredListPinYin count] == 0) {
265 |
266 | UITableView *tableView1 = self.searchDisplayController.searchResultsTableView;
267 |
268 | for( UIView *subview in tableView1.subviews )
269 | {
270 | if( [subview class] == [UILabel class] )
271 | {
272 | UILabel *lbl = (UILabel*)subview; // sv changed to subview.
273 | lbl.text = @"没有结果";
274 |
275 | }
276 | }
277 | // }
278 | return YES;
279 | }
280 |
281 | - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption
282 | {
283 | [self filteredListContentForSearchText:[self.searchDisplayController.searchBar text] scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:searchOption]];
284 |
285 | return YES;
286 | }
287 |
288 | #pragma mark Content Filtering
289 |
290 | - (void)filteredListContentForSearchText:(NSString*)searchText scope:(NSString*)scope
291 | {
292 | // if(nil==m_filteredListContent)
293 | // m_filteredListContent=[NSMutableArray new];
294 | // [m_filteredListContent removeAllObjects];
295 | //
296 | // for(NSString* str in groups)
297 | // {
298 | // NSArray * contactSection = [contactTitles objectForKey:str];
299 | // for (NSMutableDictionary *eObj in contactSection)
300 | // {
301 | // if ([[[eObj objectForKey:@"name"] uppercaseString] rangeOfString:[searchText uppercaseString]].length>0)
302 | // {
303 | // [m_filteredListContent addObject:eObj];
304 | // }
305 | // }
306 | // }
307 | }
308 |
309 | #pragma mark - RectViewForMessageDelegate
310 |
311 | - (void)press:(RectViewForMessage *)rectView index:(int)nIndex
312 | {
313 | }
314 |
315 | - (void)reloadImage
316 | {
317 | [super reloadImage];
318 |
319 | UIButton *btn = (UIButton *)[self.view viewWithTag:989];
320 | UIImage *i = [QHCommonUtil imageNamed:@"menu_icon_bulb.png"];
321 | [btn setImage:i forState:UIControlStateNormal];
322 | [btn setImage:[QHCommonUtil imageNamed:@"menu_icon_bulb_pressed.png"] forState:UIControlStateSelected];
323 |
324 | [_menuV reloadMenuImage];
325 | }
326 |
327 | @end
328 |
--------------------------------------------------------------------------------
/IMFiveApp/QHUtills/QHCommonUtil.h:
--------------------------------------------------------------------------------
1 | //
2 | // QHCommonUtil.h
3 | // NewsFourApp
4 | //
5 | // Created by chen on 14/8/9.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface QHCommonUtil : NSObject
12 |
13 | //将view转为image
14 | + (UIImage *)getImageFromView:(UIView *)view;
15 |
16 | //获取随机颜色color
17 | + (UIColor *)getRandomColor;
18 |
19 | //根据比例(0...1)在min和max中取值
20 | + (float)lerp:(float)percent min:(float)nMin max:(float)nMax;
21 |
22 | + (void)unzipFileToDocument:(NSString *)fileName;
23 |
24 | + (void)moveFileToDocument:(NSString *)fileName type:(NSString *)fileType;
25 |
26 | + (UIImage *)imageNamed:(NSString *)name;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/IMFiveApp/QHUtills/QHCommonUtil.m:
--------------------------------------------------------------------------------
1 | //
2 | // QHCommonUtil.m
3 | // NewsFourApp
4 | //
5 | // Created by chen on 14/8/9.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "QHCommonUtil.h"
10 |
11 | //#import
12 | #import "ZipArchive.h"
13 |
14 | @implementation QHCommonUtil
15 |
16 | + (UIImage *)getImageFromView:(UIView *)view
17 | {
18 | UIGraphicsBeginImageContext(view.bounds.size);
19 | [view.layer renderInContext:UIGraphicsGetCurrentContext()];
20 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
21 | UIGraphicsEndImageContext();
22 |
23 | return image;
24 | }
25 |
26 | + (UIColor *)getRandomColor
27 | {
28 | return [UIColor colorWithRed:(float)(1+arc4random()%99)/100 green:(float)(1+arc4random()%99)/100 blue:(float)(1+arc4random()%99)/100 alpha:1];
29 | }
30 |
31 | /*0--1 : lerp( float percent, float x, float y ){ return x + ( percent * ( y - x ) ); };*/
32 | + (float)lerp:(float)percent min:(float)nMin max:(float)nMax
33 | {
34 | float result = nMin;
35 |
36 | result = nMin + percent * (nMax - nMin);
37 |
38 | return result;
39 | }
40 |
41 | + (void)unzipFileToDocument:(NSString *)fileName
42 | {
43 | [QHCommonUtil moveFileToDocument:fileName type:@"zip"];
44 | }
45 |
46 | + (void)moveFileToDocument:(NSString *)fileName type:(NSString *)fileType
47 | {
48 | NSString *filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:fileType];
49 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
50 | NSString *documentsDirectory = [paths objectAtIndex:0];
51 | NSString *filePath2 = [documentsDirectory stringByAppendingPathComponent:[fileName stringByAppendingPathExtension:fileType]];
52 | NSString *pathFold = [filePath2 stringByDeletingPathExtension];
53 | NSString *path = [filePath2 stringByDeletingLastPathComponent];
54 |
55 | NSFileManager *manager = [NSFileManager defaultManager];
56 | if (![manager fileExistsAtPath:pathFold])
57 | {
58 | //判断是否移动成功,这里文件不能是存在的
59 | NSError *thiserror = nil;
60 | if ([[NSFileManager defaultManager] copyItemAtPath:filePath toPath:filePath2 error:&thiserror] != YES)
61 | {
62 | NSLog(@"move fail...");
63 | NSLog(@"Unable to move file: %@", [thiserror localizedDescription]);
64 | }
65 |
66 | ZipArchive *archive = [[ZipArchive alloc] init];
67 | //1
68 | if ([archive UnzipOpenFile:filePath2])
69 | {
70 | // 2
71 | BOOL ret = [archive UnzipFileTo:path overWrite: YES];
72 | if (NO == ret)
73 | {
74 | NSLog(@"fail");
75 | }
76 | [archive UnzipCloseFile];
77 | }
78 |
79 | [manager removeItemAtPath:filePath2 error:nil];
80 | }else
81 | {
82 | // [manager removeItemAtPath:filePath2 error:nil];
83 | }
84 | }
85 |
86 | + (UIImage *)imageNamed:(NSString *)name
87 | {
88 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
89 | NSString *documentsDirectory = [paths objectAtIndex:0];
90 |
91 | UIImage *image = nil;
92 | if ([QHConfiguredObj defaultConfigure].themefold != nil && [QHConfiguredObj defaultConfigure].themefold.length > 0)
93 | {
94 | NSString *path = [[documentsDirectory stringByAppendingPathComponent:[QHConfiguredObj defaultConfigure].themefold] stringByAppendingPathComponent:name];
95 | image = [UIImage imageWithContentsOfFile:path];
96 | }
97 | if (image == nil)
98 | {
99 | image = [UIImage imageNamed:name];
100 | }
101 |
102 | return image;
103 | }
104 |
105 | @end
106 |
--------------------------------------------------------------------------------
/IMFiveApp/QHUtills/QHConfiguredObj.h:
--------------------------------------------------------------------------------
1 | //
2 | // QHConfiguredObj.h
3 | // IMFiveApp
4 | //
5 | // Created by chen on 14-8-30.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #define kTHEME_TAG @"selectTheme"
12 | #define kTHEMEFOLD_TAG @"selectThemeFold"
13 |
14 | @interface QHConfiguredObj : NSObject
15 |
16 | @property (nonatomic, assign) int nThemeIndex;
17 | @property (nonatomic, retain) NSString *themefold;
18 |
19 | + (QHConfiguredObj *)defaultConfigure;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/IMFiveApp/QHUtills/QHConfiguredObj.m:
--------------------------------------------------------------------------------
1 | //
2 | // QHConfiguredObj.m
3 | // IMFiveApp
4 | //
5 | // Created by chen on 14-8-30.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "QHConfiguredObj.h"
10 |
11 | @implementation QHConfiguredObj
12 |
13 | + (QHConfiguredObj *)defaultConfigure
14 | {
15 | static QHConfiguredObj *configureObj = nil;
16 | static dispatch_once_t onceToken;
17 | dispatch_once(&onceToken, ^
18 | {
19 | configureObj = [[QHConfiguredObj alloc] init];
20 | });
21 |
22 | return configureObj;
23 | }
24 |
25 | - (id)init
26 | {
27 | self = [super init];
28 |
29 | _nThemeIndex = [[[NSUserDefaults standardUserDefaults] objectForKey:kTHEME_TAG] integerValue];
30 | _themefold = [[NSUserDefaults standardUserDefaults] objectForKey:kTHEMEFOLD_TAG];
31 |
32 | return self;
33 | }
34 |
35 | - (void)setNThemeIndex:(int)nThemeIndex
36 | {
37 | _nThemeIndex = nThemeIndex;
38 | [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInt:nThemeIndex] forKey:kTHEME_TAG];
39 | }
40 |
41 | - (void)setThemefold:(NSString *)themefold
42 | {
43 | _themefold = themefold;
44 | [[NSUserDefaults standardUserDefaults] setObject:_themefold forKey:kTHEMEFOLD_TAG];
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/IMFiveApp/QHUtills/QHViewTag.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewTag.h
3 | // KGKit
4 | //
5 | // Created by chen on 14-5-29.
6 | // Copyright (c) 2014年 14zynr. All rights reserved.
7 | //
8 |
9 | #ifndef KGKit_ViewTag_h
10 | #define KGKit_ViewTag_h
11 |
12 | #define isIos7 ([[[UIDevice currentDevice] systemVersion] floatValue])
13 | #define StatusbarSize ((isIos7 >= 7 && __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1)?20.f:0.f)
14 |
15 | #define RGBA(R/*红*/, G/*绿*/, B/*蓝*/, A/*透明*/) \
16 | [UIColor colorWithRed:R/255.f green:G/255.f blue:B/255.f alpha:A]
17 |
18 | /* { thread } */
19 | #define __async_opt__ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
20 | #define __async_main__ dispatch_async(dispatch_get_main_queue()
21 |
22 | #define RELOADIMAGE @"reloadImage"
23 |
24 | #endif
25 |
26 | #import "QHConfiguredObj.h"
27 |
--------------------------------------------------------------------------------
/IMFiveApp/RectViewForMessage.h:
--------------------------------------------------------------------------------
1 | //
2 | // RectViewForMessage.h
3 | // IMApp
4 | //
5 | // Created by chen on 14/7/27.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class RectViewForMessage;
12 |
13 | @protocol RectViewForMessageDelegate
14 |
15 | @optional
16 |
17 | - (void)press:(RectViewForMessage *)rectView index:(int)nIndex;
18 |
19 | @end
20 |
21 | @interface RectViewForMessage : UIView
22 |
23 | @property (nonatomic, weak) id delegate;
24 |
25 | - (id)initWithFrame:(CGRect)frame sumOfLine:(int)nSumLine;
26 |
27 | - (id)initWithFrame:(CGRect)frame ar:(NSArray *)arData showSpera:(BOOL)bSpera bg:(NSString *)bgName;
28 |
29 | - (void)reloadMenuImage;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/IMFiveApp/RectViewForMessage.m:
--------------------------------------------------------------------------------
1 | //
2 | // RectViewForMessage.m
3 | // IMApp
4 | //
5 | // Created by chen on 14/7/27.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "RectViewForMessage.h"
10 |
11 | @interface RectViewForMessage ()
12 | {
13 | int _nSumOfLine;
14 | NSArray *_arData;
15 | BOOL _bSpera;
16 | NSString *_bgName;
17 | }
18 |
19 | @end
20 |
21 | @implementation RectViewForMessage
22 |
23 | - (id)initWithFrame:(CGRect)frame
24 | {
25 | return [self initWithFrame:frame sumOfLine:0];
26 | }
27 |
28 | - (id)initWithFrame:(CGRect)frame sumOfLine:(int)nSumLine
29 | {
30 | self = [super initWithFrame:frame];
31 | if (self)
32 | {
33 | _nSumOfLine = nSumLine + 1;
34 | }
35 | return self;
36 | }
37 |
38 | - (id)initWithFrame:(CGRect)frame ar:(NSArray *)arData showSpera:(BOOL)bSpera bg:(NSString *)bgName
39 | {
40 | self = [super initWithFrame:frame];
41 | if (self)
42 | {
43 | _arData = arData;
44 | _nSumOfLine = [_arData count];
45 | _bSpera = bSpera;
46 | _bgName = bgName;
47 | [self createLabel];
48 | }
49 | return self;
50 | }
51 |
52 | - (void)createLabel
53 | {
54 | [self setBackgroundColor:[UIColor whiteColor]];
55 |
56 | UIImage *imageBg = [QHCommonUtil imageNamed:_bgName];
57 | // imageBg = [imageBg resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
58 | UIImageView *imageIVBg = [[UIImageView alloc] initWithFrame:self.bounds];
59 | imageIVBg.tag = 32;
60 | [imageIVBg setImage:imageBg];
61 | [self addSubview:imageIVBg];
62 |
63 | float nW = self.width/_nSumOfLine;
64 | float nH = self.height/6;
65 | float nIR = MIN(nW, nH * 3);
66 |
67 | [_arData enumerateObjectsUsingBlock:^(NSArray *obj, NSUInteger idx, BOOL *stop)
68 | {
69 | UIImage *image = [QHCommonUtil imageNamed:[obj objectAtIndex:1]];
70 | UIImageView *imageIV = [[UIImageView alloc] initWithFrame:CGRectMake(idx * nW + (nW - nIR)/2, nH, nIR, nIR)];
71 | [imageIV setImage:image];
72 | imageIV.tag = idx + 33;
73 | [self addSubview:imageIV];
74 |
75 | UILabel *t = [[UILabel alloc] initWithFrame:CGRectMake(idx * nW, imageIV.bottom, nW - 1, nH*2)];
76 | [t setTextAlignment:NSTextAlignmentCenter];
77 | [t setFont:[UIFont systemFontOfSize:13]];
78 | [t setText:[obj objectAtIndex:0]];
79 | [self addSubview:t];
80 | }];
81 | }
82 |
83 | /*
84 | // Only override drawRect: if you perform custom drawing.
85 | // An empty implementation adversely affects performance during animation.
86 | */
87 | - (void)drawRect:(CGRect)rect
88 | {
89 | // Drawing code
90 | if (_bSpera)
91 | {
92 | float nW = self.width/_nSumOfLine;
93 | float nH = self.height;
94 | for (int i = 1; i < _nSumOfLine; i++)
95 | {
96 | CGContextRef context = UIGraphicsGetCurrentContext();
97 | CGContextSetStrokeColorWithColor(context, [UIColor grayColor].CGColor);
98 | CGContextSetLineWidth(context, 0.5);
99 |
100 | CGPoint *point = (CGPoint *) malloc(sizeof(CGPoint) * 2);
101 | point[0] = CGPointMake(i * nW, 0);
102 | point[1] = CGPointMake(i * nW, nH);
103 | CGContextBeginPath(context);
104 | CGContextAddLines(context, point, 2);
105 | CGContextClosePath(context);
106 | CGContextStrokePath(context);
107 | free(point);
108 | }
109 | }
110 | }
111 |
112 | - (void)reloadMenuImage
113 | {
114 | if (_bgName != nil)
115 | {
116 | UIImage *imageBg = [QHCommonUtil imageNamed:_bgName];
117 | UIImageView *imageIV = (UIImageView *)[self viewWithTag:32];
118 | [imageIV setImage:imageBg];
119 | }
120 |
121 | [_arData enumerateObjectsUsingBlock:^(NSArray *obj, NSUInteger idx, BOOL *stop)
122 | {
123 | UIImage *image = [QHCommonUtil imageNamed:[obj objectAtIndex:1]];
124 | UIImageView *imageIV = (UIImageView *)[self viewWithTag:(idx + 33)];
125 | [imageIV setImage:image];
126 | }];
127 | }
128 |
129 | #pragma mark - UIResponder
130 |
131 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
132 | {
133 |
134 | }
135 |
136 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
137 | {
138 | UITouch *touch = [touches anyObject];
139 | CGPoint touchLocatin = [touch locationInView:self];
140 | float nW = self.width/_nSumOfLine;
141 | int index = touchLocatin.x/nW;
142 | if ([_delegate respondsToSelector:@selector(press:index:)])
143 | {
144 | [_delegate press:self index:index];
145 | }
146 | }
147 |
148 | @end
149 |
--------------------------------------------------------------------------------
/IMFiveApp/SelectThemeCollectionViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // SelectThemeCollectionViewCell.h
3 | // IMFiveApp
4 | //
5 | // Created by chen on 14-8-30.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SelectThemeCollectionViewCell : UICollectionViewCell
12 |
13 | - (void)setDataForView:(NSArray *)ar selected:(BOOL)bSelected;
14 |
15 | - (void)setDataForView:(NSArray *)ar index:(NSIndexPath *)indexPath;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/IMFiveApp/SelectThemeCollectionViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // SelectThemeCollectionViewCell.m
3 | // IMFiveApp
4 | //
5 | // Created by chen on 14-8-30.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "SelectThemeCollectionViewCell.h"
10 |
11 | @implementation SelectThemeCollectionViewCell
12 |
13 | - (id)initWithFrame:(CGRect)frame
14 | {
15 | self = [super initWithFrame:frame];
16 | if (self) {
17 | // Initialization code
18 |
19 | [self initView];
20 | }
21 | return self;
22 | }
23 |
24 | - (void)initView
25 | {
26 | self.contentView.frame = CGRectMake(5, 0, self.width, self.height);
27 | self.contentView.layer.borderWidth = 1;
28 | self.contentView.layer.cornerRadius = 6;
29 | self.contentView.layer.borderColor = [UIColor grayColor].CGColor;
30 |
31 | float w = self.height/5;
32 | float wIV = w*4;
33 |
34 | UIImageView *titleIV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.width, wIV)];
35 | [titleIV setBackgroundColor:[UIColor clearColor]];
36 | titleIV.tag = 11;
37 | [self.contentView addSubview:titleIV];
38 |
39 | UILabel *titleL = [[UILabel alloc] initWithFrame:CGRectMake(0, titleIV.bottom, self.contentView.width, self.contentView.height - titleIV.bottom)];
40 | titleL.tag = 12;
41 | [self.contentView addSubview:titleL];
42 |
43 | UIImage *i = [UIImage imageNamed:@"common_green_checkbox.png"];
44 | UIImageView *selectIV = [[UIImageView alloc] initWithFrame:CGRectMake(self.contentView.width - titleL.height - 5, titleL.top, titleL.height, titleL.height)];
45 | [selectIV setImage:i];
46 | selectIV.tag = 13;
47 | [self.contentView addSubview:selectIV];
48 | }
49 |
50 | - (void)setDataForView:(NSArray *)ar selected:(BOOL)bSelected
51 | {
52 | UIImageView *titleIV = (UIImageView *)[self.contentView viewWithTag:11];
53 | // titleIV.contentMode = UIViewContentModeScaleAspectFit;
54 | [titleIV setImage:[UIImage imageNamed:[ar objectAtIndex:2]]];
55 |
56 | UILabel *titleL = (UILabel *)[self.contentView viewWithTag:12];
57 | [titleL setTextAlignment:NSTextAlignmentCenter];
58 | titleL.text = [ar objectAtIndex:0];
59 |
60 | UIImageView *selectIV = (UIImageView *)[self.contentView viewWithTag:13];
61 | [selectIV setHidden:!bSelected];
62 | }
63 |
64 | - (void)setDataForView:(NSArray *)ar index:(NSIndexPath *)indexPath
65 | {
66 | if ([QHConfiguredObj defaultConfigure].nThemeIndex == indexPath.row)
67 | [self setDataForView:ar selected:YES];
68 | else
69 | [self setDataForView:ar selected:NO];
70 | }
71 |
72 | @end
73 |
--------------------------------------------------------------------------------
/IMFiveApp/SelectThemeViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SelectThemeViewController.h
3 | // IMFiveApp
4 | //
5 | // Created by chen on 14-8-29.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "QHBasicViewController.h"
10 |
11 | @interface SelectThemeViewController : QHBasicViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/IMFiveApp/SelectThemeViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // SelectThemeViewController.m
3 | // IMFiveApp
4 | //
5 | // Created by chen on 14-8-29.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "SelectThemeViewController.h"
10 |
11 | #import "SelectThemeCollectionViewCell.h"
12 |
13 | @interface SelectThemeViewController ()
14 | {
15 | UICollectionView *_collectionV;
16 | NSArray *_arData;
17 |
18 | int nSelectIndex;
19 | }
20 |
21 | @end
22 |
23 | @implementation SelectThemeViewController
24 |
25 | - (void)viewDidLoad
26 | {
27 | [super viewDidLoad];
28 |
29 | [self addObserver];
30 |
31 | [self.view setBackgroundColor:[UIColor whiteColor]];
32 |
33 | [self createNavWithTitle:@"猪蹄商场" createMenuItem:^UIView *(int nIndex)
34 | {
35 | if (nIndex == 1)
36 | {
37 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
38 | [btn setFrame:CGRectMake(10, (self.navView.height - 40)/2, 60, 40)];
39 | [btn addTarget:self action:@selector(backAction:) forControlEvents:UIControlEventTouchUpInside];
40 |
41 | UILabel *btnL = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, btn.width - 15, btn.height)];
42 | [btnL setText:@"返回"];
43 | [btnL setTextColor:[UIColor whiteColor]];
44 | [btn addSubview:btnL];
45 |
46 | return btn;
47 | }
48 | return nil;
49 | }];
50 |
51 | UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
52 | flowLayout.itemSize = CGSizeMake(self.view.width/2 - 5, 90);
53 | flowLayout.minimumInteritemSpacing = 0;//列距
54 | _collectionV = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.navView.bottom + 10, self.view.width, self.view.height - self.navView.bottom - 10) collectionViewLayout:flowLayout];
55 | [_collectionV registerClass:[SelectThemeCollectionViewCell class] forCellWithReuseIdentifier:@"colletionCell"];
56 | _collectionV.backgroundColor = [UIColor clearColor];
57 | _collectionV.dataSource = self;
58 | _collectionV.delegate = self;
59 | [self.view addSubview:_collectionV];
60 |
61 | [self initData];
62 | [_collectionV reloadData];
63 | }
64 |
65 | - (void)initData
66 | {
67 | _arData = @[@[@"默认", @"", @"theme_icon.png"],
68 | @[@"海洋", @"com.skin.1110", @"theme_icon_sea.png"],
69 | @[@"外星人", @"com.skin.1114", @"theme_icon_universe.png"],
70 | @[@"小黄鸭", @"com.skin.1108", @"theme_icon_yellowduck.png"],
71 | @[@"企鹅", @"com.skin.1098", @"theme_icon_penguin.png"]];
72 | }
73 |
74 | #pragma mark - action
75 |
76 | - (void)backAction:(UIButton *)btn
77 | {
78 | [self.navigationController popViewControllerAnimated:YES];
79 | }
80 |
81 | #pragma mark - UICollectionViewDataSource
82 |
83 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
84 | {
85 | return [_arData count];
86 | }
87 |
88 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
89 | {
90 | NSString *reuseIdetify = @"colletionCell";
91 | SelectThemeCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdetify forIndexPath:indexPath];
92 |
93 | [cell setDataForView:[_arData objectAtIndex:indexPath.row] index:indexPath];
94 |
95 | return cell;
96 | }
97 |
98 | #pragma mark - UICollectionViewDelegate
99 |
100 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
101 | {
102 | [collectionView deselectItemAtIndexPath:indexPath animated:YES];
103 |
104 | NSArray *ar = [_arData objectAtIndex:indexPath.row];
105 | [QHConfiguredObj defaultConfigure].nThemeIndex = indexPath.row;
106 | [QHConfiguredObj defaultConfigure].themefold = [ar objectAtIndex:1];
107 | [_collectionV reloadData];
108 |
109 | if ([ar objectAtIndex:1] != nil && ((NSString *)[ar objectAtIndex:1]).length > 0)
110 | [QHCommonUtil unzipFileToDocument:[ar objectAtIndex:1]];
111 |
112 | [[NSNotificationCenter defaultCenter] postNotificationName:RELOADIMAGE object:nil];
113 | }
114 |
115 | - (void)reloadImage:(NSNotificationCenter *)notif
116 | {
117 | [super reloadImage:notif];
118 | }
119 |
120 | @end
121 |
--------------------------------------------------------------------------------
/IMFiveApp/SliderViewController/SliderViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SliderViewController.h
3 | // LeftRightSlider
4 | //
5 | // Created by Zhao Yiqi on 13-11-27.
6 | // Copyright (c) 2013年 Zhao Yiqi. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SliderViewController : UIViewController
12 |
13 | @property(nonatomic,strong)UIViewController *LeftVC;
14 | @property(nonatomic,strong)UIViewController *RightVC;
15 | @property(nonatomic,strong)UIViewController *MainVC;
16 |
17 | @property(nonatomic,strong)NSMutableDictionary *controllersDict;
18 |
19 | @property(nonatomic,assign)float LeftSContentOffset;
20 | @property(nonatomic,assign)float LeftContentViewSContentOffset;
21 | @property(nonatomic,assign)float RightSContentOffset;
22 |
23 | @property(nonatomic,assign)float LeftSContentScale;
24 | @property(nonatomic,assign)float RightSContentScale;
25 |
26 | @property(nonatomic,assign)float LeftSJudgeOffset;
27 | @property(nonatomic,assign)float RightSJudgeOffset;
28 |
29 | @property(nonatomic,assign)float LeftSOpenDuration;
30 | @property(nonatomic,assign)float RightSOpenDuration;
31 |
32 | @property(nonatomic,assign)float LeftSCloseDuration;
33 | @property(nonatomic,assign)float RightSCloseDuration;
34 |
35 | @property(nonatomic,assign)BOOL canShowLeft;
36 | @property(nonatomic,assign)BOOL canShowRight;
37 |
38 | @property (nonatomic, copy) void(^changeLeftView)(CGFloat sca, CGFloat transX);
39 |
40 | + (SliderViewController*)sharedSliderController;
41 |
42 | - (void)showContentControllerWithModel:(NSString*)className;
43 | - (void)showLeftViewController;
44 | - (void)showRightViewController;
45 |
46 | - (void)moveViewWithGesture:(UIPanGestureRecognizer *)panGes;
47 | - (void)closeSideBar;
48 | - (void)closeSideBarWithAnimate:(BOOL)bAnimate complete:(void(^)(BOOL finished))complete;
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/IMFiveApp/ViewExtend/QHBasicViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // QHBasicViewController.h
3 | // helloworld
4 | //
5 | // Created by chen on 14/6/30.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface QHBasicViewController : UIViewController
12 |
13 | @property (nonatomic, strong) UIImageView *statusBarView;
14 | @property (nonatomic, strong) UIView *navView;
15 | @property (nonatomic, assign, readonly) int nMutiple;
16 | @property (nonatomic, strong) NSArray *arParams;
17 | @property (nonatomic, strong) UIView *rightV;
18 |
19 | - (id)initWithFrame:(CGRect)frame param:(NSArray *)arParams;
20 |
21 | - (void)createNavWithTitle:(NSString *)szTitle createMenuItem:(UIView *(^)(int nIndex))menuItem;
22 |
23 | - (void)reloadImage;
24 |
25 | - (void)reloadImage:(NSNotificationCenter *)notif;
26 |
27 | - (void)subReloadImage;
28 |
29 | - (void)addObserver;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/IMFiveApp/ViewExtend/QHBasicViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // QHBasicViewController.m
3 | // helloworld
4 | //
5 | // Created by chen on 14/6/30.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "QHBasicViewController.h"
10 |
11 | @interface QHBasicViewController ()
12 | {
13 | float _nSpaceNavY;
14 | }
15 |
16 | @end
17 |
18 | @implementation QHBasicViewController
19 |
20 | - (id)initWithFrame:(CGRect)frame param:(NSArray *)arParams
21 | {
22 | self.arParams = arParams;
23 |
24 | self = [super init];
25 |
26 | [self.view setFrame:frame];
27 |
28 | return self;
29 | }
30 |
31 | - (void)viewWillAppear:(BOOL)animated
32 | {
33 | [[self navigationController] setNavigationBarHidden:YES];
34 |
35 | [super viewWillAppear:TRUE];
36 | }
37 |
38 | - (void)viewDidLoad
39 | {
40 | [super viewDidLoad];
41 |
42 | self.view.backgroundColor = RGBA(236.f, 236.f, 236.f, 1);
43 | _statusBarView = [[UIImageView alloc] initWithFrame:CGRectMake(0.f, 0.f, 320, 0.f)];
44 | _nSpaceNavY = 20;
45 | if (isIos7 >= 7 && __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1)
46 | {
47 | _statusBarView.frame = CGRectMake(_statusBarView.frame.origin.x, _statusBarView.frame.origin.y, _statusBarView.frame.size.width, 20.f);
48 | _statusBarView.backgroundColor = [UIColor clearColor];
49 | ((UIImageView *)_statusBarView).backgroundColor = [UIColor clearColor];
50 | [self.view addSubview:_statusBarView];
51 | //[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
52 |
53 | _nSpaceNavY = 0;
54 | }
55 | }
56 |
57 | - (void)createNavWithTitle:(NSString *)szTitle createMenuItem:(UIView *(^)(int nIndex))menuItem
58 | {
59 | UIImageView *navIV = [[UIImageView alloc] initWithFrame:CGRectMake(0, _nSpaceNavY, self.view.width, 64 - _nSpaceNavY)];
60 | navIV.tag = 98;
61 | [self.view addSubview:navIV];
62 | [self reloadImage];
63 |
64 | /* { 导航条 } */
65 | _navView = [[UIImageView alloc] initWithFrame:CGRectMake(0.f, StatusbarSize, 320, 44.f)];
66 | ((UIImageView *)_navView).backgroundColor = [UIColor clearColor];
67 | [self.view addSubview:_navView];
68 | _navView.userInteractionEnabled = YES;
69 |
70 | UILabel *titleLabel;
71 | if (szTitle != nil)
72 | {
73 | titleLabel = [[UILabel alloc] initWithFrame:CGRectMake((_navView.width - 200)/2, (_navView.height - 40)/2, 200, 40)];
74 | [titleLabel setText:szTitle];
75 | [titleLabel setTextAlignment:NSTextAlignmentCenter];
76 | [titleLabel setTextColor:[UIColor whiteColor]];
77 | [titleLabel setFont:[UIFont boldSystemFontOfSize:18]];
78 | [titleLabel setBackgroundColor:[UIColor clearColor]];
79 | [_navView addSubview:titleLabel];
80 | }
81 |
82 | UIView *item1 = menuItem(0);
83 | if (item1 != nil)
84 | {
85 | [_navView addSubview:item1];
86 | }
87 | UIView *item2 = menuItem(1);
88 | if (item2 != nil)
89 | {
90 | _rightV = item2;
91 | [_navView addSubview:item2];
92 | }
93 | }
94 |
95 | - (void)addObserver
96 | {
97 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(observerReloadImage:) name:RELOADIMAGE object:nil];
98 | }
99 |
100 | - (void)reloadImage
101 | {
102 | NSString *imageName = nil;
103 | if (isIos7 >= 7 && __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1)
104 | {
105 | imageName = @"header_bg_ios7.png";
106 | }else
107 | {
108 | imageName = @"header_bg.png";
109 | }
110 | UIImage *image = [QHCommonUtil imageNamed:imageName];
111 | UIImageView *navIV = (UIImageView *)[self.view viewWithTag:98];
112 | [navIV setImage:image];
113 | }
114 |
115 | - (void)observerReloadImage:(NSNotificationCenter *)notif
116 | {
117 | [self reloadImage:notif];
118 | }
119 |
120 | - (void)reloadImage:(NSNotificationCenter *)notif
121 | {
122 | [self reloadImage];
123 | }
124 |
125 | - (void)subReloadImage
126 | {
127 | NSLog(@"subReloadImage");
128 | }
129 |
130 | @end
131 |
--------------------------------------------------------------------------------
/IMFiveApp/ViewExtend/UIView+KGViewExtend.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+KGView.h
3 | // rewardWall
4 | //
5 | // Created by chen on 14-5-23.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIView (KGViewExtend)
12 |
13 | /**
14 | * Shortcut for frame.origin.x.
15 | *
16 | * Sets frame.origin.x = left
17 | */
18 | @property (nonatomic) CGFloat left;
19 |
20 | /**
21 | * Shortcut for frame.origin.y
22 | *
23 | * Sets frame.origin.y = top
24 | */
25 | @property (nonatomic) CGFloat top;
26 |
27 | /**
28 | * Shortcut for frame.origin.x + frame.size.width
29 | *
30 | * Sets frame.origin.x = right - frame.size.width
31 | */
32 | @property (nonatomic) CGFloat right;
33 |
34 | /**
35 | * Shortcut for frame.origin.y + frame.size.height
36 | *
37 | * Sets frame.origin.y = bottom - frame.size.height
38 | */
39 | @property (nonatomic) CGFloat bottom;
40 |
41 | /**
42 | * Shortcut for frame.size.width
43 | *
44 | * Sets frame.size.width = width
45 | */
46 | @property (nonatomic) CGFloat width;
47 |
48 | /**
49 | * Shortcut for frame.size.height
50 | *
51 | * Sets frame.size.height = height
52 | */
53 | @property (nonatomic) CGFloat height;
54 |
55 | /**
56 | * Shortcut for center.x
57 | *
58 | * Sets center.x = centerX
59 | */
60 | @property (nonatomic) CGFloat centerX;
61 |
62 | /**
63 | * Shortcut for center.y
64 | *
65 | * Sets center.y = centerY
66 | */
67 | @property (nonatomic) CGFloat centerY;
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/IMFiveApp/ViewExtend/UIView+KGViewExtend.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+KGView.m
3 | // rewardWall
4 | //
5 | // Created by chen on 14-5-23.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import "UIView+KGViewExtend.h"
10 |
11 | @implementation UIView (KGViewExtend)
12 | - (CGFloat)left {
13 | return self.frame.origin.x;
14 | }
15 |
16 |
17 | ///////////////////////////////////////////////////////////////////////////////////////////////////
18 | - (void)setLeft:(CGFloat)x {
19 | CGRect frame = self.frame;
20 | frame.origin.x = x;
21 | self.frame = frame;
22 | }
23 |
24 |
25 | ///////////////////////////////////////////////////////////////////////////////////////////////////
26 | - (CGFloat)top {
27 | return self.frame.origin.y;
28 | }
29 |
30 |
31 | ///////////////////////////////////////////////////////////////////////////////////////////////////
32 | - (void)setTop:(CGFloat)y {
33 | CGRect frame = self.frame;
34 | frame.origin.y = y;
35 | self.frame = frame;
36 | }
37 |
38 |
39 | ///////////////////////////////////////////////////////////////////////////////////////////////////
40 | - (CGFloat)right {
41 | return self.frame.origin.x + self.width;
42 | }
43 |
44 |
45 | ///////////////////////////////////////////////////////////////////////////////////////////////////
46 | - (void)setRight:(CGFloat)right {
47 | CGRect frame = self.frame;
48 | frame.origin.x = right - frame.size.width;
49 | self.frame = frame;
50 | }
51 |
52 |
53 | ///////////////////////////////////////////////////////////////////////////////////////////////////
54 | - (CGFloat)bottom {
55 | return self.frame.origin.y + self.frame.size.height;
56 | }
57 |
58 |
59 | ///////////////////////////////////////////////////////////////////////////////////////////////////
60 | - (void)setBottom:(CGFloat)bottom {
61 | CGRect frame = self.frame;
62 | frame.origin.y = bottom - frame.size.height;
63 | self.frame = frame;
64 | }
65 |
66 |
67 | ///////////////////////////////////////////////////////////////////////////////////////////////////
68 | - (CGFloat)centerX {
69 | return self.center.x;
70 | }
71 |
72 |
73 | ///////////////////////////////////////////////////////////////////////////////////////////////////
74 | - (void)setCenterX:(CGFloat)centerX {
75 | self.center = CGPointMake(centerX, self.center.y);
76 | }
77 |
78 |
79 | ///////////////////////////////////////////////////////////////////////////////////////////////////
80 | - (CGFloat)centerY {
81 | return self.center.y;
82 | }
83 |
84 |
85 | ///////////////////////////////////////////////////////////////////////////////////////////////////
86 | - (void)setCenterY:(CGFloat)centerY {
87 | self.center = CGPointMake(self.center.x, centerY);
88 | }
89 |
90 |
91 | ///////////////////////////////////////////////////////////////////////////////////////////////////
92 | - (CGFloat)width {
93 | return self.frame.size.width;
94 | }
95 |
96 |
97 | ///////////////////////////////////////////////////////////////////////////////////////////////////
98 | - (void)setWidth:(CGFloat)width {
99 | CGRect frame = self.frame;
100 | frame.size.width = width;
101 | self.frame = frame;
102 | }
103 |
104 |
105 | ///////////////////////////////////////////////////////////////////////////////////////////////////
106 | - (CGFloat)height {
107 | return self.frame.size.height;
108 | }
109 |
110 |
111 | ///////////////////////////////////////////////////////////////////////////////////////////////////
112 | - (void)setHeight:(CGFloat)height {
113 | CGRect frame = self.frame;
114 | frame.size.height = height;
115 | self.frame = frame;
116 | }
117 |
118 | @end
119 |
--------------------------------------------------------------------------------
/IMFiveApp/ZipArchive/ZipArchive.h:
--------------------------------------------------------------------------------
1 | //
2 | // ZipArchive.h
3 | //
4 | //
5 | // Created by aish on 08-9-11.
6 | // acsolu@gmail.com
7 | // Copyright 2008 Inc. All rights reserved.
8 | //
9 | // History:
10 | // 09-11-2008 version 1.0 release
11 | // 10-18-2009 version 1.1 support password protected zip files
12 | // 10-21-2009 version 1.2 fix date bug
13 |
14 | #import
15 |
16 | #include "minizip/zip.h"
17 | #include "minizip/unzip.h"
18 |
19 |
20 | @protocol ZipArchiveDelegate
21 | @optional
22 | -(void) ErrorMessage:(NSString*) msg;
23 | -(BOOL) OverWriteOperation:(NSString*) file;
24 |
25 | @end
26 |
27 |
28 | @interface ZipArchive : NSObject {
29 | @private
30 | zipFile _zipFile;
31 | unzFile _unzFile;
32 |
33 | NSString* _password;
34 | id _delegate;
35 | }
36 |
37 | @property (nonatomic, retain) id delegate;
38 |
39 | -(BOOL) CreateZipFile2:(NSString*) zipFile;
40 | -(BOOL) CreateZipFile2:(NSString*) zipFile Password:(NSString*) password;
41 | -(BOOL) addFileToZip:(NSString*) file newname:(NSString*) newname;
42 | -(BOOL) CloseZipFile2;
43 |
44 | -(BOOL) UnzipOpenFile:(NSString*) zipFile;
45 | -(BOOL) UnzipOpenFile:(NSString*) zipFile Password:(NSString*) password;
46 | -(BOOL) UnzipFileTo:(NSString*) path overWrite:(BOOL) overwrite;
47 | -(BOOL) UnzipCloseFile;
48 | @end
49 |
--------------------------------------------------------------------------------
/IMFiveApp/ZipArchive/ZipArchive.mm:
--------------------------------------------------------------------------------
1 | //
2 | // ZipArchive.mm
3 | //
4 | //
5 | // Created by aish on 08-9-11.
6 | // acsolu@gmail.com
7 | // Copyright 2008 Inc. All rights reserved.
8 | //
9 |
10 | #import "ZipArchive.h"
11 | #import "zlib.h"
12 | #import "zconf.h"
13 |
14 |
15 |
16 | @interface ZipArchive (Private)
17 |
18 | -(void) OutputErrorMessage:(NSString*) msg;
19 | -(BOOL) OverWrite:(NSString*) file;
20 | -(NSDate*) Date1980;
21 | @end
22 |
23 |
24 |
25 | @implementation ZipArchive
26 | @synthesize delegate = _delegate;
27 |
28 | -(id) init
29 | {
30 | if( self=[super init] )
31 | {
32 | _zipFile = NULL ;
33 | }
34 | return self;
35 | }
36 |
37 | -(void) dealloc
38 | {
39 | [self CloseZipFile2];
40 | }
41 |
42 | -(BOOL) CreateZipFile2:(NSString*) zipFile
43 | {
44 | _zipFile = zipOpen( (const char*)[zipFile UTF8String], 0 );
45 | if( !_zipFile )
46 | return NO;
47 | return YES;
48 | }
49 |
50 | -(BOOL) CreateZipFile2:(NSString*) zipFile Password:(NSString*) password
51 | {
52 | _password = password;
53 | return [self CreateZipFile2:zipFile];
54 | }
55 |
56 | -(BOOL) addFileToZip:(NSString*) file newname:(NSString*) newname;
57 | {
58 | if( !_zipFile )
59 | return NO;
60 | // tm_zip filetime;
61 | time_t current;
62 | time( ¤t );
63 |
64 | zip_fileinfo zipInfo = {0};
65 | // zipInfo.dosDate = (unsigned long) current;
66 |
67 | NSDictionary* attr = [[NSFileManager defaultManager] fileAttributesAtPath:file traverseLink:YES];
68 | if( attr )
69 | {
70 | NSDate* fileDate = (NSDate*)[attr objectForKey:NSFileModificationDate];
71 | if( fileDate )
72 | {
73 | // some application does use dosDate, but tmz_date instead
74 | // zipInfo.dosDate = [fileDate timeIntervalSinceDate:[self Date1980] ];
75 | NSCalendar* currCalendar = [NSCalendar currentCalendar];
76 | uint flags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit |
77 | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit ;
78 | NSDateComponents* dc = [currCalendar components:flags fromDate:fileDate];
79 | zipInfo.tmz_date.tm_sec = [dc second];
80 | zipInfo.tmz_date.tm_min = [dc minute];
81 | zipInfo.tmz_date.tm_hour = [dc hour];
82 | zipInfo.tmz_date.tm_mday = [dc day];
83 | zipInfo.tmz_date.tm_mon = [dc month] - 1;
84 | zipInfo.tmz_date.tm_year = [dc year];
85 | }
86 | }
87 |
88 | NSUInteger ret ;
89 | NSData* data = nil;
90 | if( [_password length] == 0 )
91 | {
92 | ret = zipOpenNewFileInZip( _zipFile,
93 | (const char*) [newname UTF8String],
94 | &zipInfo,
95 | NULL,0,
96 | NULL,0,
97 | NULL,//comment
98 | Z_DEFLATED,
99 | Z_DEFAULT_COMPRESSION );
100 | }
101 | else
102 | {
103 | data = [ NSData dataWithContentsOfFile:file];
104 | uLong crcValue = crc32( 0L,NULL, 0L );
105 | crcValue = crc32( crcValue, (const Bytef*)[data bytes], [data length] );
106 | ret = zipOpenNewFileInZip3( _zipFile,
107 | (const char*) [newname UTF8String],
108 | &zipInfo,
109 | NULL,0,
110 | NULL,0,
111 | NULL,//comment
112 | Z_DEFLATED,
113 | Z_DEFAULT_COMPRESSION,
114 | 0,
115 | 15,
116 | 8,
117 | Z_DEFAULT_STRATEGY,
118 | [_password cStringUsingEncoding:NSASCIIStringEncoding],
119 | crcValue );
120 | }
121 | if( ret!=Z_OK )
122 | {
123 | return NO;
124 | }
125 | if( data==nil )
126 | {
127 | data = [ NSData dataWithContentsOfFile:file];
128 | }
129 | NSUInteger dataLen = [data length];
130 | ret = zipWriteInFileInZip( _zipFile, (const void*)[data bytes], dataLen);
131 | if( ret!=Z_OK )
132 | {
133 | return NO;
134 | }
135 | ret = zipCloseFileInZip( _zipFile );
136 | if( ret!=Z_OK )
137 | return NO;
138 | return YES;
139 | }
140 |
141 | -(BOOL) CloseZipFile2
142 | {
143 | _password = nil;
144 | if( _zipFile==NULL )
145 | return NO;
146 | BOOL ret = zipClose( _zipFile,NULL )==Z_OK?YES:NO;
147 | _zipFile = NULL;
148 | return ret;
149 | }
150 |
151 | -(BOOL) UnzipOpenFile:(NSString*) zipFile
152 | {
153 | _unzFile = unzOpen( (const char*)[zipFile UTF8String] );
154 | if( _unzFile )
155 | {
156 | unz_global_info globalInfo = {0};
157 | if( unzGetGlobalInfo(_unzFile, &globalInfo )==UNZ_OK )
158 | {
159 | NSLog([NSString stringWithFormat:@"%lu entries in the zip file",globalInfo.number_entry] );
160 | }
161 | }
162 | return _unzFile!=NULL;
163 | }
164 |
165 | -(BOOL) UnzipOpenFile:(NSString*) zipFile Password:(NSString*) password
166 | {
167 | _password = password;
168 | return [self UnzipOpenFile:zipFile];
169 | }
170 |
171 | -(BOOL) UnzipFileTo:(NSString*) path overWrite:(BOOL) overwrite
172 | {
173 | BOOL success = YES;
174 | int ret = unzGoToFirstFile( _unzFile );
175 | unsigned char buffer[4096] = {0};
176 | NSFileManager* fman = [NSFileManager defaultManager];
177 | if( ret!=UNZ_OK )
178 | {
179 | [self OutputErrorMessage:@"Failed"];
180 | }
181 |
182 | do{
183 | if( [_password length]==0 )
184 | ret = unzOpenCurrentFile( _unzFile );
185 | else
186 | ret = unzOpenCurrentFilePassword( _unzFile, [_password cStringUsingEncoding:NSASCIIStringEncoding] );
187 | if( ret!=UNZ_OK )
188 | {
189 | [self OutputErrorMessage:@"Error occurs"];
190 | success = NO;
191 | break;
192 | }
193 | // reading data and write to file
194 | int read ;
195 | unz_file_info fileInfo ={0};
196 | ret = unzGetCurrentFileInfo(_unzFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0);
197 | if( ret!=UNZ_OK )
198 | {
199 | [self OutputErrorMessage:@"Error occurs while getting file info"];
200 | success = NO;
201 | unzCloseCurrentFile( _unzFile );
202 | break;
203 | }
204 | char* filename = (char*) malloc( fileInfo.size_filename +1 );
205 | unzGetCurrentFileInfo(_unzFile, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0);
206 | filename[fileInfo.size_filename] = '\0';
207 |
208 | // check if it contains directory
209 | NSString * strPath = [NSString stringWithCString:filename];
210 | BOOL isDirectory = NO;
211 | if( filename[fileInfo.size_filename-1]=='/' || filename[fileInfo.size_filename-1]=='\\')
212 | isDirectory = YES;
213 | free( filename );
214 | if( [strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location!=NSNotFound )
215 | {// contains a path
216 | strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"];
217 | }
218 | NSString* fullPath = [path stringByAppendingPathComponent:strPath];
219 |
220 | if( isDirectory )
221 | [fman createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:nil error:nil];
222 | else
223 | [fman createDirectoryAtPath:[fullPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:nil];
224 | if( [fman fileExistsAtPath:fullPath] && !isDirectory && !overwrite )
225 | {
226 | if( ![self OverWrite:fullPath] )
227 | {
228 | unzCloseCurrentFile( _unzFile );
229 | ret = unzGoToNextFile( _unzFile );
230 | continue;
231 | }
232 | }
233 | FILE* fp = fopen( (const char*)[fullPath UTF8String], "wb");
234 | while( fp )
235 | {
236 | read=unzReadCurrentFile(_unzFile, buffer, 4096);
237 | if( read > 0 )
238 | {
239 | fwrite(buffer, read, 1, fp );
240 | }
241 | else if( read<0 )
242 | {
243 | [self OutputErrorMessage:@"Failed to reading zip file"];
244 | break;
245 | }
246 | else
247 | break;
248 | }
249 | if( fp )
250 | {
251 | fclose( fp );
252 | // set the orignal datetime property
253 | NSDate* orgDate = nil;
254 |
255 | //{{ thanks to brad.eaton for the solution
256 | NSDateComponents *dc = [[NSDateComponents alloc] init];
257 |
258 | dc.second = fileInfo.tmu_date.tm_sec;
259 | dc.minute = fileInfo.tmu_date.tm_min;
260 | dc.hour = fileInfo.tmu_date.tm_hour;
261 | dc.day = fileInfo.tmu_date.tm_mday;
262 | dc.month = fileInfo.tmu_date.tm_mon+1;
263 | dc.year = fileInfo.tmu_date.tm_year;
264 |
265 | NSCalendar *gregorian = [[NSCalendar alloc]
266 | initWithCalendarIdentifier:NSGregorianCalendar];
267 |
268 | orgDate = [gregorian dateFromComponents:dc] ;
269 | //}}
270 |
271 |
272 | NSDictionary* attr = [NSDictionary dictionaryWithObject:orgDate forKey:NSFileModificationDate]; //[[NSFileManager defaultManager] fileAttributesAtPath:fullPath traverseLink:YES];
273 | if( attr )
274 | {
275 | // [attr setValue:orgDate forKey:NSFileCreationDate];
276 | if( ![[NSFileManager defaultManager] setAttributes:attr ofItemAtPath:fullPath error:nil] )
277 | {
278 | // cann't set attributes
279 | NSLog(@"Failed to set attributes");
280 | }
281 |
282 | }
283 |
284 |
285 |
286 | }
287 | unzCloseCurrentFile( _unzFile );
288 | ret = unzGoToNextFile( _unzFile );
289 | }while( ret==UNZ_OK && UNZ_OK!=UNZ_END_OF_LIST_OF_FILE );
290 | return success;
291 | }
292 |
293 | -(BOOL) UnzipCloseFile
294 | {
295 | _password = nil;
296 | if( _unzFile )
297 | return unzClose( _unzFile )==UNZ_OK;
298 | return YES;
299 | }
300 |
301 | #pragma mark wrapper for delegate
302 | -(void) OutputErrorMessage:(NSString*) msg
303 | {
304 | if( _delegate && [_delegate respondsToSelector:@selector(ErrorMessage)] )
305 | [_delegate ErrorMessage:msg];
306 | }
307 |
308 | -(BOOL) OverWrite:(NSString*) file
309 | {
310 | if( _delegate && [_delegate respondsToSelector:@selector(OverWriteOperation)] )
311 | return [_delegate OverWriteOperation:file];
312 | return YES;
313 | }
314 |
315 | #pragma mark get NSDate object for 1980-01-01
316 | -(NSDate*) Date1980
317 | {
318 | NSDateComponents *comps = [[NSDateComponents alloc] init];
319 | [comps setDay:1];
320 | [comps setMonth:1];
321 | [comps setYear:1980];
322 | NSCalendar *gregorian = [[NSCalendar alloc]
323 | initWithCalendarIdentifier:NSGregorianCalendar];
324 | NSDate *date = [gregorian dateFromComponents:comps];
325 |
326 | return date;
327 | }
328 |
329 |
330 | @end
331 |
332 |
333 |
--------------------------------------------------------------------------------
/IMFiveApp/ZipArchive/minizip/crypt.h:
--------------------------------------------------------------------------------
1 | /* crypt.h -- base code for crypt/uncrypt ZIPfile
2 |
3 |
4 | Version 1.01e, February 12th, 2005
5 |
6 | Copyright (C) 1998-2005 Gilles Vollant
7 |
8 | This code is a modified version of crypting code in Infozip distribution
9 |
10 | The encryption/decryption parts of this source code (as opposed to the
11 | non-echoing password parts) were originally written in Europe. The
12 | whole source package can be freely distributed, including from the USA.
13 | (Prior to January 2000, re-export from the US was a violation of US law.)
14 |
15 | This encryption code is a direct transcription of the algorithm from
16 | Roger Schlafly, described by Phil Katz in the file appnote.txt. This
17 | file (appnote.txt) is distributed with the PKZIP program (even in the
18 | version without encryption capabilities).
19 |
20 | If you don't need crypting in your application, just define symbols
21 | NOCRYPT and NOUNCRYPT.
22 |
23 | This code support the "Traditional PKWARE Encryption".
24 |
25 | The new AES encryption added on Zip format by Winzip (see the page
26 | http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
27 | Encryption is not supported.
28 | */
29 |
30 | #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
31 |
32 | /***********************************************************************
33 | * Return the next byte in the pseudo-random sequence
34 | */
35 | static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
36 | {
37 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
38 | * unpredictable manner on 16-bit systems; not a problem
39 | * with any known compiler so far, though */
40 |
41 | temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
42 | return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
43 | }
44 |
45 | /***********************************************************************
46 | * Update the encryption keys with the next byte of plain text
47 | */
48 | static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
49 | {
50 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
51 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
52 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
53 | {
54 | register int keyshift = (int)((*(pkeys+1)) >> 24);
55 | (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
56 | }
57 | return c;
58 | }
59 |
60 |
61 | /***********************************************************************
62 | * Initialize the encryption keys and the random header according to
63 | * the given password.
64 | */
65 | static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
66 | {
67 | *(pkeys+0) = 305419896L;
68 | *(pkeys+1) = 591751049L;
69 | *(pkeys+2) = 878082192L;
70 | while (*passwd != '\0') {
71 | update_keys(pkeys,pcrc_32_tab,(int)*passwd);
72 | passwd++;
73 | }
74 | }
75 |
76 | #define zdecode(pkeys,pcrc_32_tab,c) \
77 | (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
78 |
79 | #define zencode(pkeys,pcrc_32_tab,c,t) \
80 | (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
81 |
82 | #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
83 |
84 | #define RAND_HEAD_LEN 12
85 | /* "last resort" source for second part of crypt seed pattern */
86 | # ifndef ZCR_SEED2
87 | # define ZCR_SEED2 3141592654UL /* use PI as default pattern */
88 | # endif
89 |
90 | static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
91 | const char *passwd; /* password string */
92 | unsigned char *buf; /* where to write header */
93 | int bufSize;
94 | unsigned long* pkeys;
95 | const unsigned long* pcrc_32_tab;
96 | unsigned long crcForCrypting;
97 | {
98 | int n; /* index in random header */
99 | int t; /* temporary */
100 | int c; /* random byte */
101 | unsigned char header[RAND_HEAD_LEN-2]; /* random header */
102 | static unsigned calls = 0; /* ensure different random header each time */
103 |
104 | if (bufSize> 7) & 0xff;
119 | header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
120 | }
121 | /* Encrypt random header (last two bytes is high word of crc) */
122 | init_keys(passwd, pkeys, pcrc_32_tab);
123 | for (n = 0; n < RAND_HEAD_LEN-2; n++)
124 | {
125 | buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
126 | }
127 | buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
128 | buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
129 | return n;
130 | }
131 |
132 | #endif
133 |
--------------------------------------------------------------------------------
/IMFiveApp/ZipArchive/minizip/ioapi.c:
--------------------------------------------------------------------------------
1 | /* ioapi.c -- IO base function header for compress/uncompress .zip
2 | files using zlib + zip or unzip API
3 |
4 | Version 1.01e, February 12th, 2005
5 |
6 | Copyright (C) 1998-2005 Gilles Vollant
7 | */
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | #include "zlib.h"
14 | #include "ioapi.h"
15 |
16 |
17 |
18 | /* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
19 |
20 | #ifndef SEEK_CUR
21 | #define SEEK_CUR 1
22 | #endif
23 |
24 | #ifndef SEEK_END
25 | #define SEEK_END 2
26 | #endif
27 |
28 | #ifndef SEEK_SET
29 | #define SEEK_SET 0
30 | #endif
31 |
32 | voidpf ZCALLBACK fopen_file_func OF((
33 | voidpf opaque,
34 | const char* filename,
35 | int mode));
36 |
37 | uLong ZCALLBACK fread_file_func OF((
38 | voidpf opaque,
39 | voidpf stream,
40 | void* buf,
41 | uLong size));
42 |
43 | uLong ZCALLBACK fwrite_file_func OF((
44 | voidpf opaque,
45 | voidpf stream,
46 | const void* buf,
47 | uLong size));
48 |
49 | long ZCALLBACK ftell_file_func OF((
50 | voidpf opaque,
51 | voidpf stream));
52 |
53 | long ZCALLBACK fseek_file_func OF((
54 | voidpf opaque,
55 | voidpf stream,
56 | uLong offset,
57 | int origin));
58 |
59 | int ZCALLBACK fclose_file_func OF((
60 | voidpf opaque,
61 | voidpf stream));
62 |
63 | int ZCALLBACK ferror_file_func OF((
64 | voidpf opaque,
65 | voidpf stream));
66 |
67 |
68 | voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
69 | voidpf opaque;
70 | const char* filename;
71 | int mode;
72 | {
73 | FILE* file = NULL;
74 | const char* mode_fopen = NULL;
75 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
76 | mode_fopen = "rb";
77 | else
78 | if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
79 | mode_fopen = "r+b";
80 | else
81 | if (mode & ZLIB_FILEFUNC_MODE_CREATE)
82 | mode_fopen = "wb";
83 |
84 | if ((filename!=NULL) && (mode_fopen != NULL))
85 | file = fopen(filename, mode_fopen);
86 | return file;
87 | }
88 |
89 |
90 | uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
91 | voidpf opaque;
92 | voidpf stream;
93 | void* buf;
94 | uLong size;
95 | {
96 | uLong ret;
97 | ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
98 | return ret;
99 | }
100 |
101 |
102 | uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
103 | voidpf opaque;
104 | voidpf stream;
105 | const void* buf;
106 | uLong size;
107 | {
108 | uLong ret;
109 | ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
110 | return ret;
111 | }
112 |
113 | long ZCALLBACK ftell_file_func (opaque, stream)
114 | voidpf opaque;
115 | voidpf stream;
116 | {
117 | long ret;
118 | ret = ftell((FILE *)stream);
119 | return ret;
120 | }
121 |
122 | long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
123 | voidpf opaque;
124 | voidpf stream;
125 | uLong offset;
126 | int origin;
127 | {
128 | int fseek_origin=0;
129 | long ret;
130 | switch (origin)
131 | {
132 | case ZLIB_FILEFUNC_SEEK_CUR :
133 | fseek_origin = SEEK_CUR;
134 | break;
135 | case ZLIB_FILEFUNC_SEEK_END :
136 | fseek_origin = SEEK_END;
137 | break;
138 | case ZLIB_FILEFUNC_SEEK_SET :
139 | fseek_origin = SEEK_SET;
140 | break;
141 | default: return -1;
142 | }
143 | ret = 0;
144 | fseek((FILE *)stream, offset, fseek_origin);
145 | return ret;
146 | }
147 |
148 | int ZCALLBACK fclose_file_func (opaque, stream)
149 | voidpf opaque;
150 | voidpf stream;
151 | {
152 | int ret;
153 | ret = fclose((FILE *)stream);
154 | return ret;
155 | }
156 |
157 | int ZCALLBACK ferror_file_func (opaque, stream)
158 | voidpf opaque;
159 | voidpf stream;
160 | {
161 | int ret;
162 | ret = ferror((FILE *)stream);
163 | return ret;
164 | }
165 |
166 | void fill_fopen_filefunc (pzlib_filefunc_def)
167 | zlib_filefunc_def* pzlib_filefunc_def;
168 | {
169 | pzlib_filefunc_def->zopen_file = fopen_file_func;
170 | pzlib_filefunc_def->zread_file = fread_file_func;
171 | pzlib_filefunc_def->zwrite_file = fwrite_file_func;
172 | pzlib_filefunc_def->ztell_file = ftell_file_func;
173 | pzlib_filefunc_def->zseek_file = fseek_file_func;
174 | pzlib_filefunc_def->zclose_file = fclose_file_func;
175 | pzlib_filefunc_def->zerror_file = ferror_file_func;
176 | pzlib_filefunc_def->opaque = NULL;
177 | }
178 |
--------------------------------------------------------------------------------
/IMFiveApp/ZipArchive/minizip/ioapi.h:
--------------------------------------------------------------------------------
1 | /* ioapi.h -- IO base function header for compress/uncompress .zip
2 | files using zlib + zip or unzip API
3 |
4 | Version 1.01e, February 12th, 2005
5 |
6 | Copyright (C) 1998-2005 Gilles Vollant
7 | */
8 |
9 | #ifndef _ZLIBIOAPI_H
10 | #define _ZLIBIOAPI_H
11 |
12 |
13 | #define ZLIB_FILEFUNC_SEEK_CUR (1)
14 | #define ZLIB_FILEFUNC_SEEK_END (2)
15 | #define ZLIB_FILEFUNC_SEEK_SET (0)
16 |
17 | #define ZLIB_FILEFUNC_MODE_READ (1)
18 | #define ZLIB_FILEFUNC_MODE_WRITE (2)
19 | #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
20 |
21 | #define ZLIB_FILEFUNC_MODE_EXISTING (4)
22 | #define ZLIB_FILEFUNC_MODE_CREATE (8)
23 |
24 |
25 | #ifndef ZCALLBACK
26 |
27 | #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
28 | #define ZCALLBACK CALLBACK
29 | #else
30 | #define ZCALLBACK
31 | #endif
32 | #endif
33 |
34 | #ifdef __cplusplus
35 | extern "C" {
36 | #endif
37 |
38 | typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
39 | typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
40 | typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
41 | typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
42 | typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
43 | typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
44 | typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
45 |
46 | typedef struct zlib_filefunc_def_s
47 | {
48 | open_file_func zopen_file;
49 | read_file_func zread_file;
50 | write_file_func zwrite_file;
51 | tell_file_func ztell_file;
52 | seek_file_func zseek_file;
53 | close_file_func zclose_file;
54 | testerror_file_func zerror_file;
55 | voidpf opaque;
56 | } zlib_filefunc_def;
57 |
58 |
59 |
60 | void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
61 |
62 | #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
63 | #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
64 | #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
65 | #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
66 | #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
67 | #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
68 |
69 |
70 | #ifdef __cplusplus
71 | }
72 | #endif
73 |
74 | #endif
75 |
76 |
--------------------------------------------------------------------------------
/IMFiveApp/ZipArchive/minizip/mztools.c:
--------------------------------------------------------------------------------
1 | /*
2 | Additional tools for Minizip
3 | Code: Xavier Roche '2004
4 | License: Same as ZLIB (www.gzip.org)
5 | */
6 |
7 | /* Code */
8 | #include
9 | #include
10 | #include
11 | #include "zlib.h"
12 | #include "unzip.h"
13 |
14 | #define READ_8(adr) ((unsigned char)*(adr))
15 | #define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )
16 | #define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) )
17 |
18 | #define WRITE_8(buff, n) do { \
19 | *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \
20 | } while(0)
21 | #define WRITE_16(buff, n) do { \
22 | WRITE_8((unsigned char*)(buff), n); \
23 | WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \
24 | } while(0)
25 | #define WRITE_32(buff, n) do { \
26 | WRITE_16((unsigned char*)(buff), (n) & 0xffff); \
27 | WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
28 | } while(0)
29 |
30 | extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
31 | const char* file;
32 | const char* fileOut;
33 | const char* fileOutTmp;
34 | uLong* nRecovered;
35 | uLong* bytesRecovered;
36 | {
37 | int err = Z_OK;
38 | FILE* fpZip = fopen(file, "rb");
39 | FILE* fpOut = fopen(fileOut, "wb");
40 | FILE* fpOutCD = fopen(fileOutTmp, "wb");
41 | if (fpZip != NULL && fpOut != NULL) {
42 | int entries = 0;
43 | uLong totalBytes = 0;
44 | char header[30];
45 | char filename[256];
46 | char extra[1024];
47 | int offset = 0;
48 | int offsetCD = 0;
49 | while ( fread(header, 1, 30, fpZip) == 30 ) {
50 | int currentOffset = offset;
51 |
52 | /* File entry */
53 | if (READ_32(header) == 0x04034b50) {
54 | unsigned int version = READ_16(header + 4);
55 | unsigned int gpflag = READ_16(header + 6);
56 | unsigned int method = READ_16(header + 8);
57 | unsigned int filetime = READ_16(header + 10);
58 | unsigned int filedate = READ_16(header + 12);
59 | unsigned int crc = READ_32(header + 14); /* crc */
60 | unsigned int cpsize = READ_32(header + 18); /* compressed size */
61 | unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */
62 | unsigned int fnsize = READ_16(header + 26); /* file name length */
63 | unsigned int extsize = READ_16(header + 28); /* extra field length */
64 | filename[0] = extra[0] = '\0';
65 |
66 | /* Header */
67 | if (fwrite(header, 1, 30, fpOut) == 30) {
68 | offset += 30;
69 | } else {
70 | err = Z_ERRNO;
71 | break;
72 | }
73 |
74 | /* Filename */
75 | if (fnsize > 0) {
76 | if (fread(filename, 1, fnsize, fpZip) == fnsize) {
77 | if (fwrite(filename, 1, fnsize, fpOut) == fnsize) {
78 | offset += fnsize;
79 | } else {
80 | err = Z_ERRNO;
81 | break;
82 | }
83 | } else {
84 | err = Z_ERRNO;
85 | break;
86 | }
87 | } else {
88 | err = Z_STREAM_ERROR;
89 | break;
90 | }
91 |
92 | /* Extra field */
93 | if (extsize > 0) {
94 | if (fread(extra, 1, extsize, fpZip) == extsize) {
95 | if (fwrite(extra, 1, extsize, fpOut) == extsize) {
96 | offset += extsize;
97 | } else {
98 | err = Z_ERRNO;
99 | break;
100 | }
101 | } else {
102 | err = Z_ERRNO;
103 | break;
104 | }
105 | }
106 |
107 | /* Data */
108 | {
109 | int dataSize = cpsize;
110 | if (dataSize == 0) {
111 | dataSize = uncpsize;
112 | }
113 | if (dataSize > 0) {
114 | char* data = malloc(dataSize);
115 | if (data != NULL) {
116 | if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {
117 | if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {
118 | offset += dataSize;
119 | totalBytes += dataSize;
120 | } else {
121 | err = Z_ERRNO;
122 | }
123 | } else {
124 | err = Z_ERRNO;
125 | }
126 | free(data);
127 | if (err != Z_OK) {
128 | break;
129 | }
130 | } else {
131 | err = Z_MEM_ERROR;
132 | break;
133 | }
134 | }
135 | }
136 |
137 | /* Central directory entry */
138 | {
139 | char header[46];
140 | char* comment = "";
141 | int comsize = (int) strlen(comment);
142 | WRITE_32(header, 0x02014b50);
143 | WRITE_16(header + 4, version);
144 | WRITE_16(header + 6, version);
145 | WRITE_16(header + 8, gpflag);
146 | WRITE_16(header + 10, method);
147 | WRITE_16(header + 12, filetime);
148 | WRITE_16(header + 14, filedate);
149 | WRITE_32(header + 16, crc);
150 | WRITE_32(header + 20, cpsize);
151 | WRITE_32(header + 24, uncpsize);
152 | WRITE_16(header + 28, fnsize);
153 | WRITE_16(header + 30, extsize);
154 | WRITE_16(header + 32, comsize);
155 | WRITE_16(header + 34, 0); /* disk # */
156 | WRITE_16(header + 36, 0); /* int attrb */
157 | WRITE_32(header + 38, 0); /* ext attrb */
158 | WRITE_32(header + 42, currentOffset);
159 | /* Header */
160 | if (fwrite(header, 1, 46, fpOutCD) == 46) {
161 | offsetCD += 46;
162 |
163 | /* Filename */
164 | if (fnsize > 0) {
165 | if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) {
166 | offsetCD += fnsize;
167 | } else {
168 | err = Z_ERRNO;
169 | break;
170 | }
171 | } else {
172 | err = Z_STREAM_ERROR;
173 | break;
174 | }
175 |
176 | /* Extra field */
177 | if (extsize > 0) {
178 | if (fwrite(extra, 1, extsize, fpOutCD) == extsize) {
179 | offsetCD += extsize;
180 | } else {
181 | err = Z_ERRNO;
182 | break;
183 | }
184 | }
185 |
186 | /* Comment field */
187 | if (comsize > 0) {
188 | if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) {
189 | offsetCD += comsize;
190 | } else {
191 | err = Z_ERRNO;
192 | break;
193 | }
194 | }
195 |
196 |
197 | } else {
198 | err = Z_ERRNO;
199 | break;
200 | }
201 | }
202 |
203 | /* Success */
204 | entries++;
205 |
206 | } else {
207 | break;
208 | }
209 | }
210 |
211 | /* Final central directory */
212 | {
213 | int entriesZip = entries;
214 | char header[22];
215 | char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
216 | int comsize = (int) strlen(comment);
217 | if (entriesZip > 0xffff) {
218 | entriesZip = 0xffff;
219 | }
220 | WRITE_32(header, 0x06054b50);
221 | WRITE_16(header + 4, 0); /* disk # */
222 | WRITE_16(header + 6, 0); /* disk # */
223 | WRITE_16(header + 8, entriesZip); /* hack */
224 | WRITE_16(header + 10, entriesZip); /* hack */
225 | WRITE_32(header + 12, offsetCD); /* size of CD */
226 | WRITE_32(header + 16, offset); /* offset to CD */
227 | WRITE_16(header + 20, comsize); /* comment */
228 |
229 | /* Header */
230 | if (fwrite(header, 1, 22, fpOutCD) == 22) {
231 |
232 | /* Comment field */
233 | if (comsize > 0) {
234 | if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) {
235 | err = Z_ERRNO;
236 | }
237 | }
238 |
239 | } else {
240 | err = Z_ERRNO;
241 | }
242 | }
243 |
244 | /* Final merge (file + central directory) */
245 | fclose(fpOutCD);
246 | if (err == Z_OK) {
247 | fpOutCD = fopen(fileOutTmp, "rb");
248 | if (fpOutCD != NULL) {
249 | int nRead;
250 | char buffer[8192];
251 | while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) {
252 | if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) {
253 | err = Z_ERRNO;
254 | break;
255 | }
256 | }
257 | fclose(fpOutCD);
258 | }
259 | }
260 |
261 | /* Close */
262 | fclose(fpZip);
263 | fclose(fpOut);
264 |
265 | /* Wipe temporary file */
266 | (void)remove(fileOutTmp);
267 |
268 | /* Number of recovered entries */
269 | if (err == Z_OK) {
270 | if (nRecovered != NULL) {
271 | *nRecovered = entries;
272 | }
273 | if (bytesRecovered != NULL) {
274 | *bytesRecovered = totalBytes;
275 | }
276 | }
277 | } else {
278 | err = Z_STREAM_ERROR;
279 | }
280 | return err;
281 | }
282 |
--------------------------------------------------------------------------------
/IMFiveApp/ZipArchive/minizip/mztools.h:
--------------------------------------------------------------------------------
1 | /*
2 | Additional tools for Minizip
3 | Code: Xavier Roche '2004
4 | License: Same as ZLIB (www.gzip.org)
5 | */
6 |
7 | #ifndef _zip_tools_H
8 | #define _zip_tools_H
9 |
10 | #ifdef __cplusplus
11 | extern "C" {
12 | #endif
13 |
14 | #ifndef _ZLIB_H
15 | #include "zlib.h"
16 | #endif
17 |
18 | #include "unzip.h"
19 |
20 | /* Repair a ZIP file (missing central directory)
21 | file: file to recover
22 | fileOut: output file after recovery
23 | fileOutTmp: temporary file name used for recovery
24 | */
25 | extern int ZEXPORT unzRepair(const char* file,
26 | const char* fileOut,
27 | const char* fileOutTmp,
28 | uLong* nRecovered,
29 | uLong* bytesRecovered);
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/IMFiveApp/ZipArchive/minizip/unzip.h:
--------------------------------------------------------------------------------
1 | /* unzip.h -- IO for uncompress .zip files using zlib
2 | Version 1.01e, February 12th, 2005
3 |
4 | Copyright (C) 1998-2005 Gilles Vollant
5 |
6 | This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
7 | WinZip, InfoZip tools and compatible.
8 |
9 | Multi volume ZipFile (span) are not supported.
10 | Encryption compatible with pkzip 2.04g only supported
11 | Old compressions used by old PKZip 1.x are not supported
12 |
13 |
14 | I WAIT FEEDBACK at mail info@winimage.com
15 | Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
16 |
17 | Condition of use and distribution are the same than zlib :
18 |
19 | This software is provided 'as-is', without any express or implied
20 | warranty. In no event will the authors be held liable for any damages
21 | arising from the use of this software.
22 |
23 | Permission is granted to anyone to use this software for any purpose,
24 | including commercial applications, and to alter it and redistribute it
25 | freely, subject to the following restrictions:
26 |
27 | 1. The origin of this software must not be misrepresented; you must not
28 | claim that you wrote the original software. If you use this software
29 | in a product, an acknowledgment in the product documentation would be
30 | appreciated but is not required.
31 | 2. Altered source versions must be plainly marked as such, and must not be
32 | misrepresented as being the original software.
33 | 3. This notice may not be removed or altered from any source distribution.
34 |
35 |
36 | */
37 |
38 | /* for more info about .ZIP format, see
39 | http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
40 | http://www.info-zip.org/pub/infozip/doc/
41 | PkWare has also a specification at :
42 | ftp://ftp.pkware.com/probdesc.zip
43 | */
44 |
45 | #ifndef _unz_H
46 | #define _unz_H
47 |
48 | #ifdef __cplusplus
49 | extern "C" {
50 | #endif
51 |
52 | #ifndef _ZLIB_H
53 | #include "zlib.h"
54 | #endif
55 |
56 | #ifndef _ZLIBIOAPI_H
57 | #include "ioapi.h"
58 | #endif
59 |
60 | #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
61 | /* like the STRICT of WIN32, we define a pointer that cannot be converted
62 | from (void*) without cast */
63 | typedef struct TagunzFile__ { int unused; } unzFile__;
64 | typedef unzFile__ *unzFile;
65 | #else
66 | typedef voidp unzFile;
67 | #endif
68 |
69 |
70 | #define UNZ_OK (0)
71 | #define UNZ_END_OF_LIST_OF_FILE (-100)
72 | #define UNZ_ERRNO (Z_ERRNO)
73 | #define UNZ_EOF (0)
74 | #define UNZ_PARAMERROR (-102)
75 | #define UNZ_BADZIPFILE (-103)
76 | #define UNZ_INTERNALERROR (-104)
77 | #define UNZ_CRCERROR (-105)
78 |
79 | /* tm_unz contain date/time info */
80 | typedef struct tm_unz_s
81 | {
82 | uInt tm_sec; /* seconds after the minute - [0,59] */
83 | uInt tm_min; /* minutes after the hour - [0,59] */
84 | uInt tm_hour; /* hours since midnight - [0,23] */
85 | uInt tm_mday; /* day of the month - [1,31] */
86 | uInt tm_mon; /* months since January - [0,11] */
87 | uInt tm_year; /* years - [1980..2044] */
88 | } tm_unz;
89 |
90 | /* unz_global_info structure contain global data about the ZIPfile
91 | These data comes from the end of central dir */
92 | typedef struct unz_global_info_s
93 | {
94 | uLong number_entry; /* total number of entries in
95 | the central dir on this disk */
96 | uLong size_comment; /* size of the global comment of the zipfile */
97 | } unz_global_info;
98 |
99 |
100 | /* unz_file_info contain information about a file in the zipfile */
101 | typedef struct unz_file_info_s
102 | {
103 | uLong version; /* version made by 2 bytes */
104 | uLong version_needed; /* version needed to extract 2 bytes */
105 | uLong flag; /* general purpose bit flag 2 bytes */
106 | uLong compression_method; /* compression method 2 bytes */
107 | uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
108 | uLong crc; /* crc-32 4 bytes */
109 | uLong compressed_size; /* compressed size 4 bytes */
110 | uLong uncompressed_size; /* uncompressed size 4 bytes */
111 | uLong size_filename; /* filename length 2 bytes */
112 | uLong size_file_extra; /* extra field length 2 bytes */
113 | uLong size_file_comment; /* file comment length 2 bytes */
114 |
115 | uLong disk_num_start; /* disk number start 2 bytes */
116 | uLong internal_fa; /* internal file attributes 2 bytes */
117 | uLong external_fa; /* external file attributes 4 bytes */
118 |
119 | tm_unz tmu_date;
120 | } unz_file_info;
121 |
122 | extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
123 | const char* fileName2,
124 | int iCaseSensitivity));
125 | /*
126 | Compare two filename (fileName1,fileName2).
127 | If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
128 | If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
129 | or strcasecmp)
130 | If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
131 | (like 1 on Unix, 2 on Windows)
132 | */
133 |
134 |
135 | extern unzFile ZEXPORT unzOpen OF((const char *path));
136 | /*
137 | Open a Zip file. path contain the full pathname (by example,
138 | on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
139 | "zlib/zlib113.zip".
140 | If the zipfile cannot be opened (file don't exist or in not valid), the
141 | return value is NULL.
142 | Else, the return value is a unzFile Handle, usable with other function
143 | of this unzip package.
144 | */
145 |
146 | extern unzFile ZEXPORT unzOpen2 OF((const char *path,
147 | zlib_filefunc_def* pzlib_filefunc_def));
148 | /*
149 | Open a Zip file, like unzOpen, but provide a set of file low level API
150 | for read/write the zip file (see ioapi.h)
151 | */
152 |
153 | extern int ZEXPORT unzClose OF((unzFile file));
154 | /*
155 | Close a ZipFile opened with unzipOpen.
156 | If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
157 | these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
158 | return UNZ_OK if there is no problem. */
159 |
160 | extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
161 | unz_global_info *pglobal_info));
162 | /*
163 | Write info about the ZipFile in the *pglobal_info structure.
164 | No preparation of the structure is needed
165 | return UNZ_OK if there is no problem. */
166 |
167 |
168 | extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
169 | char *szComment,
170 | uLong uSizeBuf));
171 | /*
172 | Get the global comment string of the ZipFile, in the szComment buffer.
173 | uSizeBuf is the size of the szComment buffer.
174 | return the number of byte copied or an error code <0
175 | */
176 |
177 |
178 | /***************************************************************************/
179 | /* Unzip package allow you browse the directory of the zipfile */
180 |
181 | extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
182 | /*
183 | Set the current file of the zipfile to the first file.
184 | return UNZ_OK if there is no problem
185 | */
186 |
187 | extern int ZEXPORT unzGoToNextFile OF((unzFile file));
188 | /*
189 | Set the current file of the zipfile to the next file.
190 | return UNZ_OK if there is no problem
191 | return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
192 | */
193 |
194 | extern int ZEXPORT unzLocateFile OF((unzFile file,
195 | const char *szFileName,
196 | int iCaseSensitivity));
197 | /*
198 | Try locate the file szFileName in the zipfile.
199 | For the iCaseSensitivity signification, see unzStringFileNameCompare
200 |
201 | return value :
202 | UNZ_OK if the file is found. It becomes the current file.
203 | UNZ_END_OF_LIST_OF_FILE if the file is not found
204 | */
205 |
206 |
207 | /* ****************************************** */
208 | /* Ryan supplied functions */
209 | /* unz_file_info contain information about a file in the zipfile */
210 | typedef struct unz_file_pos_s
211 | {
212 | uLong pos_in_zip_directory; /* offset in zip file directory */
213 | uLong num_of_file; /* # of file */
214 | } unz_file_pos;
215 |
216 | extern int ZEXPORT unzGetFilePos(
217 | unzFile file,
218 | unz_file_pos* file_pos);
219 |
220 | extern int ZEXPORT unzGoToFilePos(
221 | unzFile file,
222 | unz_file_pos* file_pos);
223 |
224 | /* ****************************************** */
225 |
226 | extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
227 | unz_file_info *pfile_info,
228 | char *szFileName,
229 | uLong fileNameBufferSize,
230 | void *extraField,
231 | uLong extraFieldBufferSize,
232 | char *szComment,
233 | uLong commentBufferSize));
234 | /*
235 | Get Info about the current file
236 | if pfile_info!=NULL, the *pfile_info structure will contain somes info about
237 | the current file
238 | if szFileName!=NULL, the filemane string will be copied in szFileName
239 | (fileNameBufferSize is the size of the buffer)
240 | if extraField!=NULL, the extra field information will be copied in extraField
241 | (extraFieldBufferSize is the size of the buffer).
242 | This is the Central-header version of the extra field
243 | if szComment!=NULL, the comment string of the file will be copied in szComment
244 | (commentBufferSize is the size of the buffer)
245 | */
246 |
247 | /***************************************************************************/
248 | /* for reading the content of the current zipfile, you can open it, read data
249 | from it, and close it (you can close it before reading all the file)
250 | */
251 |
252 | extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
253 | /*
254 | Open for reading data the current file in the zipfile.
255 | If there is no error, the return value is UNZ_OK.
256 | */
257 |
258 | extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
259 | const char* password));
260 | /*
261 | Open for reading data the current file in the zipfile.
262 | password is a crypting password
263 | If there is no error, the return value is UNZ_OK.
264 | */
265 |
266 | extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
267 | int* method,
268 | int* level,
269 | int raw));
270 | /*
271 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
272 | if raw==1
273 | *method will receive method of compression, *level will receive level of
274 | compression
275 | note : you can set level parameter as NULL (if you did not want known level,
276 | but you CANNOT set method parameter as NULL
277 | */
278 |
279 | extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
280 | int* method,
281 | int* level,
282 | int raw,
283 | const char* password));
284 | /*
285 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
286 | if raw==1
287 | *method will receive method of compression, *level will receive level of
288 | compression
289 | note : you can set level parameter as NULL (if you did not want known level,
290 | but you CANNOT set method parameter as NULL
291 | */
292 |
293 |
294 | extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
295 | /*
296 | Close the file in zip opened with unzOpenCurrentFile
297 | Return UNZ_CRCERROR if all the file was read but the CRC is not good
298 | */
299 |
300 | extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
301 | voidp buf,
302 | unsigned len));
303 | /*
304 | Read bytes from the current file (opened by unzOpenCurrentFile)
305 | buf contain buffer where data must be copied
306 | len the size of buf.
307 |
308 | return the number of byte copied if somes bytes are copied
309 | return 0 if the end of file was reached
310 | return <0 with error code if there is an error
311 | (UNZ_ERRNO for IO error, or zLib error for uncompress error)
312 | */
313 |
314 | extern z_off_t ZEXPORT unztell OF((unzFile file));
315 | /*
316 | Give the current position in uncompressed data
317 | */
318 |
319 | extern int ZEXPORT unzeof OF((unzFile file));
320 | /*
321 | return 1 if the end of file was reached, 0 elsewhere
322 | */
323 |
324 | extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
325 | voidp buf,
326 | unsigned len));
327 | /*
328 | Read extra field from the current file (opened by unzOpenCurrentFile)
329 | This is the local-header version of the extra field (sometimes, there is
330 | more info in the local-header version than in the central-header)
331 |
332 | if buf==NULL, it return the size of the local extra field
333 |
334 | if buf!=NULL, len is the size of the buffer, the extra header is copied in
335 | buf.
336 | the return value is the number of bytes copied in buf, or (if <0)
337 | the error code
338 | */
339 |
340 | /***************************************************************************/
341 |
342 | /* Get the current file offset */
343 | extern uLong ZEXPORT unzGetOffset (unzFile file);
344 |
345 | /* Set the current file offset */
346 | extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
347 |
348 |
349 |
350 | #ifdef __cplusplus
351 | }
352 | #endif
353 |
354 | #endif /* _unz_H */
355 |
--------------------------------------------------------------------------------
/IMFiveApp/ZipArchive/minizip/zip.h:
--------------------------------------------------------------------------------
1 | /* zip.h -- IO for compress .zip files using zlib
2 | Version 1.01e, February 12th, 2005
3 |
4 | Copyright (C) 1998-2005 Gilles Vollant
5 |
6 | This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
7 | WinZip, InfoZip tools and compatible.
8 | Multi volume ZipFile (span) are not supported.
9 | Encryption compatible with pkzip 2.04g only supported
10 | Old compressions used by old PKZip 1.x are not supported
11 |
12 | For uncompress .zip file, look at unzip.h
13 |
14 |
15 | I WAIT FEEDBACK at mail info@winimage.com
16 | Visit also http://www.winimage.com/zLibDll/unzip.html for evolution
17 |
18 | Condition of use and distribution are the same than zlib :
19 |
20 | This software is provided 'as-is', without any express or implied
21 | warranty. In no event will the authors be held liable for any damages
22 | arising from the use of this software.
23 |
24 | Permission is granted to anyone to use this software for any purpose,
25 | including commercial applications, and to alter it and redistribute it
26 | freely, subject to the following restrictions:
27 |
28 | 1. The origin of this software must not be misrepresented; you must not
29 | claim that you wrote the original software. If you use this software
30 | in a product, an acknowledgment in the product documentation would be
31 | appreciated but is not required.
32 | 2. Altered source versions must be plainly marked as such, and must not be
33 | misrepresented as being the original software.
34 | 3. This notice may not be removed or altered from any source distribution.
35 |
36 |
37 | */
38 |
39 | /* for more info about .ZIP format, see
40 | http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
41 | http://www.info-zip.org/pub/infozip/doc/
42 | PkWare has also a specification at :
43 | ftp://ftp.pkware.com/probdesc.zip
44 | */
45 |
46 | #ifndef _zip_H
47 | #define _zip_H
48 |
49 | #ifdef __cplusplus
50 | extern "C" {
51 | #endif
52 |
53 | #ifndef _ZLIB_H
54 | #include "zlib.h"
55 | #endif
56 |
57 | #ifndef _ZLIBIOAPI_H
58 | #include "ioapi.h"
59 | #endif
60 |
61 | #if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
62 | /* like the STRICT of WIN32, we define a pointer that cannot be converted
63 | from (void*) without cast */
64 | typedef struct TagzipFile__ { int unused; } zipFile__;
65 | typedef zipFile__ *zipFile;
66 | #else
67 | typedef voidp zipFile;
68 | #endif
69 |
70 | #define ZIP_OK (0)
71 | #define ZIP_EOF (0)
72 | #define ZIP_ERRNO (Z_ERRNO)
73 | #define ZIP_PARAMERROR (-102)
74 | #define ZIP_BADZIPFILE (-103)
75 | #define ZIP_INTERNALERROR (-104)
76 |
77 | #ifndef DEF_MEM_LEVEL
78 | # if MAX_MEM_LEVEL >= 8
79 | # define DEF_MEM_LEVEL 8
80 | # else
81 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL
82 | # endif
83 | #endif
84 | /* default memLevel */
85 |
86 | /* tm_zip contain date/time info */
87 | typedef struct tm_zip_s
88 | {
89 | uInt tm_sec; /* seconds after the minute - [0,59] */
90 | uInt tm_min; /* minutes after the hour - [0,59] */
91 | uInt tm_hour; /* hours since midnight - [0,23] */
92 | uInt tm_mday; /* day of the month - [1,31] */
93 | uInt tm_mon; /* months since January - [0,11] */
94 | uInt tm_year; /* years - [1980..2044] */
95 | } tm_zip;
96 |
97 | typedef struct
98 | {
99 | tm_zip tmz_date; /* date in understandable format */
100 | uLong dosDate; /* if dos_date == 0, tmu_date is used */
101 | /* uLong flag; */ /* general purpose bit flag 2 bytes */
102 |
103 | uLong internal_fa; /* internal file attributes 2 bytes */
104 | uLong external_fa; /* external file attributes 4 bytes */
105 | } zip_fileinfo;
106 |
107 | typedef const char* zipcharpc;
108 |
109 |
110 | #define APPEND_STATUS_CREATE (0)
111 | #define APPEND_STATUS_CREATEAFTER (1)
112 | #define APPEND_STATUS_ADDINZIP (2)
113 |
114 | extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
115 | /*
116 | Create a zipfile.
117 | pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
118 | an Unix computer "zlib/zlib113.zip".
119 | if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
120 | will be created at the end of the file.
121 | (useful if the file contain a self extractor code)
122 | if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
123 | add files in existing zip (be sure you don't add file that doesn't exist)
124 | If the zipfile cannot be opened, the return value is NULL.
125 | Else, the return value is a zipFile Handle, usable with other function
126 | of this zip package.
127 | */
128 |
129 | /* Note : there is no delete function into a zipfile.
130 | If you want delete file into a zipfile, you must open a zipfile, and create another
131 | Of couse, you can use RAW reading and writing to copy the file you did not want delte
132 | */
133 |
134 | extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
135 | int append,
136 | zipcharpc* globalcomment,
137 | zlib_filefunc_def* pzlib_filefunc_def));
138 |
139 | extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
140 | const char* filename,
141 | const zip_fileinfo* zipfi,
142 | const void* extrafield_local,
143 | uInt size_extrafield_local,
144 | const void* extrafield_global,
145 | uInt size_extrafield_global,
146 | const char* comment,
147 | int method,
148 | int level));
149 | /*
150 | Open a file in the ZIP for writing.
151 | filename : the filename in zip (if NULL, '-' without quote will be used
152 | *zipfi contain supplemental information
153 | if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
154 | contains the extrafield data the the local header
155 | if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
156 | contains the extrafield data the the local header
157 | if comment != NULL, comment contain the comment string
158 | method contain the compression method (0 for store, Z_DEFLATED for deflate)
159 | level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
160 | */
161 |
162 |
163 | extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
164 | const char* filename,
165 | const zip_fileinfo* zipfi,
166 | const void* extrafield_local,
167 | uInt size_extrafield_local,
168 | const void* extrafield_global,
169 | uInt size_extrafield_global,
170 | const char* comment,
171 | int method,
172 | int level,
173 | int raw));
174 |
175 | /*
176 | Same than zipOpenNewFileInZip, except if raw=1, we write raw file
177 | */
178 |
179 | extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
180 | const char* filename,
181 | const zip_fileinfo* zipfi,
182 | const void* extrafield_local,
183 | uInt size_extrafield_local,
184 | const void* extrafield_global,
185 | uInt size_extrafield_global,
186 | const char* comment,
187 | int method,
188 | int level,
189 | int raw,
190 | int windowBits,
191 | int memLevel,
192 | int strategy,
193 | const char* password,
194 | uLong crcForCtypting));
195 |
196 | /*
197 | Same than zipOpenNewFileInZip2, except
198 | windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
199 | password : crypting password (NULL for no crypting)
200 | crcForCtypting : crc of file to compress (needed for crypting)
201 | */
202 |
203 |
204 | extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
205 | const void* buf,
206 | unsigned len));
207 | /*
208 | Write data in the zipfile
209 | */
210 |
211 | extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
212 | /*
213 | Close the current file in the zipfile
214 | */
215 |
216 | extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
217 | uLong uncompressed_size,
218 | uLong crc32));
219 | /*
220 | Close the current file in the zipfile, for fiel opened with
221 | parameter raw=1 in zipOpenNewFileInZip2
222 | uncompressed_size and crc32 are value for the uncompressed size
223 | */
224 |
225 | extern int ZEXPORT zipClose OF((zipFile file,
226 | const char* global_comment));
227 | /*
228 | Close the zipfile
229 | */
230 |
231 | #ifdef __cplusplus
232 | }
233 | #endif
234 |
235 | #endif /* _zip_H */
236 |
--------------------------------------------------------------------------------
/IMFiveApp/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/IMFiveApp/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // IMFiveApp
4 | //
5 | // Created by chen on 14-8-20.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "AppDelegate.h"
12 |
13 | int main(int argc, char * argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/aio_face_manage_cover_default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/aio_face_manage_cover_default@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/aio_icon_more@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/aio_icon_more@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/buddy_cell_nor@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/buddy_cell_nor@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/buddy_header_arrow@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/buddy_header_arrow@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/buddy_header_icon_addressBook@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/buddy_header_icon_addressBook@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/buddy_header_icon_discussGroup@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/buddy_header_icon_discussGroup@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/buddy_header_icon_group@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/buddy_header_icon_group@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/buddy_header_icon_public@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/buddy_header_icon_public@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/buddy_header_icon_qq@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/buddy_header_icon_qq@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/buddy_header_icon_qzone@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/buddy_header_icon_qzone@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/buddy_header_nor@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/buddy_header_nor@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/buddy_header_press@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/buddy_header_press@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/buddy_list_seperator_bg@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/buddy_list_seperator_bg@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/chat_bottom_smile_nor@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/chat_bottom_smile_nor@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/chat_bottom_smile_press@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/chat_bottom_smile_press@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/common_green_checkbox@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/common_green_checkbox@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/header_bg@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/header_bg@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/header_bg_ios7@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/header_bg_ios7@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/menu_bg_pressed@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/menu_bg_pressed@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/menu_icon_QR@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/menu_icon_QR@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/menu_icon_bulb@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/menu_icon_bulb@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/menu_icon_bulb_pressed@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/menu_icon_bulb_pressed@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/menu_icon_c2c_shortcut@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/menu_icon_c2c_shortcut@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/menu_icon_camera@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/menu_icon_camera@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/menu_icon_chat@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/menu_icon_chat@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/menu_icon_createDiscuss@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/menu_icon_createDiscuss@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/menu_icon_group_shortcut@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/menu_icon_group_shortcut@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/menu_icon_groupaudio@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/menu_icon_groupaudio@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/mulchat_header_icon_circle@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/mulchat_header_icon_circle@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/mulchat_header_icon_discuss@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/mulchat_header_icon_discuss@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/mulchat_header_icon_group@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/mulchat_header_icon_group@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/offical_account_icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/offical_account_icon@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/qv_msg_bar_vip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/qv_msg_bar_vip.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/shortNoti_fail@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/shortNoti_fail@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_album@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_album@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_bg@2x.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_bg@2x.jpg
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_bg_mask@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_bg_mask@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_business@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_business@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_decoration@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_decoration@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_favorit@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_favorit@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_file@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_file@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_nightmode_loading@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_nightmode_loading@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_nightmode_off@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_nightmode_off@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_nightmode_on@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_nightmode_on@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_purse@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_purse@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_setting@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_setting@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_signature_nor@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_signature_nor@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/sidebar_signature_other@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/sidebar_signature_other@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/svip_shadow@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/svip_shadow@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/tab_buddy_nor@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/tab_buddy_nor@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/tab_buddy_press@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/tab_buddy_press@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/tab_me_nor@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/tab_me_nor@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/tab_me_press@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/tab_me_press@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/tab_qworld_nor@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/tab_qworld_nor@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/tab_qworld_press@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/tab_qworld_press@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/tab_recent_nor@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/tab_recent_nor@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/tab_recent_press@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/tab_recent_press@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/tabbar_bg@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/tabbar_bg@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/table_arrow@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/table_arrow@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/table_arrow_press@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/table_arrow_press@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/usersummary_icon_lv_moon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/usersummary_icon_lv_moon@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/usersummary_icon_lv_star@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/usersummary_icon_lv_star@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/usersummary_icon_lv_sun@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/usersummary_icon_lv_sun@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/Default/vip_shadow@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/Default/vip_shadow@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/theme_icon/theme_icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/theme_icon/theme_icon@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/theme_icon/theme_icon_penguin@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/theme_icon/theme_icon_penguin@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/theme_icon/theme_icon_sea@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/theme_icon/theme_icon_sea@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/theme_icon/theme_icon_universe@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/theme_icon/theme_icon_universe@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/theme_icon/theme_icon_yellowduck@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/theme_icon/theme_icon_yellowduck@2x.png
--------------------------------------------------------------------------------
/IMFiveApp/resource/theme_zip/com.skin.1098.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/theme_zip/com.skin.1098.zip
--------------------------------------------------------------------------------
/IMFiveApp/resource/theme_zip/com.skin.1108.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/theme_zip/com.skin.1108.zip
--------------------------------------------------------------------------------
/IMFiveApp/resource/theme_zip/com.skin.1110.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/theme_zip/com.skin.1110.zip
--------------------------------------------------------------------------------
/IMFiveApp/resource/theme_zip/com.skin.1114.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/IMFiveApp/resource/theme_zip/com.skin.1114.zip
--------------------------------------------------------------------------------
/IMFiveAppTests/IMFiveAppTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.chen.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/IMFiveAppTests/IMFiveAppTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // IMFiveAppTests.m
3 | // IMFiveAppTests
4 | //
5 | // Created by chen on 14-8-20.
6 | // Copyright (c) 2014年 chen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface IMFiveAppTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation IMFiveAppTests
16 |
17 | - (void)setUp
18 | {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown
24 | {
25 | // Put teardown code here. This method is called after the invocation of each test method in the class.
26 | [super tearDown];
27 | }
28 |
29 | - (void)testExample
30 | {
31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/IMFiveAppTests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | IMFiveApp
2 | =========
3 |
4 | 低仿QQ5.0
5 |
6 | (声明:工程里面的图片都是来源于QQ5.0的原始图片,请注意,我此处只是用于demo,如果有不妥,可以告知,立马撤掉。
7 | Demo制作比较粗糙,在主题的切换上,QQ本身这部分内容很多,还有对应的文字颜色,显示与否等等的配置,很繁多,此处就没有做太细。)
8 |
9 | 
10 |
11 | ---------------------------华丽丽的分割线------------------------------
12 |
13 | 1、QQ界面
14 |
15 | 2、切换主题
16 |
17 | (
18 |
19 | PS:由于第一次切换主题需要转移和解压zip,所以需要时间,后面就不需要了。其实QQ本身就是从网上下载zip包,然后解压到Documents同级目录下[!!!这里我实验了一下,真机是不允许在Documents同级目录操作的,这里做个记号],而我是转移到Documents目录里面,可以自己查看对应的文件夹
20 |
21 | 原理:
22 |
23 | (1)页面是常驻的,接收通知reloadImage
24 |
25 | (2)页面是即时的,通过全局参数判断使用的图片
26 |
27 | )
28 |
29 | 3、左边滑动效果
30 |
--------------------------------------------------------------------------------
/screenshots/IMFiveAppGif.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenqihui/IMFiveApp/8cea676a82b8a9903472d0c278d46e8ed39a75bd/screenshots/IMFiveAppGif.gif
--------------------------------------------------------------------------------