Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c66c207

Browse files
author
mengyaoyao
committed
update
1 parent 31eca70 commit c66c207

File tree

5 files changed

+107
-1
lines changed

5 files changed

+107
-1
lines changed

CocoaAsyncSocket_TCP.xcodeproj/project.pbxproj

+17
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
B8565C921ECC67D300D53996 /* ChatRecordCover.m in Sources */ = {isa = PBXBuildFile; fileRef = B8565C911ECC67D300D53996 /* ChatRecordCover.m */; };
1011
B85F39BF1EC9C95100B2EA9E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B85F39BE1EC9C95100B2EA9E /* main.m */; };
1112
B85F39C81EC9C95100B2EA9E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B85F39C61EC9C95100B2EA9E /* Main.storyboard */; };
1213
B85F39CA1EC9C95100B2EA9E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B85F39C91EC9C95100B2EA9E /* Assets.xcassets */; };
@@ -83,6 +84,8 @@
8384
24AA3076491D2596209CE424 /* Pods_CocoaAsyncSocket_TCP.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CocoaAsyncSocket_TCP.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8485
4AE7FCF3D1D9A8F040607338 /* Pods-CocoaAsyncSocket_TCP.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CocoaAsyncSocket_TCP.release.xcconfig"; path = "Pods/Target Support Files/Pods-CocoaAsyncSocket_TCP/Pods-CocoaAsyncSocket_TCP.release.xcconfig"; sourceTree = "<group>"; };
8586
66DD7434C83D6F468099D4BF /* Pods-CocoaAsyncSocket_TCP.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CocoaAsyncSocket_TCP.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CocoaAsyncSocket_TCP/Pods-CocoaAsyncSocket_TCP.debug.xcconfig"; sourceTree = "<group>"; };
87+
B8565C901ECC67D300D53996 /* ChatRecordCover.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatRecordCover.h; sourceTree = "<group>"; };
88+
B8565C911ECC67D300D53996 /* ChatRecordCover.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatRecordCover.m; sourceTree = "<group>"; };
8689
B85F39BA1EC9C95100B2EA9E /* CocoaAsyncSocket_TCP.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CocoaAsyncSocket_TCP.app; sourceTree = BUILT_PRODUCTS_DIR; };
8790
B85F39BE1EC9C95100B2EA9E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
8891
B85F39C71EC9C95100B2EA9E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
@@ -216,6 +219,15 @@
216219
/* End PBXFrameworksBuildPhase section */
217220

218221
/* Begin PBXGroup section */
222+
B8565C8F1ECC67C300D53996 /* ChatRecordCover */ = {
223+
isa = PBXGroup;
224+
children = (
225+
B8565C901ECC67D300D53996 /* ChatRecordCover.h */,
226+
B8565C911ECC67D300D53996 /* ChatRecordCover.m */,
227+
);
228+
path = ChatRecordCover;
229+
sourceTree = "<group>";
230+
};
219231
B85F39B11EC9C95100B2EA9E = {
220232
isa = PBXGroup;
221233
children = (
@@ -464,6 +476,7 @@
464476
B85F3A661EC9C9DE00B2EA9E /* View */ = {
465477
isa = PBXGroup;
466478
children = (
479+
B8565C8F1ECC67C300D53996 /* ChatRecordCover */,
467480
B85F3A671EC9C9DE00B2EA9E /* ChatCells */,
468481
B85F3A741EC9C9DE00B2EA9E /* ChatListCell */,
469482
B85F3A781EC9C9DE00B2EA9E /* KeyBoard */,
@@ -744,6 +757,7 @@
744757
B85F3A631EC9C9C600B2EA9E /* LastViewController.m in Sources */,
745758
B85F3A831EC9C9DE00B2EA9E /* ChatKeyboard.m in Sources */,
746759
B85F3A651EC9C9C600B2EA9E /* ThirdViewController.m in Sources */,
760+
B8565C921ECC67D300D53996 /* ChatRecordCover.m in Sources */,
747761
B85F3A4C1EC9C9C600B2EA9E /* UIImageView+SDWebImage.m in Sources */,
748762
B85F3A641EC9C9C600B2EA9E /* MainViewController.m in Sources */,
749763
B85F3A8E1EC9C9E400B2EA9E /* ChatModel.m in Sources */,
@@ -1012,6 +1026,7 @@
10121026
B85F39E91EC9C95100B2EA9E /* Release */,
10131027
);
10141028
defaultConfigurationIsVisible = 0;
1029+
defaultConfigurationName = Release;
10151030
};
10161031
B85F39EA1EC9C95100B2EA9E /* Build configuration list for PBXNativeTarget "CocoaAsyncSocket_TCPTests" */ = {
10171032
isa = XCConfigurationList;
@@ -1020,6 +1035,7 @@
10201035
B85F39EC1EC9C95100B2EA9E /* Release */,
10211036
);
10221037
defaultConfigurationIsVisible = 0;
1038+
defaultConfigurationName = Release;
10231039
};
10241040
B85F39ED1EC9C95100B2EA9E /* Build configuration list for PBXNativeTarget "CocoaAsyncSocket_TCPUITests" */ = {
10251041
isa = XCConfigurationList;
@@ -1028,6 +1044,7 @@
10281044
B85F39EF1EC9C95100B2EA9E /* Release */,
10291045
);
10301046
defaultConfigurationIsVisible = 0;
1047+
defaultConfigurationName = Release;
10311048
};
10321049
/* End XCConfigurationList section */
10331050
};

CocoaAsyncSocket_TCP/Controller/ChatListViewController.m

+6-1
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,18 @@ - (void)sendMessageTimeOutWithTag:(long)tag
125125
- (void)getMessages
126126
{
127127
//暂时先模拟假数据 , 后面加上数据库结构,再修改
128+
NSArray *tips = @[@"项目里IM这块因为一直都是在摸索,所以特别乱..",@"这一份相当于是进行重构,分层,尽量减少耦合性",@"还有就是把注释和大体思路尽量写下来",@"UI部分很耗时,因为所有的东西都是自己写的",@"如果有兴趣可以fork一下,有空闲时间我就会更新一些",@"如果觉得有用,麻烦star一下噢...."];
128129
for (NSInteger index = 0; index < 30; index ++) {
129130

130131
ChatModel *chatModel = [[ChatModel alloc]init];
131132
ChatContentModel *chatContent = [[ChatContentModel alloc]init];
132133
chatModel.content = chatContent ;
133134
chatModel.nickName = @"孟遥";
134-
chatModel.lastMessage = @"模拟数据,UI部分持续更新中...涉及面较多,比较耗时";
135+
if (index<tips.count) {
136+
chatModel.lastMessage = tips[index];
137+
}else{
138+
chatModel.lastMessage = @"模拟数据,UI部分持续更新中...涉及面较多,比较耗时";
139+
}
135140
chatModel.noDisturb = index%3==0 ? @2 : @1;
136141
chatModel.unreadCount = @(index);
137142
chatModel.lastTimeString = [NSDate timeStringWithTimeInterval:chatModel.sendTime];

CocoaAsyncSocket_TCP/View/ChatListCell/ChatListCell.m

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ - (void)configContent
5050
_nameLabel.text = _chatModel.nickName;
5151
_timeLabel.text = _chatModel.lastTimeString;
5252
_lastMessageLabel.text = _chatModel.lastMessage;
53+
_lastMessageLabel.attributedText = [[NSAttributedString alloc]initWithString:_chatModel.lastMessage attributes:@{NSFontAttributeName:FontSet(13),NSForegroundColorAttributeName:[UIColor redColor]}];
5354
_unreadLabel.text = [_chatModel.unreadCount stringValue];
5455
_bellImageView.hidden = _chatModel.noDisturb.integerValue == 1;
5556
_tipLabel.hidden = _chatModel.noDisturb.integerValue == 1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// ChatRecordCover.h
3+
// CocoaAsyncSocket_TCP
4+
//
5+
// Created by 孟遥 on 2017/5/17.
6+
// Copyright © 2017年 mengyao. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface ChatRecordCover : UIView
12+
13+
//初始化录音蒙板
14+
+ (instancetype)chatRecordCover;
15+
//开始录音
16+
+ (void)beginRecord;
17+
//取消录音
18+
+ (void)cancelRecord;
19+
//录音结束
20+
+ (void)stopRecord;
21+
22+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//
2+
// ChatRecordCover.m
3+
// CocoaAsyncSocket_TCP
4+
//
5+
// Created by 孟遥 on 2017/5/17.
6+
// Copyright © 2017年 mengyao. All rights reserved.
7+
//
8+
9+
#import "ChatRecordCover.h"
10+
11+
@interface ChatRecordCover ()
12+
13+
@property (nonatomic, strong) dispatch_source_t recordTimer;
14+
15+
@end
16+
17+
@implementation ChatRecordCover
18+
19+
//初始化录音蒙板
20+
+ (instancetype)chatRecordCover
21+
{
22+
return [[self alloc]init];
23+
}
24+
25+
26+
//开始录音
27+
+ (void)beginRecord
28+
{
29+
30+
}
31+
32+
//取消录音
33+
+ (void)cancelRecord
34+
{
35+
36+
}
37+
38+
//录音结束
39+
+ (void)stopRecord
40+
{
41+
42+
}
43+
44+
45+
46+
47+
- (instancetype)init
48+
{
49+
if (self = [super init]) {
50+
51+
}
52+
return self;
53+
}
54+
55+
- (void)dealloc
56+
{
57+
dispatch_source_cancel(_recordTimer);
58+
}
59+
60+
61+
@end

0 commit comments

Comments
 (0)