Skip to content

Commit 50a0d01

Browse files
committed
查看描述 & 页边距
1 parent 2676ed2 commit 50a0d01

9 files changed

Lines changed: 74 additions & 38 deletions

File tree

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
4E6384011B33C18700D98648 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 4E6383FA1B33C18700D98648 /* [email protected] */; };
169169
4E6384031B33C8E900D98648 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 4E6384021B33C8E900D98648 /* [email protected] */; };
170170
4E63840B1B33F9B400D98648 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 4E63840A1B33F9B400D98648 /* [email protected] */; };
171+
4E63840F1B34124000D98648 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 4E63840E1B34124000D98648 /* [email protected] */; };
171172
4E66EE261A28226000DA1B3E /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 4E66EE211A28226000DA1B3E /* [email protected] */; };
172173
4E66EE271A28226000DA1B3E /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 4E66EE221A28226000DA1B3E /* [email protected] */; };
173174
4E66EE281A28226000DA1B3E /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 4E66EE231A28226000DA1B3E /* [email protected] */; };
@@ -936,6 +937,7 @@
936937
4E6383FA1B33C18700D98648 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
937938
4E6384021B33C8E900D98648 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
938939
4E63840A1B33F9B400D98648 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
940+
4E63840E1B34124000D98648 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
939941
4E66EE211A28226000DA1B3E /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
940942
4E66EE221A28226000DA1B3E /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
941943
4E66EE231A28226000DA1B3E /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
@@ -1907,6 +1909,7 @@
19071909
4E6383A01B3262D300D98648 /* [email protected] */,
19081910
4E6383A11B3262D300D98648 /* [email protected] */,
19091911
4E6383A21B3262D300D98648 /* [email protected] */,
1912+
4E63840E1B34124000D98648 /* [email protected] */,
19101913
);
19111914
path = task;
19121915
sourceTree = "<group>";
@@ -3847,6 +3850,7 @@
38473850
4E6383B91B32640900D98648 /* [email protected] in Resources */,
38483851
8E97CEAB1A0C7E26006F9AD7 /* [email protected] in Resources */,
38493852
8EA6D1AA19E240C40076D59C /* Images.xcassets in Resources */,
3853+
4E63840F1B34124000D98648 /* [email protected] in Resources */,
38503854
4E6383C71B3265DC00D98648 /* [email protected] in Resources */,
38513855
8ED2AAFB19F60D5200607A1D /* [email protected] in Resources */,
38523856
8E97CE981A0C7E26006F9AD7 /* [email protected] in Resources */,

Coding_iOS/Controllers/EditTaskViewController.m

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
330330
};
331331

