Skip to content

Commit 6d1531d

Browse files
committed
筛选数据~
1 parent 4f36024 commit 6d1531d

File tree

8 files changed

+86
-13
lines changed

8 files changed

+86
-13
lines changed

‎Coding_iOS.xcodeproj/project.pbxproj

+6
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,7 @@
915915
B9A00D821ACA3A17008BA008 /* ProjectSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B9A00D811ACA3A17008BA008 /* ProjectSettingViewController.m */; };
916916
B9A00D851ACA3A55008BA008 /* ProjectAdvancedSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B9A00D841ACA3A55008BA008 /* ProjectAdvancedSettingViewController.m */; };
917917
D0A32BF31BF19EF100336C52 /* PopFliterMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A32BF21BF19EF100336C52 /* PopFliterMenu.m */; };
918+
D0A32BF61BF1CA8F00336C52 /* ProjectCount.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A32BF51BF1CA8F00336C52 /* ProjectCount.m */; };
918919
E7A046A01A47279E00528C12 /* Helper.m in Sources */ = {isa = PBXBuildFile; fileRef = E7A0469F1A47279E00528C12 /* Helper.m */; };
919920
/* End PBXBuildFile section */
920921

@@ -2312,6 +2313,8 @@
23122313
C613B8719C3D38FED828A1E2 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
23132314
D0A32BF11BF19EF100336C52 /* PopFliterMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopFliterMenu.h; sourceTree = "<group>"; };
23142315
D0A32BF21BF19EF100336C52 /* PopFliterMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PopFliterMenu.m; sourceTree = "<group>"; };
2316+
D0A32BF41BF1CA8F00336C52 /* ProjectCount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectCount.h; sourceTree = "<group>"; };
2317+
D0A32BF51BF1CA8F00336C52 /* ProjectCount.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProjectCount.m; sourceTree = "<group>"; };
23152318
E7A0469E1A47279E00528C12 /* Helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Helper.h; sourceTree = "<group>"; };
23162319
E7A0469F1A47279E00528C12 /* Helper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Helper.m; sourceTree = "<group>"; };
23172320
/* End PBXFileReference section */
@@ -4276,6 +4279,8 @@
42764279
4E0022851B720966005308DE /* PointRecords.m */,
42774280
4EAE06B81B7B47A700179F4B /* FileVersion.h */,
42784281
4EAE06B91B7B47A700179F4B /* FileVersion.m */,
4282+
D0A32BF41BF1CA8F00336C52 /* ProjectCount.h */,
4283+
D0A32BF51BF1CA8F00336C52 /* ProjectCount.m */,
42794284
);
42804285
path = Models;
42814286
sourceTree = "<group>";
@@ -5549,6 +5554,7 @@
55495554
7EB02FF21B6D111300D2166C /* BubblePlayView.m in Sources */,
55505555
4ECE8AE21A3943E80021E29C /* UIColor+expanded.m in Sources */,
55515556
4E6318A21BDA261100EFED97 /* MRListView.m in Sources */,
5557+
D0A32BF61BF1CA8F00336C52 /* ProjectCount.m in Sources */,
55525558
4EA7F15D1A6D192B00A046BD /* SDWebImageDownloader.m in Sources */,
55535559
8EA6D1B419E240C40076D59C /* HtmlMedia.m in Sources */,
55545560
3A3878451AE296240078D5DE /* EditLabelCell.m in Sources */,

‎Coding_iOS/Controllers/RootControllers/Project_RootViewController.m

+4-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ - (void)viewDidLoad
103103
});
104104
[self.navigationController.navigationBar addSubview:_mySearchBar];
105105

106+
//初始化过滤目录并加载数据
107+
_myFliterMenu = [[PopFliterMenu alloc] initWithFrame:kScreen_Bounds items:nil];
108+
[_myFliterMenu refreshMenuDate];
109+
106110
//添加滑块
107111
__weak typeof(_myCarousel) weakCarousel = _myCarousel;
108112
_mySegmentControl = [[XTSegmentControl alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, kMySegmentControl_Height) Items:_segmentItems selectedBlock:^(NSInteger index) {
@@ -304,7 +308,6 @@ - (void)goToMessageVC{
304308
#pragma mark fliter
305309
-(void)fliterClicked:(id)sender{
306310
NSLog(@"show fliter");
307-
_myFliterMenu = [[PopFliterMenu alloc] initWithFrame:kScreen_Bounds items:nil];
308311
[_myFliterMenu showMenuAtView:self.view];
309312

310313
}

‎Coding_iOS/Models/ProjectCount.h

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// ProjectCount.h
3+
// Coding_iOS
4+
//
5+
// Created by jwill on 15/11/10.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@interface ProjectCount : NSObject
12+
@property (strong, nonatomic) NSNumber *all, *watched, *created, *joined, *stared, *deploy;
13+
- (void)configWithProjects:(ProjectCount *)ProjectCount;
14+
15+
@end

‎Coding_iOS/Models/ProjectCount.m

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// ProjectCount.m
3+
// Coding_iOS
4+
//
5+
// Created by jwill on 15/11/10.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "ProjectCount.h"
10+
11+
@implementation ProjectCount
12+
13+
- (void)configWithProjects:(ProjectCount *)ProjectCount
14+
{
15+
self.all = ProjectCount.all;
16+
self.watched = ProjectCount.watched;
17+
self.created = ProjectCount.created;
18+
self.joined = ProjectCount.joined;
19+
self.stared = ProjectCount.stared;
20+
self.deploy = ProjectCount.deploy;
21+
}
22+
23+
@end

‎Coding_iOS/Util/Manager/Coding_NetAPIManager.h

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#import "CodingBanner.h"
3535
#import "PointRecords.h"
3636
#import "FileVersion.h"
37+
#import "ProjectCount.h"
3738

3839
@class CSTopic;
3940

@@ -61,6 +62,7 @@ typedef NS_ENUM(NSUInteger, VerifyType){
6162

6263
//Project
6364
- (void)request_Projects_WithObj:(Projects *)projects andBlock:(void (^)(Projects *data, NSError *error))block;
65+
- (void)request_ProjectsCatergoryAndCounts_WithObj:(ProjectCount *)pCount andBlock:(void (^)(ProjectCount *data, NSError *error))block;
6466
- (void)request_ProjectsHaveTasks_WithObj:(Projects *)projects andBlock:(void (^)(id data, NSError *error))block;
6567
- (void)request_Project_UpdateVisit_WithObj:(Project *)project andBlock:(void (^)(id data, NSError *error))block;
6668
- (void)request_ProjectDetail_WithObj:(Project *)project andBlock:(void (^)(id data, NSError *error))block;

‎Coding_iOS/Util/Manager/Coding_NetAPIManager.m

+17
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,23 @@ - (void)request_Projects_WithObj:(Projects *)projects andBlock:(void (^)(Project
171171
}
172172
}];
173173
}
174+
175+
- (void)request_ProjectsCatergoryAndCounts_WithObj:(ProjectCount *)pCount andBlock:(void (^)(ProjectCount *data, NSError *error))block
176+
{
177+
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:@"api/project_count" withParams:nil withMethodType:Get andBlock:^(id data, NSError *error) {
178+
if (data) {
179+
[MobClick event:kUmeng_Event_Request_RootList label:@"筛选列表"];
180+
181+
id resultData = [data valueForKeyPath:@"data"];
182+
ProjectCount *prosC = [NSObject objectOfClass:@"ProjectCount" fromJSON:resultData];
183+
block(prosC, nil);
184+
}else{
185+
block(nil, error);
186+
}
187+
}];
188+
189+
}
190+
174191
- (void)request_ProjectsHaveTasks_WithObj:(Projects *)projects andBlock:(void (^)(id data, NSError *error))block{
175192
projects.isLoading = YES;
176193
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:@"api/projects" withParams:[projects toParams] withMethodType:Get andBlock:^(id data, NSError *error) {

‎Coding_iOS/Views/PopFliterMenu.h

+1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
- (void)showMenuAtView:(UIView *)containerView;
1515
//取消视图
1616
- (void)dismissMenu;
17+
- (void)refreshMenuDate;
1718
@end

‎Coding_iOS/Views/PopFliterMenu.m

+18-12
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88

99
#import "PopFliterMenu.h"
1010
#import "XHRealTimeBlur.h"
11+
#import "Coding_NetAPIManager.h"
12+
#import "ProjectCount.h"
1113

1214
@interface PopFliterMenu()<UITableViewDataSource,UITableViewDelegate>
1315
@property (nonatomic, strong, readwrite) NSArray *items;
1416
@property (nonatomic, strong) XHRealTimeBlur *realTimeBlur;
1517
@property (nonatomic, strong) UITableView *tableview;
18+
@property (nonatomic, strong) ProjectCount *pCount;
1619
@end
1720

1821
@implementation PopFliterMenu
@@ -21,13 +24,24 @@ - (id)initWithFrame:(CGRect)frame items:(NSArray *)items {
2124
self = [super initWithFrame:frame];
2225
if (self) {
2326
// Initialization code
24-
self.items = @[@"1",@"2",@"3",@"4"];
25-
27+
self.items = @[@{@"all":@""},@{@"watched":@""},@{@"created":@""},@{@"joined":@""},@{@"stared":@""}];
28+
self.pCount=[ProjectCount new];
2629
[self setup];
2730
}
2831
return self;
2932
}
3033

34+
- (void)refreshMenuDate
35+
{
36+
__weak typeof(self) weakSelf = self;
37+
[[Coding_NetAPIManager sharedManager] request_ProjectsCatergoryAndCounts_WithObj:_pCount andBlock:^(ProjectCount *data, NSError *error) {
38+
if (data) {
39+
[weakSelf.pCount configWithProjects:data];
40+
[weakSelf.tableview reloadData];
41+
}
42+
}];
43+
}
44+
3145
// 设置属性
3246
- (void)setup {
3347
self.backgroundColor = [UIColor clearColor];
@@ -39,19 +53,10 @@ - (void)setup {
3953
_realTimeBlur.disMissDuration = 0.5;
4054
_realTimeBlur.willShowBlurViewcomplted = ^(void) {
4155
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
42-
// weakSelf.isShowed = YES;
43-
// [weakSelf showButtons];
4456
};
4557

4658
_realTimeBlur.willDismissBlurViewCompleted = ^(void) {
4759
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
48-
// if (weakSelf.selectedItem) {
49-
// if (weakSelf.didSelectedItemCompletion) {
50-
// weakSelf.didSelectedItemCompletion(weakSelf.selectedItem);
51-
// weakSelf.selectedItem = nil;
52-
// }
53-
// }
54-
// [weakSelf hidenButtons];
5560
};
5661
_realTimeBlur.didDismissBlurViewCompleted = ^(BOOL finished) {
5762
[weakSelf removeFromSuperview];
@@ -83,7 +88,8 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
8388

8489
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
8590
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell" forIndexPath:indexPath];
86-
cell.textLabel.text=[_items objectAtIndex:indexPath.row];
91+
92+
cell.textLabel.text=[[[_items objectAtIndex:indexPath.row] allKeys] firstObject];
8793
return cell;
8894
}
8995

0 commit comments

Comments
 (0)