Skip to content

Commit 3c6a55c

Browse files
committed
Task-修改
1 parent a46ef55 commit 3c6a55c

File tree

9 files changed

+166
-80
lines changed

9 files changed

+166
-80
lines changed

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
4E996BDF1ABA7CE100C704F1 /* UserInfoDetailUserCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E996BDE1ABA7CE100C704F1 /* UserInfoDetailUserCell.m */; };
161161
4E996BE21ABA957B00C704F1 /* ProjectListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E996BE11ABA957B00C704F1 /* ProjectListViewController.m */; };
162162
4E996BE51ABAB1D700C704F1 /* ProjectListTaCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E996BE41ABAB1D700C704F1 /* ProjectListTaCell.m */; };
163+
4E996BE81ABBCD2D00C704F1 /* TaskDescriptionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E996BE71ABBCD2D00C704F1 /* TaskDescriptionCell.m */; };
163164
4EA679031A11F18A001A0324 /* libUMessage_Sdk_1.1.0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EA679011A11F18A001A0324 /* libUMessage_Sdk_1.1.0.a */; };
164165
4EA679061A130C24001A0324 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 4EA679041A130C24001A0324 /* [email protected] */; };
165166
4EA679071A130C24001A0324 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 4EA679051A130C24001A0324 /* [email protected] */; };
@@ -819,6 +820,8 @@
819820
4E996BE11ABA957B00C704F1 /* ProjectListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProjectListViewController.m; sourceTree = "<group>"; };
820821
4E996BE31ABAB1D700C704F1 /* ProjectListTaCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectListTaCell.h; sourceTree = "<group>"; };
821822
4E996BE41ABAB1D700C704F1 /* ProjectListTaCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProjectListTaCell.m; sourceTree = "<group>"; };
823+
4E996BE61ABBCD2D00C704F1 /* TaskDescriptionCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskDescriptionCell.h; sourceTree = "<group>"; };
824+
4E996BE71ABBCD2D00C704F1 /* TaskDescriptionCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskDescriptionCell.m; sourceTree = "<group>"; };
822825
4EA679011A11F18A001A0324 /* libUMessage_Sdk_1.1.0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libUMessage_Sdk_1.1.0.a; sourceTree = "<group>"; };
823826
4EA679021A11F18A001A0324 /* UMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UMessage.h; sourceTree = "<group>"; };
824827
4EA679041A130C24001A0324 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
@@ -2988,6 +2991,8 @@
29882991
4E996BDE1ABA7CE100C704F1 /* UserInfoDetailUserCell.m */,
29892992
4E996BE31ABAB1D700C704F1 /* ProjectListTaCell.h */,
29902993
4E996BE41ABAB1D700C704F1 /* ProjectListTaCell.m */,
2994+
4E996BE61ABBCD2D00C704F1 /* TaskDescriptionCell.h */,
2995+
4E996BE71ABBCD2D00C704F1 /* TaskDescriptionCell.m */,
29912996
);
29922997
path = Cell;
29932998
sourceTree = "<group>";
@@ -3024,7 +3029,7 @@
30243029
ORGANIZATIONNAME = Coding;
30253030
TargetAttributes = {
30263031
8E47700F198770E700997D05 = {
3027-
DevelopmentTeam = 6G53LMMD47;
3032+
DevelopmentTeam = QN5Z87S3LH;
30283033
SystemCapabilities = {
30293034
com.apple.BackgroundModes = {
30303035
enabled = 0;
@@ -3156,7 +3161,6 @@
31563161
4E0849831A918A7F00BD27F6 /* [email protected] in Resources */,
31573162
8E97CEA91A0C7E26006F9AD7 /* [email protected] in Resources */,
31583163
0A6E6BBB1AB168B0004C0107 /* [email protected] in Resources */,
3159-
4E3AD3D11A273A4A005C749B /* FontAwesome.ttf in Resources */,
31603164
8EA6D16919E240C40076D59C /* [email protected] in Resources */,
31613165
4E03ACA81A5D3BD1002B000B /* [email protected] in Resources */,
31623166
8EA6D18F19E240C40076D59C /* [email protected] in Resources */,
@@ -3653,6 +3657,7 @@
36533657
4EACB4461A2C60110097ABB3 /* ProjectActivities.m in Sources */,
36543658
8EA6D1CB19E240C40076D59C /* UITapImageView.m in Sources */,
36553659
4E217F171A70EDC700F6DF88 /* SVWebViewControllerActivity.m in Sources */,
3660+
4E996BE81ABBCD2D00C704F1 /* TaskDescriptionCell.m in Sources */,
36563661
);
36573662
runOnlyForDeploymentPostprocessing = 0;
36583663
};

Coding_iOS/Controllers/EditTaskViewController.m

Lines changed: 64 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#import "TaskCommentCell.h"
2525
#import "TaskCommentTopCell.h"
2626
#import "TaskCommentBlankCell.h"
27+
#import "TaskDescriptionCell.h"
2728
#import "ActionSheetDatePicker.h"
2829
#import "TaskDescriptionViewController.h"
2930

@@ -53,13 +54,11 @@ - (void)viewDidLoad
5354
// Do any additional setup after loading the view.
5455
switch (_myTask.handleType) {
5556
case TaskHandleTypeAdd:{
56-
self.title = @"创建任务";
5757
_myCopyTask = [Task taskWithTask:_myTask];
5858
_myCopyTask.handleType = TaskHandleTypeAdd;
5959
}
6060
break;
6161
case TaskHandleTypeEdit:{
62-
self.title = @"任务详情";
6362
_myCopyTask = [Task taskWithTask:_myTask];
6463

6564
//评论
@@ -80,6 +79,7 @@ - (void)viewDidLoad
8079
default:
8180
break;
8281
}
82+
[self configTitle];
8383

8484
_myTableView = ({
8585
UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
@@ -91,6 +91,7 @@ - (void)viewDidLoad
9191
[tableView registerClass:[TaskCommentCell class] forCellReuseIdentifier:kCellIdentifier_TaskComment];
9292
[tableView registerClass:[TaskCommentBlankCell class] forCellReuseIdentifier:kCellIdentifier_TaskCommentBlank];
9393
[tableView registerClass:[TaskCommentTopCell class] forCellReuseIdentifier:kCellIdentifier_TaskCommentTop];
94+
[tableView registerClass:[TaskDescriptionCell class] forCellReuseIdentifier:kCellIdentifier_TaskDescriptionCell];
9495
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
9596
[self.view addSubview:tableView];
9697
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -122,6 +123,14 @@ - (void)viewDidLoad
122123
}];
123124
}
124125

126+
- (void)configTitle{
127+
if (_myTask.handleType == TaskEditTypeAdd) {
128+
self.title = @"创建任务";
129+
}else{
130+
self.title = _myTask.project.name;
131+
}
132+
}
133+
125134
- (void)viewWillDisappear:(BOOL)animated{
126135
[super viewWillDisappear:animated];
127136
if (_myMsgInputView) {
@@ -189,6 +198,7 @@ - (void)queryToRefreshTaskDetail{
189198
weakSelf.myMsgInputView.curProject = weakSelf.myCopyTask.project;
190199
weakSelf.myMsgInputView.commentOfId = weakSelf.myCopyTask.id;
191200
weakSelf.myMsgInputView.toUser = nil;
201+
[weakSelf configTitle];
192202

193203
[weakSelf.myTableView reloadData];
194204
[weakSelf queryToRefreshCommentList];
@@ -297,7 +307,7 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
297307
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
298308
NSInteger row = 0;
299309
if (section == 0) {
300-
row = 1;
310+
row = 2;
301311
}else if (section == 1){
302312
row = (self.myCopyTask.handleType == TaskHandleTypeAdd)? 3: 4;
303313
}else{
@@ -312,34 +322,47 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
312322
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
313323
if (indexPath.section == 0) {
314324
__weak typeof(self) weakSelf = self;
315-
316-
TaskContentCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TaskContent forIndexPath:indexPath];
317-
cell.task = _myCopyTask;
318-
cell.textValueChangedBlock = ^(NSString *textStr){
319-
weakSelf.myCopyTask.content = textStr;
320-
};
321-
cell.textViewBecomeFirstResponderBlock = ^(){
322-
[weakSelf.myMsgInputView isAndResignFirstResponder];
323-
};
324-
cell.deleteBtnClickedBlock = ^(Task *toDelete){
325-
[weakSelf.view endEditing:YES];
326-
UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle:@"删除此任务" buttonTitles:nil destructiveTitle:@"确认删除" cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
327-
if (index == 0) {
328-
[weakSelf deleteTask:toDelete];
325+
if (indexPath.row == 0) {
326+
TaskContentCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TaskContent forIndexPath:indexPath];
327+
cell.task = _myCopyTask;
328+
cell.textValueChangedBlock = ^(NSString *textStr){
329+
weakSelf.myCopyTask.content = textStr;
330+
};
331+
cell.textViewBecomeFirstResponderBlock = ^(){
332+
[weakSelf.myMsgInputView isAndResignFirstResponder];
333+
};
334+
cell.deleteBtnClickedBlock = ^(Task *toDelete){
335+
[weakSelf.view endEditing:YES];
336+
UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle:@"删除此任务" buttonTitles:nil destructiveTitle:@"确认删除" cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
337+
if (index == 0) {
338+
[weakSelf deleteTask:toDelete];
339+
}
340+
}];
341+
[actionSheet showInView:self.view];
342+
};
343+
cell.descriptionBtnClickedBlock = ^(Task *task){
344+
if (weakSelf.myCopyTask.has_description.boolValue && !weakSelf.myCopyTask.task_description) {
345+
return ;
329346
}
330-
}];
331-
[actionSheet showInView:self.view];
332-
};
333-
cell.descriptionBtnClickedBlock = ^(Task *task){
334-
if (weakSelf.myCopyTask.has_description.boolValue && !weakSelf.myCopyTask.task_description) {
335-
return ;
347+
[weakSelf goToDescriptionVC];
348+
};
349+
350+
cell.backgroundColor = kColorTableBG;
351+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:20];
352+
return cell;
353+
}else{
354+
TaskDescriptionCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TaskDescriptionCell forIndexPath:indexPath];
355+
NSString *titleStr;
356+
if (_myCopyTask.handleType == TaskEditTypeAdd) {
357+
titleStr = @"添加描述";
358+
}else{
359+
titleStr = _myCopyTask.has_description.boolValue? @"查看描述": @"补充描述";
336360
}
337-
[weakSelf goToDescriptionVC];
338-
};
339-
340-
cell.backgroundColor = kColorTableBG;
341-
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:20];
342-
return cell;
361+
[cell setTitleStr:titleStr];
362+
cell.backgroundColor = kColorTableBG;
363+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:20];
364+
return cell;
365+
}
343366
}else if (indexPath.section == 1){
344367
LeftImage_LRTextCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_LeftImage_LRText forIndexPath:indexPath];
345368
[cell setObj:_myCopyTask type:indexPath.row];
@@ -375,7 +398,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
375398
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
376399
CGFloat cellHeight = 0;
377400
if (indexPath.section == 0) {
378-
cellHeight = [TaskContentCell cellHeightWithObj:_myCopyTask];
401+
if (indexPath.row == 0) {
402+
cellHeight = [TaskContentCell cellHeightWithObj:_myCopyTask];
403+
}else{
404+
cellHeight = [TaskDescriptionCell cellHeight];
405+
}
379406
}else if (indexPath.section == 1){
380407
cellHeight = [LeftImage_LRTextCell cellHeight];
381408
}else{
@@ -424,7 +451,13 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
424451
[tableView deselectRowAtIndexPath:indexPath animated:YES];
425452
ESWeakSelf;
426453
if (indexPath.section == 0) {
427-
454+
if (indexPath.row != 0) {
455+
if (self.myCopyTask.has_description.boolValue && !self.myCopyTask.task_description) {
456+
//描述内容 还没有加载成功
457+
return ;
458+
}
459+
[self goToDescriptionVC];
460+
}
428461
}else if (indexPath.section == 1){
429462
if (indexPath.row == LeftImage_LRTextCellTypeTaskOwner) {
430463
ProjectMemberListViewController *vc = [[ProjectMemberListViewController alloc] init];

Coding_iOS/Controllers/MeSetting/SettingViewController.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// Copyright (c) 2014年 Coding. All rights reserved.
77
//
88

9-
#define kCellIdentifier_TitleDisclosure @"TitleDisclosureCell"
109
#import "SettingViewController.h"
1110
#import "TitleDisclosureCell.h"
1211
#import "Login.h"

Coding_iOS/Models/TweetSendLocation.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
#import "Login.h"
1111
#import "User.h"
1212

13-
NSString * const kBaiduGeotableId= @"95955";
14-
NSString * const kBaiduAK = @"9d1fee393e06554e155f797dc71d00f0";
13+
//NSString * const kBaiduGeotableId= @"95955";
14+
//NSString * const kBaiduAK = @"9d1fee393e06554e155f797dc71d00f0";
15+
16+
17+
NSString * const kBaiduGeotableId= @"96880";
18+
NSString * const kBaiduAK = @"ak046T8G6m1GvIPGKdOdq04D";
1519

1620
NSString * const kBaiduAPIPlacePath = @"place/v2/search";
1721
NSString * const kBaiduAPIGeosearchPath = @"geosearch/v3/nearby";

Coding_iOS/Views/Cell/TaskContentCell.m

Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
@interface TaskContentCell ()
1919
@property (strong, nonatomic) UITextView *taskContentView;
20-
@property (strong, nonatomic) UIButton *deleteBtn, *descriptionBtn;
20+
@property (strong, nonatomic) UIButton *deleteBtn;
21+
@property (strong, nonatomic) UILabel *creatorLabel;
2122
@end
2223

2324
@implementation TaskContentCell
@@ -34,50 +35,42 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
3435
_taskContentView.font = kTaskContentCell_ContentFont;
3536
_taskContentView.delegate = self;
3637
[self.contentView addSubview:_taskContentView];
37-
[_taskContentView mas_makeConstraints:^(MASConstraintMaker *make) {
38-
make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(0, kTaskContentCell_PadingLeft-kTextView_Pading, 40, kTaskContentCell_PadingLeft-kTextView_Pading));
39-
}];
4038
}
41-
if (!self.deleteBtn) {
42-
self.deleteBtn = ({
39+
if (!_creatorLabel) {
40+
_creatorLabel = [[UILabel alloc] init];
41+
_creatorLabel.font = [UIFont systemFontOfSize:12];
42+
_creatorLabel.textColor = [UIColor colorWithHexString:@"0x999999"];
43+
[self.contentView addSubview:_creatorLabel];
44+
}
45+
if (!_deleteBtn) {
46+
_deleteBtn = ({
4347
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
44-
button.layer.cornerRadius = 5.0;
45-
button.layer.borderWidth = 1.0;
46-
button.layer.borderColor = [UIColor colorWithHexString:@"0xdadada"].CGColor;
48+
// button.layer.cornerRadius = 5.0;
49+
// button.layer.borderWidth = 1.0;
50+
// button.layer.borderColor = [UIColor colorWithHexString:@"0xdadada"].CGColor;
4751
button.titleLabel.font = [UIFont systemFontOfSize:13];
4852
[button setTitleColor:[UIColor colorWithHexString:@"0x666666"] forState:UIControlStateNormal];
4953
[button setTitle:@"删除" forState:UIControlStateNormal];
5054
[button addTarget:self action:@selector(deleteBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
51-
52-
[self.contentView addSubview:button];
53-
[button mas_makeConstraints:^(MASConstraintMaker *make) {
54-
make.size.mas_equalTo(CGSizeMake(44, 27));
55-
make.bottom.equalTo(self.contentView.mas_bottom).offset(-10);
56-
make.right.equalTo(self.contentView.mas_right).offset(-kTaskContentCell_PadingRight);
57-
}];
58-
button;
59-
});
60-
}
61-
if (!self.descriptionBtn) {
62-
self.descriptionBtn = ({
63-
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
64-
button.layer.cornerRadius = 5.0;
65-
button.layer.borderWidth = 1.0;
66-
button.layer.borderColor = [UIColor colorWithHexString:@"0xdadada"].CGColor;
67-
button.titleLabel.font = [UIFont systemFontOfSize:13];
68-
[button addTarget:self action:@selector(descriptionBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
6955
[self.contentView addSubview:button];
70-
71-
[button mas_makeConstraints:^(MASConstraintMaker *make) {
72-
make.size.mas_equalTo(CGSizeMake(79, 27));
73-
make.bottom.equalTo(self.contentView.mas_bottom).offset(-10);
74-
make.left.equalTo(self.contentView.mas_left).offset(kTaskContentCell_PadingLeft);
75-
}];
76-
button.titleEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 10);
77-
button.imageEdgeInsets = UIEdgeInsetsMake(0, 52, 0, -52);
7856
button;
7957
});
8058
}
59+
[_taskContentView mas_makeConstraints:^(MASConstraintMaker *make) {
60+
make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(0, kTaskContentCell_PadingLeft-kTextView_Pading, 40, kTaskContentCell_PadingLeft-kTextView_Pading));
61+
}];
62+
[_creatorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
63+
make.left.equalTo(self.contentView.mas_left).offset(kTaskContentCell_PadingLeft);
64+
make.right.equalTo(_deleteBtn.mas_left).offset(10);
65+
make.bottom.equalTo(self.contentView.mas_bottom).offset(-10);
66+
make.height.mas_equalTo(20);
67+
}];
68+
69+
[_deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
70+
make.size.mas_equalTo(CGSizeMake(44, 20));
71+
make.bottom.equalTo(self.contentView.mas_bottom).offset(-10);
72+
make.right.equalTo(self.contentView.mas_right).offset(-kTaskContentCell_PadingRight);
73+
}];
8174
}
8275
return self;
8376
}
@@ -90,15 +83,11 @@ - (void)layoutSubviews{
9083
_taskContentView.text = _task.content;
9184

9285
if (_task.handleType == TaskHandleTypeAdd) {
86+
_creatorLabel.text = [NSString stringWithFormat:@"%@ 现在", _task.creator.name];
9387
_deleteBtn.hidden = YES;
94-
[_descriptionBtn setImage:[UIImage imageNamed:@"taskDescription_add_arrow"] forState:UIControlStateNormal];
95-
[_descriptionBtn setTitle:@"添加描述" forState:UIControlStateNormal];
96-
[_descriptionBtn setTitleColor:[UIColor colorWithHexString:@"0x666666"] forState:UIControlStateNormal];
9788
}else{
89+
_creatorLabel.text = [NSString stringWithFormat:@"%@ 创建于 %@", _task.creator.name, [_task.created_at stringTimesAgo]];
9890
_deleteBtn.hidden = NO;
99-
[_descriptionBtn setImage:[UIImage imageNamed:@"taskDescription_check_arrow"] forState:UIControlStateNormal];
100-
[_descriptionBtn setTitle:(_task.has_description.boolValue? @"查看描述": @"补充描述") forState:UIControlStateNormal];
101-
[_descriptionBtn setTitleColor:[UIColor colorWithHexString:@"0x3bbd79"] forState:UIControlStateNormal];
10291
}
10392
}
10493

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// TaskDescriptionCell.h
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/3/20.
6+
// Copyright (c) 2015年 Coding. All rights reserved.
7+
//
8+
9+
#define kCellIdentifier_TaskDescriptionCell @"TaskDescriptionCell"
10+
11+
#import <UIKit/UIKit.h>
12+
13+
@interface TaskDescriptionCell : UITableViewCell
14+
- (void)setTitleStr:(NSString *)title;
15+
+ (CGFloat)cellHeight;
16+
@end

0 commit comments

Comments
 (0)