332332
cell.backgroundColor = kColorTableBG;
333-
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:20];
333+
// [tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:20];
334334
return cell;
335335
}else{
336336
TaskDescriptionCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TaskDescriptionCell forIndexPath:indexPath];
@@ -341,6 +341,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
341341
titleStr = _myCopyTask.has_description.boolValue? @"查看描述": @"补充描述";
342342
}
343343
[cell setTitleStr:titleStr andSpecail:[titleStr isEqualToString:@"查看描述"]];
344+
cell.buttonClickedBlock = ^(){
345+
if (weakSelf.myCopyTask.has_description.boolValue && !weakSelf.myCopyTask.task_description) {
346+
//描述内容 还没有加载成功
347+
return ;
348+
}
349+
[weakSelf goToDescriptionVC];
350+
};
344351
cell.backgroundColor = kColorTableBG;
345352
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:20];
346353
return cell;
@@ -349,7 +356,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
349356
LeftImage_LRTextCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_LeftImage_LRText forIndexPath:indexPath];
350357
[cell setObj:_myCopyTask type:indexPath.row];
351358
cell.backgroundColor = kColorTableBG;
352-
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:20];
359+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:60];
353360
return cell;
354361
}else{
355362
ProjectActivity *curActivity = [self.myCopyTask.activityList objectAtIndex:indexPath.row];
@@ -432,13 +439,13 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
432439
[tableView deselectRowAtIndexPath:indexPath animated:YES];
433440
ESWeakSelf;
434441
if (indexPath.section == 0) {
435-
if (indexPath.row != 0) {
436-
if (self.myCopyTask.has_description.boolValue && !self.myCopyTask.task_description) {
437-
//描述内容 还没有加载成功
438-
return ;
439-
}
440-
[self goToDescriptionVC];
441-
}
442+
// if (indexPath.row != 0) {
443+
// if (self.myCopyTask.has_description.boolValue && !self.myCopyTask.task_description) {
444+
// //描述内容 还没有加载成功
445+
// return ;
446+
// }
447+
// [self goToDescriptionVC];
448+
// }
442449
}else if (indexPath.section == 1){
443450
if (indexPath.row == LeftImage_LRTextCellTypeTaskOwner) {
444451
ProjectMemberListViewController *vc = [[ProjectMemberListViewController alloc] init];
523 Bytes
Loading

Coding_iOS/Views/Cell/LeftImage_LRTextCell.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
2525
// Initialization code
2626
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
2727
if (!_iconView) {
28-
_iconView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 5, 33, 33)];
28+
_iconView = [[UIImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, 5, 33, 33)];
2929
[self.contentView addSubview:_iconView];
3030
}
3131
if (!_leftLabel) {

Coding_iOS/Views/Cell/TaskActivityCell.m

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
// Copyright (c) 2015年 Coding. All rights reserved.
77
//
88

9-
#define kTaskActivityCell_LeftPading 20.0
10-
#define kTaskActivityCell_LeftPading 20.0
11-
#define kTaskActivityCell_LeftContentPading (kTaskActivityCell_LeftPading + 40)
12-
#define kTaskActivityCell_ContentWidth (kScreen_Width - kTaskActivityCell_LeftContentPading - kTaskActivityCell_LeftPading)
9+
#define kTaskActivityCell_LeftContentPading (kPaddingLeftWidth + 40)
10+
#define kTaskActivityCell_ContentWidth (kScreen_Width - kTaskActivityCell_LeftContentPading - kPaddingLeftWidth)
1311

1412
#import "TaskActivityCell.h"
1513

@@ -34,7 +32,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
3432
}
3533
if (!_tipIconView) {
3634
CGFloat borderWidth = 2;
37-
_tipIconView = [[UIImageView alloc] initWithFrame:CGRectMake(kTaskActivityCell_LeftPading - borderWidth, 10, 25 + 2*borderWidth, 25 + 2*borderWidth)];
35+
_tipIconView = [[UIImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth - borderWidth, 10, 25 + 2*borderWidth, 25 + 2*borderWidth)];
3836
_tipIconView.contentMode = UIViewContentModeCenter;
3937

4038
_tipIconView.layer.masksToBounds = YES;
@@ -45,7 +43,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
4543
[self.contentView addSubview:_tipIconView];
4644
}
4745
if (!_contentLabel) {
48-
_contentLabel = [[UITTTAttributedLabel alloc] initWithFrame:CGRectMake(kTaskActivityCell_LeftContentPading, 10, kTaskActivityCell_ContentWidth, 15)];
46+
_contentLabel = [[UITTTAttributedLabel alloc] initWithFrame:CGRectMake(kTaskActivityCell_LeftContentPading, 13, kTaskActivityCell_ContentWidth, 15)];
4947
_contentLabel.numberOfLines = 0;
5048
[self.contentView addSubview:_contentLabel];
5149
}
@@ -114,10 +112,10 @@ + (NSAttributedString *)attrContentWithObj:(ProjectActivity *)curActivity{
114112
}
115113

116114
attrContent = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@", userName, contentStr]];
117-
[attrContent addAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:12],
115+
[attrContent addAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:13],
118116
NSForegroundColorAttributeName : [UIColor colorWithHexString:@"0x222222"]}
119117
range:NSMakeRange(0, userName.length)];
120-
[attrContent addAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12],
118+
[attrContent addAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:13],
121119
NSForegroundColorAttributeName : [UIColor colorWithHexString:@"0x999999"]}
122120
range:NSMakeRange(userName.length + 1, contentStr.length)];
123121

