GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Coding-iOS/Coding_iOS/Controllers/CodeListViewController.m at master · coding/Coding-iOS Expand file tree/ Copy pathCodeListViewController.mMore file actions executable file ·115 lines (104 loc) · 4.78 KB / Copy pathCodeListViewController.mFile metadata and controlsexecutable file ·115 lines (104 loc) · 4.78 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 // // CodeListViewController.m // Coding_iOS // // Created by 王 原闯 on 14/10/30. // Copyright (c) 2014年 Coding. All rights reserved. // #import "CodeListViewController.h" #import "CodeViewController.h" #import "ProjectViewController.h" #import "ProjectCommitsViewController.h" #import "ProjectViewController.h" @interface CodeListViewController () @property (strong, nonatomic) ProjectCodeListView *listView; @end @implementation CodeListViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.title = [[_myCodeTree.path componentsSeparatedByString:@"/"] lastObject]; [self configRightNavBtn]; _listView = [[ProjectCodeListView alloc] initWithFrame:self.view.bounds project:_myProject andCodeTree:_myCodeTree]; _listView.hideBranchTagButton = _hideBranchTagButton; __weak typeof(self) weakSelf = self; _listView.codeTreeFileOfRefBlock = ^(CodeTree_File *curCodeTreeFile, NSString *ref){ [weakSelf goToVCWith:curCodeTreeFile andRef:ref]; }; _listView.codeTreeChangedBlock = ^(CodeTree *tree){ weakSelf.myCodeTree = tree; }; [self.view addSubview:_listView]; [_listView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self.view); }]; } - (void)configRightNavBtn{ if (!self.navigationItem.rightBarButtonItem) { [self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"moreBtn_Nav"] style:UIBarButtonItemStylePlain target:self action:@selector(rightNavBtnClicked)] animated:NO]; } } - (void)rightNavBtnClicked{ NSMutableArray *actionTitles = @[@"上传图片", @"创建文本文件", @"查看提交记录", @"退出代码查看"].mutableCopy; if (!self.myCodeTree.can_edit) { [actionTitles removeObjectsInRange:NSMakeRange(0, 2)]; } __weak typeof(self) weakSelf = self; [[UIAlertController ea_actionSheetCustomWithTitle:nil buttonTitles:actionTitles destructiveTitle:nil cancelTitle:@"取消" andDidDismissBlock:^(UIAlertAction *action, NSInteger index) { if (!weakSelf.myCodeTree.can_edit) { index += 2; } if (index == 0) { [weakSelf.listView uploadImageClicked]; }else if (index == 1){ [weakSelf.listView createFileClicked]; }else if (index == 2){ [weakSelf goToCommitsVC]; }else if (index == 3){ [weakSelf popOutCodeVC]; } }] showInView:self.view]; } #pragma mark action - (void)goToVCWith:(CodeTree_File *)codeTreeFile andRef:(NSString *)ref{ DebugLog(@"%@", codeTreeFile.path); if ([codeTreeFile.mode isEqualToString:@"tree"]) {//文件夹 CodeTree *nextCodeTree = [CodeTree codeTreeWithRef:ref andPath:codeTreeFile.path]; CodeListViewController *vc = [[CodeListViewController alloc] init]; vc.myProject = _myProject; vc.myCodeTree = nextCodeTree; vc.hideBranchTagButton = self.hideBranchTagButton; [self.navigationController pushViewController:vc animated:YES]; }else if ([@[@"file", @"image", @"sym_link", @"executable"] containsObject:codeTreeFile.mode]){//文件 CodeFile *nextCodeFile = [CodeFile codeFileWithRef:ref andPath:codeTreeFile.path]; CodeViewController *vc = [CodeViewController codeVCWithProject:_myProject andCodeFile:nextCodeFile]; [self.navigationController pushViewController:vc animated:YES]; }else if ([codeTreeFile.mode isEqualToString:@"git_link"]){ UIViewController *vc = [BaseViewController analyseVCFromLinkStr:codeTreeFile.info.submoduleLink]; if (vc) { [self.navigationController pushViewController:vc animated:YES]; }else{ [NSObject showHudTipStr:@"有些文件还不支持查看呢_(:з」∠)_"]; } }else{ [NSObject showHudTipStr:@"有些文件还不支持查看呢_(:з」∠)_"]; } } - (void)goToCommitsVC{ ProjectCommitsViewController *vc = [ProjectCommitsViewController new]; vc.curProject = self.myProject; vc.curCommits = [Commits commitsWithRef:self.myCodeTree.ref Path:self.myCodeTree.path]; [self.navigationController pushViewController:vc animated:YES]; } - (void)popOutCodeVC{ __weak typeof(self) weakSelf = self; [self.navigationController.viewControllers enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(UIViewController *obj, NSUInteger idx, BOOL *stop) { if (![obj isKindOfClass:[CodeViewController class]] && ![obj isKindOfClass:[CodeListViewController class]] && !([obj isKindOfClass:[ProjectViewController class]] && [(ProjectViewController *)obj curType] == ProjectViewTypeCodes)) { *stop = YES; [weakSelf.navigationController popToViewController:obj animated:YES]; } }]; } @end |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |