Skip to content

Commit f08a46c

Browse files
wanghenghengEase
authored and
Ease
committed
本地文件 - Beta
1 parent 4214671 commit f08a46c

16 files changed

+632
-3
lines changed

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@
270270
4E6D718A1A75F00E005AD988 /* YLImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E6D71881A75F00E005AD988 /* YLImageView.m */; };
271271
4E6FB0551B5799B100B0A17B /* ProjectTag.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E6FB0541B5799B100B0A17B /* ProjectTag.m */; };
272272
4E6FB0581B58DB0A00B0A17B /* ProjectTagsView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E6FB0571B58DB0A00B0A17B /* ProjectTagsView.m */; };
273+
4E715A321BB1278200A5D24B /* LocalFolderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E715A311BB1278200A5D24B /* LocalFolderCell.m */; settings = {ASSET_TAGS = (); }; };
274+
4E715A351BB1279D00A5D24B /* LocalFileCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E715A341BB1279D00A5D24B /* LocalFileCell.m */; settings = {ASSET_TAGS = (); }; };
273275
4E72F82D1B144778001B6CE6 /* NSMutableString+Common.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E72F82C1B144778001B6CE6 /* NSMutableString+Common.m */; };
274276
4E72F82F1B159997001B6CE6 /* tipIcon_Other@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E72F82E1B159997001B6CE6 /* tipIcon_Other@2x.png */; };
275277
4E72F8331B15B811001B6CE6 /* gif_mark@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E72F8321B15B811001B6CE6 /* gif_mark@2x.png */; };
@@ -547,6 +549,9 @@
547549
4EF17EE61B3C3112003CDD2D /* intro_tip_5@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EF17EC81B3C3112003CDD2D /* intro_tip_5@2x.png */; };
548550
4EF17EE71B3C3112003CDD2D /* intro_tip_5@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EF17EC91B3C3112003CDD2D /* intro_tip_5@3x.png */; };
549551
4EF17EE81B3C3112003CDD2D /* intro_icon_6@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EF17ECA1B3C3112003CDD2D /* intro_icon_6@2x.png */; };
552+
4EF374161BB1254700DDA662 /* LocalFoldersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EF374151BB1254700DDA662 /* LocalFoldersViewController.m */; settings = {ASSET_TAGS = (); }; };
553+
4EF374191BB1255E00DDA662 /* LocalFilesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EF374181BB1255E00DDA662 /* LocalFilesViewController.m */; settings = {ASSET_TAGS = (); }; };
554+
4EF3741C1BB1258600DDA662 /* LocalFileViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EF3741B1BB1258600DDA662 /* LocalFileViewController.m */; settings = {ASSET_TAGS = (); }; };
550555
4EF818161B049C89005F974B /* addPictureBgImage@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EF818151B049C89005F974B /* addPictureBgImage@2x.png */; };
551556
4EF818191B05C984005F974B /* ProjectTopicActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EF818181B05C984005F974B /* ProjectTopicActivity.m */; };
552557
4EF8181F1B05C9D8005F974B /* ProjectLineNoteActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EF8181E1B05C9D8005F974B /* ProjectLineNoteActivity.m */; };
@@ -1300,6 +1305,10 @@
13001305
4E6FB0541B5799B100B0A17B /* ProjectTag.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProjectTag.m; sourceTree = "<group>"; };
13011306
4E6FB0561B58DB0A00B0A17B /* ProjectTagsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectTagsView.h; sourceTree = "<group>"; };
13021307
4E6FB0571B58DB0A00B0A17B /* ProjectTagsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProjectTagsView.m; sourceTree = "<group>"; };
1308+
4E715A301BB1278200A5D24B /* LocalFolderCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalFolderCell.h; sourceTree = "<group>"; };
1309+
4E715A311BB1278200A5D24B /* LocalFolderCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocalFolderCell.m; sourceTree = "<group>"; };
1310+
4E715A331BB1279D00A5D24B /* LocalFileCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalFileCell.h; sourceTree = "<group>"; };
1311+
4E715A341BB1279D00A5D24B /* LocalFileCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocalFileCell.m; sourceTree = "<group>"; };
13031312
4E72F82B1B144778001B6CE6 /* NSMutableString+Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableString+Common.h"; sourceTree = "<group>"; };
13041313
4E72F82C1B144778001B6CE6 /* NSMutableString+Common.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableString+Common.m"; sourceTree = "<group>"; };
13051314
4E72F82E1B159997001B6CE6 /* tipIcon_Other@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tipIcon_Other@2x.png"; sourceTree = "<group>"; };
@@ -1735,6 +1744,12 @@
17351744
4EF17EC81B3C3112003CDD2D /* intro_tip_5@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "intro_tip_5@2x.png"; sourceTree = "<group>"; };
17361745
4EF17EC91B3C3112003CDD2D /* intro_tip_5@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "intro_tip_5@3x.png"; sourceTree = "<group>"; };
17371746
4EF17ECA1B3C3112003CDD2D /* intro_icon_6@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "intro_icon_6@2x.png"; sourceTree = "<group>"; };
1747+
4EF374141BB1254700DDA662 /* LocalFoldersViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalFoldersViewController.h; sourceTree = "<group>"; };
1748+
4EF374151BB1254700DDA662 /* LocalFoldersViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocalFoldersViewController.m; sourceTree = "<group>"; };
1749+
4EF374171BB1255E00DDA662 /* LocalFilesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalFilesViewController.h; sourceTree = "<group>"; };
1750+
4EF374181BB1255E00DDA662 /* LocalFilesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocalFilesViewController.m; sourceTree = "<group>"; };
1751+
4EF3741A1BB1258600DDA662 /* LocalFileViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalFileViewController.h; sourceTree = "<group>"; };
1752+
4EF3741B1BB1258600DDA662 /* LocalFileViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocalFileViewController.m; sourceTree = "<group>"; };
17381753
4EF818151B049C89005F974B /* addPictureBgImage@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "addPictureBgImage@2x.png"; sourceTree = "<group>"; };
17391754
4EF818171B05C984005F974B /* ProjectTopicActivity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectTopicActivity.h; sourceTree = "<group>"; };
17401755
4EF818181B05C984005F974B /* ProjectTopicActivity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProjectTopicActivity.m; sourceTree = "<group>"; };
@@ -3839,6 +3854,12 @@
38393854
4E753D431B8AFDEC003A00B9 /* FileEditViewController.m */,
38403855
4E0B9A321BAC1CD100D57D54 /* ForkTreeViewController.h */,
38413856
4E0B9A331BAC1CD100D57D54 /* ForkTreeViewController.m */,
3857+
4EF374141BB1254700DDA662 /* LocalFoldersViewController.h */,
3858+
4EF374151BB1254700DDA662 /* LocalFoldersViewController.m */,
3859+
4EF374171BB1255E00DDA662 /* LocalFilesViewController.h */,
3860+
4EF374181BB1255E00DDA662 /* LocalFilesViewController.m */,
3861+
4EF3741A1BB1258600DDA662 /* LocalFileViewController.h */,
3862+
4EF3741B1BB1258600DDA662 /* LocalFileViewController.m */,
38423863
);
38433864
path = Controllers;
38443865
sourceTree = "<group>";
@@ -4596,6 +4617,10 @@
45964617
4EAE06C71B7C9EFF00179F4B /* FileVersionCell.m */,
45974618
4E0B9A351BAD377600D57D54 /* ForkTreeCell.h */,
45984619
4E0B9A361BAD377600D57D54 /* ForkTreeCell.m */,
4620+
4E715A301BB1278200A5D24B /* LocalFolderCell.h */,
4621+
4E715A311BB1278200A5D24B /* LocalFolderCell.m */,
4622+
4E715A331BB1279D00A5D24B /* LocalFileCell.h */,
4623+
4E715A341BB1279D00A5D24B /* LocalFileCell.m */,
45994624
);
46004625
path = Cell;
46014626
sourceTree = "<group>";
@@ -5283,6 +5308,7 @@
52835308
4EB0C2001A807ED00042FC4F /* NSURL+Common.m in Sources */,
52845309
4E6BA2E71A1EE6AF005FD721 /* UIRefreshControl+AFNetworking.m in Sources */,
52855310
4EE1A22D1B5D02CA004284F1 /* ProjectCodeListView.m in Sources */,
5311+
4EF374191BB1255E00DDA662 /* LocalFilesViewController.m in Sources */,
52865312
8EF643BF19FF7E2900F7EEB0 /* SettingTextCell.m in Sources */,
52875313
8E64ED8419ED0CE3006E99DA /* QBImagePickerGroupCell.m in Sources */,
52885314
4ECE8AE71A3943E80021E29C /* UITableView+Common.m in Sources */,
@@ -5297,6 +5323,7 @@
52975323
8EA6D1CD19E240C40076D59C /* UIUnderlinedButton.m in Sources */,
52985324
4E5F39021AC951060010515D /* TaskCommentCCell.m in Sources */,
52995325
4E095A661B6909F9008DC439 /* AutoSlideScrollView.m in Sources */,
5326+
4EF374161BB1254700DDA662 /* LocalFoldersViewController.m in Sources */,
53005327
4ECE8AD91A3943E80021E29C /* UIViewController+DownMenu.m in Sources */,
53015328
4E94C5011B4D2B9300EB668A /* PopMenu.m in Sources */,
53025329
8EA6D13019E240C40076D59C /* LikersViewController.m in Sources */,
@@ -5473,6 +5500,7 @@
54735500
4ECE8AD81A3943E80021E29C /* UIDownMenuButton.m in Sources */,
54745501
8EA6D14819E240C40076D59C /* UsersViewController.m in Sources */,
54755502
4E94C4FF1B4D2B9300EB668A /* MenuButton.m in Sources */,
5503+
4EF3741C1BB1258600DDA662 /* LocalFileViewController.m in Sources */,
54765504
3A3878401AE295970078D5DE /* ResetLabelCell.m in Sources */,
54775505
4EA679201A15AB9F001A0324 /* FileListViewController.m in Sources */,
54785506
8EA6D14119E240C40076D59C /* ValueListViewController.m in Sources */,
@@ -5593,9 +5621,11 @@
55935621
8EA6D1BA19E240C40076D59C /* Projects.m in Sources */,
55945622
4E996BDF1ABA7CE100C704F1 /* UserInfoDetailUserCell.m in Sources */,
55955623
4EACB4461A2C60110097ABB3 /* ProjectActivities.m in Sources */,
5624+
4E715A351BB1279D00A5D24B /* LocalFileCell.m in Sources */,
55965625
8EA6D1CB19E240C40076D59C /* UITapImageView.m in Sources */,
55975626
4E8D5D5D1B45295D00B70936 /* NSURL+OTPURLArguments.m in Sources */,
55985627
4EAE06AB1B7B23EA00179F4B /* FileActivitiesViewController.m in Sources */,
5628+
4E715A321BB1278200A5D24B /* LocalFolderCell.m in Sources */,
55995629
4E217F171A70EDC700F6DF88 /* SVWebViewControllerActivity.m in Sources */,
56005630
4E996BE81ABBCD2D00C704F1 /* TaskDescriptionCell.m in Sources */,
56015631
);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// LocalFileViewController.h
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/9/22.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "BaseViewController.h"
10+
11+
@interface LocalFileViewController : BaseViewController
12+
@property (strong, nonatomic) NSString *projectName;
13+
@property (strong, nonatomic) NSURL *fileUrl;
14+
@property (copy, nonatomic) void (^fileHasBeenDeletedBlock)(NSURL *fileUrl);//暂时不在这个页面做删除
15+
@end
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
//
2+
// LocalFileViewController.m
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/9/22.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import <QuickLook/QuickLook.h>
10+
#import "LocalFileViewController.h"
11+
#import "Coding_NetAPIManager.h"
12+
#import "WebContentManager.h"
13+
#import "BasicPreviewItem.h"
14+
15+
@interface LocalFileViewController ()<QLPreviewControllerDataSource, QLPreviewControllerDelegate, UIDocumentInteractionControllerDelegate, UIWebViewDelegate>
16+
17+
@property (strong, nonatomic) QLPreviewController *previewController;
18+
@property (nonatomic, strong) UIDocumentInteractionController *docInteractionController;
19+
20+
@property (strong, nonatomic) UIWebView *contentWebView;
21+
@property (strong, nonatomic) UIActivityIndicatorView *activityIndicator;
22+
23+
@property (strong, nonatomic) NSString *fileName, *fileType;
24+
25+
@end
26+
27+
@implementation LocalFileViewController
28+
29+
- (void)setFileUrl:(NSURL *)fileUrl{
30+
_fileUrl = fileUrl;
31+
if (_fileUrl.path.length > 0) {
32+
NSArray *valueList = [[[self.fileUrl.path componentsSeparatedByString:@"/"] lastObject] componentsSeparatedByString:@"|||"];
33+
_fileName = valueList[0];
34+
_fileType = [[[_fileName componentsSeparatedByString:@"."] lastObject] lowercaseString];
35+
}
36+
}
37+
38+
- (UIDocumentInteractionController *)docInteractionController{
39+
if (_docInteractionController == nil){
40+
_docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:self.fileUrl];
41+
}
42+
return _docInteractionController;
43+
}
44+
45+
- (void)viewDidLoad {
46+
[super viewDidLoad];
47+
// Do any additional setup after loading the view.
48+
self.title = self.fileName;
49+
[self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"moreBtn_Nav"] style:UIBarButtonItemStylePlain target:self action:@selector(rightNavBtnClicked)] animated:NO];
50+
51+
if ([self.fileType isEqualToString:@"md"]
52+
|| [self.fileType isEqualToString:@"html"]
53+
|| [self.fileType isEqualToString:@"txt"]
54+
|| [self.fileType isEqualToString:@"plist"]){
55+
[self loadWebView:self.fileUrl];
56+
}else if ([QLPreviewController canPreviewItem:self.fileUrl]) {
57+
[self showDiskFile:self.fileUrl];
58+
}else {
59+
[self.view configBlankPage:EaseBlankPageTypeFileTypeCannotSupport hasData:NO hasError:NO reloadButtonBlock:nil];
60+
}
61+
}
62+
- (void)rightNavBtnClicked{
63+
[self openByOtherApp];
64+
}
65+
66+
- (void)openByOtherApp{
67+
[self.docInteractionController presentOpenInMenuFromBarButtonItem:self.navigationItem.rightBarButtonItem animated:YES];
68+
}
69+
70+
#pragma mark HandleData
71+
- (void)loadWebView:(NSURL *)fileUrl{
72+
self.previewController.view.hidden = YES;
73+
74+
if (!_contentWebView) {
75+
//用webView显示内容
76+
_contentWebView = [[UIWebView alloc] initWithFrame:self.view.bounds];
77+
_contentWebView.delegate = self;
78+
_contentWebView.backgroundColor = [UIColor clearColor];
79+
_contentWebView.opaque = NO;
80+
_contentWebView.scalesPageToFit = YES;
81+
//webview加载指示
82+
_activityIndicator = [[UIActivityIndicatorView alloc]
83+
initWithActivityIndicatorStyle:
84+
UIActivityIndicatorViewStyleGray];
85+
_activityIndicator.hidesWhenStopped = YES;
86+
[_activityIndicator setCenter:CGPointMake(CGRectGetWidth(_contentWebView.frame)/2, CGRectGetHeight(_contentWebView.frame)/2)];
87+
[_contentWebView addSubview:_activityIndicator];
88+
[self.view addSubview:_contentWebView];
89+
[_contentWebView mas_makeConstraints:^(MASConstraintMaker *make) {
90+
make.top.left.right.bottom.equalTo(self.view);
91+
}];
92+
}
93+
if ([self.fileType isEqualToString:@"md"]){
94+
NSString *mdStr = [NSString stringWithContentsOfURL:fileUrl encoding:NSUTF8StringEncoding error:nil];
95+
[self.activityIndicator startAnimating];
96+
[[Coding_NetAPIManager sharedManager] request_MDHtmlStr_WithMDStr:mdStr inProject:nil andBlock:^(id data, NSError *error) {
97+
NSString *htmlStr;
98+
htmlStr = data? data: @"加载失败";
99+
NSString *contentStr = [WebContentManager markdownPatternedWithContent:htmlStr];
100+
[self.contentWebView loadHTMLString:contentStr baseURL:nil];
101+
}];
102+
}else if ([self.fileType isEqualToString:@"html"]){
103+
NSString* htmlString = [NSString stringWithContentsOfURL:fileUrl encoding:NSUTF8StringEncoding error:nil];
104+
[self.contentWebView loadHTMLString:htmlString baseURL:nil];
105+
}else if ([self.fileType isEqualToString:@"plist"]
106+
|| [self.fileType isEqualToString:@"txt"]){
107+
NSData *fileData = [NSData dataWithContentsOfURL:fileUrl];
108+
[self.contentWebView loadData:fileData MIMEType:@"text/text" textEncodingName:@"UTF-8" baseURL:fileUrl];
109+
}else{
110+
[self.contentWebView loadRequest:[NSURLRequest requestWithURL:fileUrl]];
111+
}
112+
self.contentWebView.hidden = NO;
113+
}
114+
115+
- (void)showDiskFile:(NSURL *)fileUrl{
116+
self.contentWebView.hidden = YES;
117+
if (!self.previewController) {
118+
QLPreviewController* preview = [[QLPreviewController alloc] init];
119+
preview.dataSource = self;
120+
preview.delegate = self;
121+
[self.view addSubview:preview.view];
122+
[preview.view mas_makeConstraints:^(MASConstraintMaker *make) {
123+
make.top.left.right.bottom.equalTo(self.view);
124+
}];
125+
self.previewController = preview;
126+
}
127+
self.previewController.view.hidden = NO;
128+
}
129+
130+
#pragma mark - QLPreviewControllerDataSource
131+
- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller{
132+
NSInteger num = 0;
133+
if (self.fileUrl) {
134+
num = 1;
135+
}
136+
return num;
137+
}
138+
139+
- (id <QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index{
140+
return [BasicPreviewItem itemWithUrl:self.fileUrl];
141+
}
142+
143+
@end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// LocalFilesViewController.h
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/9/22.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "BaseViewController.h"
10+
11+
@interface LocalFilesViewController : BaseViewController
12+
@property (strong, nonatomic) NSString *projectName;
13+
@property (strong, nonatomic) NSMutableArray *fileList;
14+
@end
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//
2+
// LocalFilesViewController.m
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/9/22.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "LocalFilesViewController.h"
10+
#import "LocalFileCell.h"
11+
#import "LocalFileViewController.h"
12+
13+
@interface LocalFilesViewController ()<UITableViewDataSource, UITableViewDelegate>
14+
@property (strong, nonatomic) UITableView *myTableView;
15+
16+
@end
17+
18+
@implementation LocalFilesViewController
19+
- (void)viewDidLoad{
20+
[super viewDidLoad];
21+
self.title = self.projectName;
22+
_myTableView = ({
23+
UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
24+
tableView.backgroundColor = [UIColor clearColor];
25+
tableView.delegate = self;
26+
tableView.dataSource = self;
27+
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
28+
[tableView registerClass:[LocalFileCell class] forCellReuseIdentifier:kCellIdentifier_LocalFileCell];
29+
tableView.sectionIndexBackgroundColor = [UIColor clearColor];
30+
tableView.sectionIndexTrackingBackgroundColor = [UIColor clearColor];
31+
tableView.sectionIndexColor = [UIColor colorWithHexString:@"0x666666"];
32+
[self.view addSubview:tableView];
33+
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
34+
make.edges.equalTo(self.view);
35+
}];
36+
tableView;
37+
});
38+
}
39+
40+
#pragma mark T
41+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
42+
return _fileList.count;
43+
}
44+
45+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
46+
LocalFileCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_LocalFileCell forIndexPath:indexPath];
47+
cell.fileUrl = _fileList[indexPath.row];
48+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
49+
return cell;
50+
}
51+
52+
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
53+
return [LocalFileCell cellHeight];
54+
}
55+
56+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
57+
[tableView deselectRowAtIndexPath:indexPath animated:YES];
58+
59+
LocalFileViewController *vc = [LocalFileViewController new];
60+
vc.projectName = self.projectName;
61+
vc.fileUrl = self.fileList[indexPath.row];
62+
63+
[self.navigationController pushViewController:vc animated:YES];
64+
}
65+
@end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// LocalFoldersViewController.h
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/9/22.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "BaseViewController.h"
10+
11+
@interface LocalFoldersViewController : BaseViewController
12+
13+
@end

0 commit comments

Comments
 (0)