@@ -136,7 +134,7 @@ + (CGFloat)cellHeightWithObj:(id)obj{
136134
if ([obj isKindOfClass:[ProjectActivity class]]) {
137135
NSAttributedString *attrContent = [self attrContentWithObj:obj];
138136
CGFloat contentHeight = [attrContent boundingRectWithSize:CGSizeMake(kTaskActivityCell_ContentWidth, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size.height;
139-
cellHeight = ceilf(contentHeight + 20);
137+
cellHeight = ceilf(contentHeight + 26);
140138
cellHeight = MAX(44, cellHeight);
141139
}
142140
return cellHeight;

Coding_iOS/Views/Cell/TaskCommentCell.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
#define kTaskCommentCell_FontContent [UIFont systemFontOfSize:15]
10-
#define kTaskCommentCell_LeftPading 35.0
10+
#define kTaskCommentCell_LeftPading 30.0
1111
#define kTaskCommentCell_LeftContentPading (kTaskCommentCell_LeftPading + 40)
1212
#define kTaskCommentCell_ContentWidth (kScreen_Width - kTaskCommentCell_LeftContentPading - kTaskCommentCell_LeftPading)
1313

@@ -46,7 +46,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
4646
}
4747
if (!_ownerIconView) {
4848
CGFloat borderWidth = 0;
49-
_ownerIconView = [[UIImageView alloc] initWithFrame:CGRectMake(20 - borderWidth, curBottomY, 25+ 2*borderWidth, 25 + 2*borderWidth)];
49+
_ownerIconView = [[UIImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth - borderWidth, curBottomY, 25+ 2*borderWidth, 25 + 2*borderWidth)];
5050

5151
_ownerIconView.layer.masksToBounds = YES;
5252
_ownerIconView.layer.cornerRadius = _ownerIconView.frame.size.width/2;

Coding_iOS/Views/Cell/TaskContentCell.m

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
// Created by 王 原闯 on 14-8-19.
66
// Copyright (c) 2014年 Coding. All rights reserved.
77
//
8-
#define kTaskContentCell_PadingLeft 20.0
9-
#define kTaskContentCell_PadingRight 20.0
108
#define kTaskContentCell_ContentHeightMin kScaleFrom_iPhone5_Desgin(120.0)
119
#define kTextView_Pading 8.0
12-
#define kTaskContentCell_ContentWidth (kScreen_Width-kTaskContentCell_PadingLeft-kTaskContentCell_PadingRight + 2*kTextView_Pading)
10+
#define kTaskContentCell_ContentWidth (kScreen_Width-kPaddingLeftWidth-kPaddingLeftWidth + 2*kTextView_Pading)
1311
#define kTaskContentCell_ContentFont [UIFont systemFontOfSize:18]
1412

1513

@@ -19,6 +17,8 @@ @interface TaskContentCell ()
1917
@property (strong, nonatomic) UITextView *taskContentView;
2018
@property (strong, nonatomic) UIButton *deleteBtn;
2119
@property (strong, nonatomic) UILabel *creatorLabel;
20+
@property (strong, nonatomic) UIView *lineView;
21+
2222
@end
2323

2424
@implementation TaskContentCell
@@ -53,11 +53,16 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
5353
button;
5454
});
5555
}
56+
if (!_lineView) {
57+
_lineView = [[UIView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, 0, kScreen_Width - 2*kPaddingLeftWidth, 0.5)];
58+
_lineView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"dot_line"]];
59+
[self.contentView addSubview:_lineView];
60+
}
5661
[_taskContentView mas_makeConstraints:^(MASConstraintMaker *make) {
57-
make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(5, kTaskContentCell_PadingLeft-kTextView_Pading, 35, kTaskContentCell_PadingLeft-kTextView_Pading));
62+
make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(5, kPaddingLeftWidth-kTextView_Pading, 35, kPaddingLeftWidth-kTextView_Pading));
5863
}];
5964
[_creatorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
60-
make.left.equalTo(self.contentView.mas_left).offset(kTaskContentCell_PadingLeft);
65+
make.left.equalTo(self.contentView.mas_left).offset(kPaddingLeftWidth);
6166
make.right.equalTo(_deleteBtn.mas_left).offset(10);
6267
make.bottom.equalTo(self.contentView.mas_bottom).offset(-10);
6368
make.height.mas_equalTo(20);
@@ -66,7 +71,13 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
6671
[_deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
6772
make.size.mas_equalTo(CGSizeMake(44, 20));
6873
make.bottom.equalTo(self.contentView.mas_bottom).offset(-10);
69-
make.right.equalTo(self.contentView.mas_right).offset(-kTaskContentCell_PadingRight);
74+
make.right.equalTo(self.contentView.mas_right).offset(-kPaddingLeftWidth);
75+
}];
76+
[_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
77+
make.left.equalTo(self.contentView).offset(kPaddingLeftWidth);
78+
make.right.equalTo(self.contentView).offset(-kPaddingLeftWidth);
79+
make.height.mas_equalTo(0.5);
80+
make.bottom.equalTo(self.contentView);
7081
}];
7182
}
7283
return self;

Coding_iOS/Views/Cell/TaskDescriptionCell.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#import <UIKit/UIKit.h>
1212

1313
@interface TaskDescriptionCell : UITableViewCell
14+
@property (copy, nonatomic) void(^buttonClickedBlock)();
1415
- (void)setTitleStr:(NSString *)title andSpecail:(BOOL)isSpecail;
16+
1517
+ (CGFloat)cellHeight;
1618
@end

Coding_iOS/Views/Cell/TaskDescriptionCell.m

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#import "TaskDescriptionCell.h"
1010

1111
@interface TaskDescriptionCell ()
12-
@property (strong, nonatomic) UILabel *titleLabel;
12+
@property (strong, nonatomic) UIButton *button;
1313
@end
1414

1515
@implementation TaskDescriptionCell
@@ -18,24 +18,38 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
1818
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
1919
if (self) {
2020
// Initialization code
21-
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
22-
if (!_titleLabel) {
23-
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 7, (kScreen_Width - 120), 30)];
24-
_titleLabel.backgroundColor = [UIColor clearColor];
25-
_titleLabel.font = [UIFont systemFontOfSize:16];
26-
_titleLabel.textColor = [UIColor colorWithHexString:@"0x222222"];
27-
[self.contentView addSubview:_titleLabel];
21+
self.selectionStyle = UITableViewCellSelectionStyleNone;
22+
23+
if (!_button) {
24+
_button = [[UIButton alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, ([[self class] cellHeight] - 30)/2, kScreen_Width - 2*kPaddingLeftWidth, 30)];
25+
_button.titleLabel.font = [UIFont systemFontOfSize:16];
26+
_button.backgroundColor = [UIColor colorWithHexString:@"0xf0f0f0"];
27+
_button.layer.masksToBounds = YES;
28+
_button.layer.cornerRadius = 2.0;
29+
[_button setImage:[UIImage imageNamed:@"task_icon_arrow"] forState:UIControlStateNormal];
30+
31+
_button.titleEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 10);
32+
_button.imageEdgeInsets = UIEdgeInsetsMake(0, 70, 0, -70);
33+
[_button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
34+
[self.contentView addSubview:_button];
2835
}
2936
}
3037
return self;
3138
}
3239

3340
- (void)setTitleStr:(NSString *)title andSpecail:(BOOL)isSpecail{
34-
_titleLabel.text = title;
35-
_titleLabel.textColor = [UIColor colorWithHexString:isSpecail? @"0x3bbd79": @"0x222222"];
41+
[_button setTitle:title forState:UIControlStateNormal];
42+
[_button setTitleColor:[UIColor colorWithHexString:isSpecail? @"0x3bbd79": @"0x222222"] forState:UIControlStateNormal];
43+
44+
}
45+
46+
- (void)buttonClicked:(id)sender{
47+
if (self.buttonClickedBlock) {
48+
self.buttonClickedBlock();
49+
}
3650
}
3751

3852
+ (CGFloat)cellHeight{
39-
return 44.0;
53+
return 54.0;
4054
}
4155
@end

0 commit comments

Comments
 (0)