添加了平滑的下啦加载

This commit is contained in:
wu736139669
2015-01-19 21:18:54 +08:00
parent 5c97ecc8f3
commit a1f5959544
40 changed files with 1142 additions and 10 deletions
@@ -15,6 +15,31 @@
A97429BB1A68C81C00732735 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = A97429B91A68C81C00732735 /* LaunchScreen.xib */; }; A97429BB1A68C81C00732735 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = A97429B91A68C81C00732735 /* LaunchScreen.xib */; };
A97429C71A68C81C00732735 /* ASHMessageTableViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A97429C61A68C81C00732735 /* ASHMessageTableViewDemoTests.m */; }; A97429C71A68C81C00732735 /* ASHMessageTableViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A97429C61A68C81C00732735 /* ASHMessageTableViewDemoTests.m */; };
A9B965551A6D307B0017F9F2 /* MessageTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B965541A6D307B0017F9F2 /* MessageTableView.m */; }; A9B965551A6D307B0017F9F2 /* MessageTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B965541A6D307B0017F9F2 /* MessageTableView.m */; };
A9B965A61A6D35300017F9F2 /* NSString+DocumentPath.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B965961A6D35300017F9F2 /* NSString+DocumentPath.m */; };
A9B965A71A6D35300017F9F2 /* UIImage+StrethImage.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B965981A6D35300017F9F2 /* UIImage+StrethImage.m */; };
A9B965A81A6D35300017F9F2 /* ChartCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9659B1A6D35300017F9F2 /* ChartCell.m */; };
A9B965A91A6D35300017F9F2 /* ChartCellFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9659D1A6D35300017F9F2 /* ChartCellFrame.m */; };
A9B965AA1A6D35300017F9F2 /* ChartMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B965A01A6D35300017F9F2 /* ChartMessage.m */; };
A9B965AB1A6D35300017F9F2 /* ChartContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B965A31A6D35300017F9F2 /* ChartContentView.m */; };
A9B965AC1A6D35300017F9F2 /* KeyBordVIew.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B965A51A6D35300017F9F2 /* KeyBordVIew.m */; };
A9B965C01A6D35820017F9F2 /* chat_bg_default.jpg in Resources */ = {isa = PBXBuildFile; fileRef = A9B965AE1A6D35820017F9F2 /* chat_bg_default.jpg */; };
A9B965C11A6D35820017F9F2 /* chat_bottom_keyboard_nor.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965AF1A6D35820017F9F2 /* chat_bottom_keyboard_nor.png */; };
A9B965C21A6D35820017F9F2 /* chat_bottom_keyboard_press.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965B01A6D35820017F9F2 /* chat_bottom_keyboard_press.png */; };
A9B965C31A6D35820017F9F2 /* chat_bottom_smile_nor.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965B11A6D35820017F9F2 /* chat_bottom_smile_nor.png */; };
A9B965C41A6D35820017F9F2 /* chat_bottom_smile_press.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965B21A6D35820017F9F2 /* chat_bottom_smile_press.png */; };
A9B965C51A6D35820017F9F2 /* chat_bottom_textfield.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965B31A6D35820017F9F2 /* chat_bottom_textfield.png */; };
A9B965C61A6D35820017F9F2 /* chat_bottom_up_nor.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965B41A6D35820017F9F2 /* chat_bottom_up_nor.png */; };
A9B965C71A6D35820017F9F2 /* chat_bottom_up_press.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965B51A6D35820017F9F2 /* chat_bottom_up_press.png */; };
A9B965C81A6D35820017F9F2 /* chat_bottom_voice_nor.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965B61A6D35820017F9F2 /* chat_bottom_voice_nor.png */; };
A9B965C91A6D35820017F9F2 /* chat_bottom_voice_press.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965B71A6D35820017F9F2 /* chat_bottom_voice_press.png */; };
A9B965CA1A6D35820017F9F2 /* chatfrom_bg_focused.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965B81A6D35820017F9F2 /* chatfrom_bg_focused.png */; };
A9B965CB1A6D35820017F9F2 /* chatfrom_bg_normal.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965B91A6D35820017F9F2 /* chatfrom_bg_normal.png */; };
A9B965CC1A6D35820017F9F2 /* chatto_bg_focused.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965BA1A6D35820017F9F2 /* chatto_bg_focused.png */; };
A9B965CD1A6D35820017F9F2 /* chatto_bg_normal.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965BB1A6D35820017F9F2 /* chatto_bg_normal.png */; };
A9B965CE1A6D35820017F9F2 /* icon01.jpg in Resources */ = {isa = PBXBuildFile; fileRef = A9B965BC1A6D35820017F9F2 /* icon01.jpg */; };
A9B965CF1A6D35820017F9F2 /* icon02.jpg in Resources */ = {isa = PBXBuildFile; fileRef = A9B965BD1A6D35820017F9F2 /* icon02.jpg */; };
A9B965D01A6D35820017F9F2 /* toolbar_bottom_bar.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B965BE1A6D35820017F9F2 /* toolbar_bottom_bar.png */; };
A9B965D11A6D35820017F9F2 /* messages.plist in Resources */ = {isa = PBXBuildFile; fileRef = A9B965BF1A6D35820017F9F2 /* messages.plist */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
@@ -43,6 +68,39 @@
A97429C61A68C81C00732735 /* ASHMessageTableViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ASHMessageTableViewDemoTests.m; sourceTree = "<group>"; }; A97429C61A68C81C00732735 /* ASHMessageTableViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ASHMessageTableViewDemoTests.m; sourceTree = "<group>"; };
A9B965531A6D307B0017F9F2 /* MessageTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageTableView.h; sourceTree = "<group>"; }; A9B965531A6D307B0017F9F2 /* MessageTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageTableView.h; sourceTree = "<group>"; };
A9B965541A6D307B0017F9F2 /* MessageTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageTableView.m; sourceTree = "<group>"; }; A9B965541A6D307B0017F9F2 /* MessageTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageTableView.m; sourceTree = "<group>"; };
A9B965951A6D35300017F9F2 /* NSString+DocumentPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+DocumentPath.h"; sourceTree = "<group>"; };
A9B965961A6D35300017F9F2 /* NSString+DocumentPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+DocumentPath.m"; sourceTree = "<group>"; };
A9B965971A6D35300017F9F2 /* UIImage+StrethImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+StrethImage.h"; sourceTree = "<group>"; };
A9B965981A6D35300017F9F2 /* UIImage+StrethImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+StrethImage.m"; sourceTree = "<group>"; };
A9B9659A1A6D35300017F9F2 /* ChartCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChartCell.h; sourceTree = "<group>"; };
A9B9659B1A6D35300017F9F2 /* ChartCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChartCell.m; sourceTree = "<group>"; };
A9B9659C1A6D35300017F9F2 /* ChartCellFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChartCellFrame.h; sourceTree = "<group>"; };
A9B9659D1A6D35300017F9F2 /* ChartCellFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChartCellFrame.m; sourceTree = "<group>"; };
A9B9659F1A6D35300017F9F2 /* ChartMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChartMessage.h; sourceTree = "<group>"; };
A9B965A01A6D35300017F9F2 /* ChartMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChartMessage.m; sourceTree = "<group>"; };
A9B965A21A6D35300017F9F2 /* ChartContentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChartContentView.h; sourceTree = "<group>"; };
A9B965A31A6D35300017F9F2 /* ChartContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChartContentView.m; sourceTree = "<group>"; };
A9B965A41A6D35300017F9F2 /* KeyBordVIew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyBordVIew.h; sourceTree = "<group>"; };
A9B965A51A6D35300017F9F2 /* KeyBordVIew.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KeyBordVIew.m; sourceTree = "<group>"; };
A9B965AE1A6D35820017F9F2 /* chat_bg_default.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = chat_bg_default.jpg; sourceTree = "<group>"; };
A9B965AF1A6D35820017F9F2 /* chat_bottom_keyboard_nor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_bottom_keyboard_nor.png; sourceTree = "<group>"; };
A9B965B01A6D35820017F9F2 /* chat_bottom_keyboard_press.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_bottom_keyboard_press.png; sourceTree = "<group>"; };
A9B965B11A6D35820017F9F2 /* chat_bottom_smile_nor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_bottom_smile_nor.png; sourceTree = "<group>"; };
A9B965B21A6D35820017F9F2 /* chat_bottom_smile_press.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_bottom_smile_press.png; sourceTree = "<group>"; };
A9B965B31A6D35820017F9F2 /* chat_bottom_textfield.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_bottom_textfield.png; sourceTree = "<group>"; };
A9B965B41A6D35820017F9F2 /* chat_bottom_up_nor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_bottom_up_nor.png; sourceTree = "<group>"; };
A9B965B51A6D35820017F9F2 /* chat_bottom_up_press.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_bottom_up_press.png; sourceTree = "<group>"; };
A9B965B61A6D35820017F9F2 /* chat_bottom_voice_nor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_bottom_voice_nor.png; sourceTree = "<group>"; };
A9B965B71A6D35820017F9F2 /* chat_bottom_voice_press.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_bottom_voice_press.png; sourceTree = "<group>"; };
A9B965B81A6D35820017F9F2 /* chatfrom_bg_focused.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chatfrom_bg_focused.png; sourceTree = "<group>"; };
A9B965B91A6D35820017F9F2 /* chatfrom_bg_normal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chatfrom_bg_normal.png; sourceTree = "<group>"; };
A9B965BA1A6D35820017F9F2 /* chatto_bg_focused.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chatto_bg_focused.png; sourceTree = "<group>"; };
A9B965BB1A6D35820017F9F2 /* chatto_bg_normal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chatto_bg_normal.png; sourceTree = "<group>"; };
A9B965BC1A6D35820017F9F2 /* icon01.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = icon01.jpg; sourceTree = "<group>"; };
A9B965BD1A6D35820017F9F2 /* icon02.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = icon02.jpg; sourceTree = "<group>"; };
A9B965BE1A6D35820017F9F2 /* toolbar_bottom_bar.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = toolbar_bottom_bar.png; sourceTree = "<group>"; };
A9B965BF1A6D35820017F9F2 /* messages.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = messages.plist; sourceTree = "<group>"; };
A9B965D21A6D358B0017F9F2 /* ASHMessageTableViewDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ASHMessageTableViewDemo-Prefix.pch"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@@ -84,6 +142,10 @@
A97429A91A68C81C00732735 /* ASHMessageTableViewDemo */ = { A97429A91A68C81C00732735 /* ASHMessageTableViewDemo */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A9B965941A6D35300017F9F2 /* category */,
A9B965991A6D35300017F9F2 /* cell */,
A9B9659E1A6D35300017F9F2 /* model */,
A9B965A11A6D35300017F9F2 /* view */,
A97429AE1A68C81C00732735 /* AppDelegate.h */, A97429AE1A68C81C00732735 /* AppDelegate.h */,
A97429AF1A68C81C00732735 /* AppDelegate.m */, A97429AF1A68C81C00732735 /* AppDelegate.m */,
A97429B11A68C81C00732735 /* ViewController.h */, A97429B11A68C81C00732735 /* ViewController.h */,
@@ -101,6 +163,9 @@
A97429AA1A68C81C00732735 /* Supporting Files */ = { A97429AA1A68C81C00732735 /* Supporting Files */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A9B965D21A6D358B0017F9F2 /* ASHMessageTableViewDemo-Prefix.pch */,
A9B965AD1A6D35820017F9F2 /* images */,
A9B965BF1A6D35820017F9F2 /* messages.plist */,
A97429AB1A68C81C00732735 /* Info.plist */, A97429AB1A68C81C00732735 /* Info.plist */,
A97429AC1A68C81C00732735 /* main.m */, A97429AC1A68C81C00732735 /* main.m */,
); );
@@ -124,6 +189,72 @@
name = "Supporting Files"; name = "Supporting Files";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
A9B965941A6D35300017F9F2 /* category */ = {
isa = PBXGroup;
children = (
A9B965951A6D35300017F9F2 /* NSString+DocumentPath.h */,
A9B965961A6D35300017F9F2 /* NSString+DocumentPath.m */,
A9B965971A6D35300017F9F2 /* UIImage+StrethImage.h */,
A9B965981A6D35300017F9F2 /* UIImage+StrethImage.m */,
);
path = category;
sourceTree = "<group>";
};
A9B965991A6D35300017F9F2 /* cell */ = {
isa = PBXGroup;
children = (
A9B9659A1A6D35300017F9F2 /* ChartCell.h */,
A9B9659B1A6D35300017F9F2 /* ChartCell.m */,
A9B9659C1A6D35300017F9F2 /* ChartCellFrame.h */,
A9B9659D1A6D35300017F9F2 /* ChartCellFrame.m */,
);
path = cell;
sourceTree = "<group>";
};
A9B9659E1A6D35300017F9F2 /* model */ = {
isa = PBXGroup;
children = (
A9B9659F1A6D35300017F9F2 /* ChartMessage.h */,
A9B965A01A6D35300017F9F2 /* ChartMessage.m */,
);
path = model;
sourceTree = "<group>";
};
A9B965A11A6D35300017F9F2 /* view */ = {
isa = PBXGroup;
children = (
A9B965A21A6D35300017F9F2 /* ChartContentView.h */,
A9B965A31A6D35300017F9F2 /* ChartContentView.m */,
A9B965A41A6D35300017F9F2 /* KeyBordVIew.h */,
A9B965A51A6D35300017F9F2 /* KeyBordVIew.m */,
);
path = view;
sourceTree = "<group>";
};
A9B965AD1A6D35820017F9F2 /* images */ = {
isa = PBXGroup;
children = (
A9B965AE1A6D35820017F9F2 /* chat_bg_default.jpg */,
A9B965AF1A6D35820017F9F2 /* chat_bottom_keyboard_nor.png */,
A9B965B01A6D35820017F9F2 /* chat_bottom_keyboard_press.png */,
A9B965B11A6D35820017F9F2 /* chat_bottom_smile_nor.png */,
A9B965B21A6D35820017F9F2 /* chat_bottom_smile_press.png */,
A9B965B31A6D35820017F9F2 /* chat_bottom_textfield.png */,
A9B965B41A6D35820017F9F2 /* chat_bottom_up_nor.png */,
A9B965B51A6D35820017F9F2 /* chat_bottom_up_press.png */,
A9B965B61A6D35820017F9F2 /* chat_bottom_voice_nor.png */,
A9B965B71A6D35820017F9F2 /* chat_bottom_voice_press.png */,
A9B965B81A6D35820017F9F2 /* chatfrom_bg_focused.png */,
A9B965B91A6D35820017F9F2 /* chatfrom_bg_normal.png */,
A9B965BA1A6D35820017F9F2 /* chatto_bg_focused.png */,
A9B965BB1A6D35820017F9F2 /* chatto_bg_normal.png */,
A9B965BC1A6D35820017F9F2 /* icon01.jpg */,
A9B965BD1A6D35820017F9F2 /* icon02.jpg */,
A9B965BE1A6D35820017F9F2 /* toolbar_bottom_bar.png */,
);
path = images;
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
@@ -206,7 +337,25 @@
files = ( files = (
A97429B61A68C81C00732735 /* Main.storyboard in Resources */, A97429B61A68C81C00732735 /* Main.storyboard in Resources */,
A97429BB1A68C81C00732735 /* LaunchScreen.xib in Resources */, A97429BB1A68C81C00732735 /* LaunchScreen.xib in Resources */,
A9B965CF1A6D35820017F9F2 /* icon02.jpg in Resources */,
A9B965CB1A6D35820017F9F2 /* chatfrom_bg_normal.png in Resources */,
A9B965D01A6D35820017F9F2 /* toolbar_bottom_bar.png in Resources */,
A9B965C51A6D35820017F9F2 /* chat_bottom_textfield.png in Resources */,
A9B965C81A6D35820017F9F2 /* chat_bottom_voice_nor.png in Resources */,
A9B965CA1A6D35820017F9F2 /* chatfrom_bg_focused.png in Resources */,
A9B965C61A6D35820017F9F2 /* chat_bottom_up_nor.png in Resources */,
A9B965C01A6D35820017F9F2 /* chat_bg_default.jpg in Resources */,
A9B965C21A6D35820017F9F2 /* chat_bottom_keyboard_press.png in Resources */,
A9B965D11A6D35820017F9F2 /* messages.plist in Resources */,
A97429B81A68C81C00732735 /* Images.xcassets in Resources */, A97429B81A68C81C00732735 /* Images.xcassets in Resources */,
A9B965C91A6D35820017F9F2 /* chat_bottom_voice_press.png in Resources */,
A9B965CD1A6D35820017F9F2 /* chatto_bg_normal.png in Resources */,
A9B965CC1A6D35820017F9F2 /* chatto_bg_focused.png in Resources */,
A9B965CE1A6D35820017F9F2 /* icon01.jpg in Resources */,
A9B965C31A6D35820017F9F2 /* chat_bottom_smile_nor.png in Resources */,
A9B965C11A6D35820017F9F2 /* chat_bottom_keyboard_nor.png in Resources */,
A9B965C71A6D35820017F9F2 /* chat_bottom_up_press.png in Resources */,
A9B965C41A6D35820017F9F2 /* chat_bottom_smile_press.png in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -224,10 +373,17 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
A9B965A91A6D35300017F9F2 /* ChartCellFrame.m in Sources */,
A9B965A61A6D35300017F9F2 /* NSString+DocumentPath.m in Sources */,
A9B965AC1A6D35300017F9F2 /* KeyBordVIew.m in Sources */,
A97429B31A68C81C00732735 /* ViewController.m in Sources */, A97429B31A68C81C00732735 /* ViewController.m in Sources */,
A9B965551A6D307B0017F9F2 /* MessageTableView.m in Sources */, A9B965551A6D307B0017F9F2 /* MessageTableView.m in Sources */,
A97429B01A68C81C00732735 /* AppDelegate.m in Sources */, A97429B01A68C81C00732735 /* AppDelegate.m in Sources */,
A9B965A81A6D35300017F9F2 /* ChartCell.m in Sources */,
A9B965AA1A6D35300017F9F2 /* ChartMessage.m in Sources */,
A9B965AB1A6D35300017F9F2 /* ChartContentView.m in Sources */,
A97429AD1A68C81C00732735 /* main.m in Sources */, A97429AD1A68C81C00732735 /* main.m in Sources */,
A9B965A71A6D35300017F9F2 /* UIImage+StrethImage.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -349,6 +505,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
GCC_PREFIX_HEADER = "ASHMessageTableViewDemo/ASHMessageTableViewDemo-Prefix.pch";
INFOPLIST_FILE = ASHMessageTableViewDemo/Info.plist; INFOPLIST_FILE = ASHMessageTableViewDemo/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@@ -359,6 +516,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
GCC_PREFIX_HEADER = "ASHMessageTableViewDemo/ASHMessageTableViewDemo-Prefix.pch";
INFOPLIST_FILE = ASHMessageTableViewDemo/Info.plist; INFOPLIST_FILE = ASHMessageTableViewDemo/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@@ -0,0 +1,18 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "UIImage+StrethImage.h"
#import "NSString+DocumentPath.h"
#endif
+5 -1
View File
@@ -7,7 +7,7 @@
// //
#import "AppDelegate.h" #import "AppDelegate.h"
#import "ViewController.h"
@interface AppDelegate () @interface AppDelegate ()
@end @end
@@ -17,6 +17,10 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch. // Override point for customization after application launch.
self.window=[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
UINavigationController *nav=[[[UINavigationController alloc]initWithRootViewController:[ViewController alloc]]init];
self.window.rootViewController=nav;
[self.window makeKeyAndVisible];
return YES; return YES;
} }
+297 -9
View File
@@ -7,21 +7,309 @@
// //
#import "ViewController.h" #import "ViewController.h"
#import "ChartMessage.h"
@interface ViewController () #import "ChartCellFrame.h"
#import "ChartCell.h"
#import "KeyBordVIew.h"
#import <AudioToolbox/AudioToolbox.h>
#import <AVFoundation/AVFoundation.h>
#import "MessageTableView.h"
@interface ViewController ()<UITableViewDataSource,UITableViewDelegate,KeyBordVIewDelegate,ChartCellDelegate,AVAudioPlayerDelegate>
@property (nonatomic,strong) MessageTableView *tableView;
@property (nonatomic,strong) KeyBordVIew *keyBordView;
@property (nonatomic,strong) NSMutableArray *cellFrames;
@property (nonatomic,assign) BOOL recording;
@property (nonatomic,strong) NSString *fileName;
@property (nonatomic,strong) AVAudioRecorder *recorder;
@property (nonatomic,strong) AVAudioPlayer *player;
@end @end
static NSString *const cellIdentifier=@"QQChart";
@implementation ViewController @implementation ViewController
{
- (void)viewDidLoad { UIActivityIndicatorView* _activity;
[super viewDidLoad]; BOOL _isRefresh;
// Do any additional setup after loading the view, typically from a nib. UIView* _headView;
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardHide:) name:UIKeyboardWillHideNotification object:nil];
} }
- (void)didReceiveMemoryWarning { -(void)keyboardShow:(NSNotification *)note
{
CGRect keyBoardRect=[note.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGFloat deltaY=keyBoardRect.size.height;
[UIView animateWithDuration:[note.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue] animations:^{
self.view.transform=CGAffineTransformMakeTranslation(0, -deltaY);
}];
}
-(void)keyboardHide:(NSNotification *)note
{
[UIView animateWithDuration:[note.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue] animations:^{
self.view.transform = CGAffineTransformIdentity;
}];
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.title=@"QQ chat";
self.view.backgroundColor=[UIColor whiteColor];
//add UItableView
self.tableView=[[MessageTableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-108) style:UITableViewStylePlain];
[self.tableView registerClass:[ChartCell class] forCellReuseIdentifier:cellIdentifier];
self.tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
self.tableView.allowsSelection = NO;
self.tableView.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"chat_bg_default.jpg"]];
self.tableView.dataSource=self;
self.tableView.delegate=self;
[self.view addSubview:self.tableView];
//add keyBorad
self.keyBordView=[[KeyBordVIew alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height-108, self.view.frame.size.width, 44)];
self.keyBordView.delegate=self;
[self.view addSubview:self.keyBordView];
//初始化数据
// [self.tableView addHeaderWithTarget:self action:@selector(headerRereshing)];
// [self.tableView addFooterWithTarget:self action:@selector(footerRereshing)];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(testTableView)];
[self initwithData];
_headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40)];
_headView.backgroundColor = [UIColor clearColor];
_activity = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
[_headView addSubview:_activity];
_activity.frame = CGRectMake(_headView.frame.size.width/2, _headView.frame.size.height/2, 20, 20);
_tableView.tableHeaderView = _headView;
_headView.hidden = YES;
}
-(void)testTableView
{
//等待2s
_headView.hidden = NO;
[_activity startAnimating];
_isRefresh = YES;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSString *path=[[NSBundle mainBundle] pathForResource:@"messages" ofType:@"plist"];
NSArray *data=[NSArray arrayWithContentsOfFile:path];
int i = 0;
for(NSDictionary *dict in data){
if (i>=5) {
break;
}
i++;
ChartCellFrame *cellFrame=[[ChartCellFrame alloc]init];
ChartMessage *chartMessage=[[ChartMessage alloc]init];
chartMessage.dict=dict;
cellFrame.chartMessage=chartMessage;
[self.cellFrames insertObject:cellFrame atIndex:0];
}
[_tableView reloadData];
[_activity stopAnimating];
_headView.hidden = YES;
_isRefresh = NO;
});
}
-(void)initwithData
{
self.cellFrames=[NSMutableArray array];
NSString *path=[[NSBundle mainBundle] pathForResource:@"messages" ofType:@"plist"];
NSArray *data=[NSArray arrayWithContentsOfFile:path];
for(NSDictionary *dict in data){
ChartCellFrame *cellFrame=[[ChartCellFrame alloc]init];
ChartMessage *chartMessage=[[ChartMessage alloc]init];
chartMessage.dict=dict;
cellFrame.chartMessage=chartMessage;
[self.cellFrames addObject:cellFrame];
}
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (scrollView.contentOffset.y<=0 && _isRefresh==NO)
{
[self testTableView];
}
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSLog(@"%ld",_cellFrames.count);
return _cellFrames.count;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
ChartCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
cell.delegate=self;
cell.cellFrame=self.cellFrames[indexPath.row];
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return [self.cellFrames[indexPath.row] cellHeight];
}
-(void)chartCell:(ChartCell *)chartCell tapContent:(NSString *)content
{
if(self.player.isPlaying){
[self.player stop];
}
//播放
NSString *filePath=[NSString documentPathWith:content];
NSURL *fileUrl=[NSURL fileURLWithPath:filePath];
[self initPlayer];
NSError *error;
self.player=[[AVAudioPlayer alloc]initWithContentsOfURL:fileUrl error:&error];
[self.player setVolume:1];
[self.player prepareToPlay];
[self.player setDelegate:self];
[self.player play];
[[UIDevice currentDevice] setProximityMonitoringEnabled:YES];
}
-(void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
{
[[UIDevice currentDevice]setProximityMonitoringEnabled:NO];
[self.player stop];
self.player=nil;
}
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
[self.view endEditing:YES];
}
-(void)KeyBordView:(KeyBordVIew *)keyBoardView textFiledReturn:(UITextField *)textFiled
{
ChartCellFrame *cellFrame=[[ChartCellFrame alloc]init];
ChartMessage *chartMessage=[[ChartMessage alloc]init];
int random=arc4random_uniform(2);
NSLog(@"%d",random);
chartMessage.icon=[NSString stringWithFormat:@"icon%02d.jpg",random+1];
chartMessage.messageType=random;
chartMessage.content=textFiled.text;
cellFrame.chartMessage=chartMessage;
[self.cellFrames addObject:cellFrame];
[self.tableView reloadData];
//滚动到当前行
[self tableViewScrollCurrentIndexPath];
textFiled.text=@"";
}
-(void)KeyBordView:(KeyBordVIew *)keyBoardView textFiledBegin:(UITextField *)textFiled
{
[self tableViewScrollCurrentIndexPath];
}
-(void)beginRecord
{
if(self.recording)return;
self.recording=YES;
NSDictionary *settings=[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:8000],AVSampleRateKey,
[NSNumber numberWithInt:kAudioFormatLinearPCM],AVFormatIDKey,
[NSNumber numberWithInt:1],AVNumberOfChannelsKey,
[NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,
[NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,
[NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,
nil];
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecord error: nil];
[[AVAudioSession sharedInstance] setActive:YES error:nil];
NSDate *now = [NSDate date];
NSDateFormatter *dateFormater = [[NSDateFormatter alloc] init];
[dateFormater setDateFormat:@"yyyyMMddHHmmss"];
NSString *fileName = [NSString stringWithFormat:@"rec_%@.wav",[dateFormater stringFromDate:now]];
self.fileName=fileName;
NSString *filePath=[NSString documentPathWith:fileName];
NSURL *fileUrl=[NSURL fileURLWithPath:filePath];
NSError *error;
self.recorder=[[AVAudioRecorder alloc]initWithURL:fileUrl settings:settings error:&error];
[self.recorder prepareToRecord];
[self.recorder setMeteringEnabled:YES];
[self.recorder peakPowerForChannel:0];
[self.recorder record];
}
-(void)finishRecord
{
self.recording=NO;
[self.recorder stop];
self.recorder=nil;
ChartCellFrame *cellFrame=[[ChartCellFrame alloc]init];
ChartMessage *chartMessage=[[ChartMessage alloc]init];
int random=arc4random_uniform(2);
NSLog(@"%d",random);
chartMessage.icon=[NSString stringWithFormat:@"icon%02d.jpg",random+1];
chartMessage.messageType=random;
chartMessage.content=self.fileName;
cellFrame.chartMessage=chartMessage;
[self.cellFrames addObject:cellFrame];
[self.tableView reloadData];
[self tableViewScrollCurrentIndexPath];
}
-(void)tableViewScrollCurrentIndexPath
{
NSIndexPath *indexPath=[NSIndexPath indexPathForRow:self.cellFrames.count-1 inSection:0];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
}
-(void)initPlayer{
//初始化播放器的时候如下设置
UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory,
sizeof(sessionCategory),
&sessionCategory);
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,
sizeof (audioRouteOverride),
&audioRouteOverride);
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
//默认情况下扬声器播放
[audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
[audioSession setActive:YES error:nil];
audioSession = nil;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
} }
@end @end
@@ -0,0 +1,13 @@
//
// NSString+DocumentPath.h
// 气泡
//
// Created by zzy on 14-5-15.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSString (DocumentPath)
+(NSString *)documentPathWith:(NSString *)fileName;
@end
@@ -0,0 +1,17 @@
//
// NSString+DocumentPath.m
// 气泡
//
// Created by zzy on 14-5-15.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#import "NSString+DocumentPath.h"
@implementation NSString (DocumentPath)
+(NSString *)documentPathWith:(NSString *)fileName
{
return [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",fileName]];
}
@end
@@ -0,0 +1,14 @@
//
// UIImage+StrethImage.h
// 气泡
//
// Created by zzy on 14-5-13.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (StrethImage)
+(id)strethImageWith:(NSString *)imageName;
@end
@@ -0,0 +1,21 @@
//
// UIImage+StrethImage.m
// 气泡
//
// Created by zzy on 14-5-13.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#import "UIImage+StrethImage.h"
@implementation UIImage (StrethImage)
+(id)strethImageWith:(NSString *)imageName
{
UIImage *image=[UIImage imageNamed:imageName];
image=[image stretchableImageWithLeftCapWidth:image.size.width*0.5 topCapHeight:image.size.height*0.5];
return image;
}
@end
Binary file not shown.
+22
View File
@@ -0,0 +1,22 @@
//
// ChartCell.h
// 气泡
//
// Created by zzy on 14-5-13.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#import <UIKit/UIKit.h>
@class ChartCell;
@protocol ChartCellDelegate <NSObject>
-(void)chartCell:(ChartCell *)chartCell tapContent:(NSString *)content;
@end
#import "ChartCellFrame.h"
@interface ChartCell : UITableViewCell
@property (nonatomic,strong) ChartCellFrame *cellFrame;
@property (nonatomic,assign) id<ChartCellDelegate> delegate;
@end
+117
View File
@@ -0,0 +1,117 @@
//
// ChartCell.m
// 气泡
//
// Created by zzy on 14-5-13.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#import "ChartCell.h"
#import "ChartContentView.h"
@interface ChartCell()<ChartContentViewDelegate>
@property (nonatomic,strong) UIImageView *icon;
@property (nonatomic,strong) ChartContentView *chartView;
@property (nonatomic,strong) ChartContentView *currentChartView;
@property (nonatomic,strong) NSString *contentStr;
@end
@implementation ChartCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.backgroundColor = [UIColor clearColor];
self.icon=[[UIImageView alloc]init];
[self.contentView addSubview:self.icon];
self.chartView =[[ChartContentView alloc]initWithFrame:CGRectZero];
self.chartView.delegate=self;
[self.contentView addSubview:self.chartView];
}
return self;
}
-(void)setCellFrame:(ChartCellFrame *)cellFrame
{
_cellFrame=cellFrame;
ChartMessage *chartMessage=cellFrame.chartMessage;
self.icon.frame=cellFrame.iconRect;
self.icon.image=[UIImage imageNamed:chartMessage.icon];
self.chartView.chartMessage=chartMessage;
self.chartView.frame=cellFrame.chartViewRect;
[self setBackGroundImageViewImage:self.chartView from:@"chatfrom_bg_normal.png" to:@"chatto_bg_normal.png"];
self.chartView.contentLabel.text=chartMessage.content;
}
-(void)setBackGroundImageViewImage:(ChartContentView *)chartView from:(NSString *)from to:(NSString *)to
{
UIImage *normal=nil ;
if(chartView.chartMessage.messageType==kMessageFrom){
normal = [UIImage imageNamed:from];
normal = [normal stretchableImageWithLeftCapWidth:normal.size.width * 0.5 topCapHeight:normal.size.height * 0.7];
}else if(chartView.chartMessage.messageType==kMessageTo){
normal = [UIImage imageNamed:to];
normal = [normal stretchableImageWithLeftCapWidth:normal.size.width * 0.5 topCapHeight:normal.size.height * 0.7];
}
chartView.backImageView.image=normal;
}
-(void)chartContentViewLongPress:(ChartContentView *)chartView content:(NSString *)content
{
[self becomeFirstResponder];
UIMenuController *menu=[UIMenuController sharedMenuController];
[menu setTargetRect:self.bounds inView:self];
[menu setMenuVisible:YES animated:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(menuShow:) name:UIMenuControllerWillShowMenuNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(menuHide:) name:UIMenuControllerWillHideMenuNotification object:nil];
self.contentStr=content;
self.currentChartView=chartView;
}
-(void)chartContentViewTapPress:(ChartContentView *)chartView content:(NSString *)content
{
if([self.delegate respondsToSelector:@selector(chartCell:tapContent:)]){
[self.delegate chartCell:self tapContent:content];
}
}
-(void)menuShow:(UIMenuController *)menu
{
[self setBackGroundImageViewImage:self.currentChartView from:@"chatfrom_bg_focused.png" to:@"chatto_bg_focused.png"];
}
-(void)menuHide:(UIMenuController *)menu
{
[self setBackGroundImageViewImage:self.currentChartView from:@"chatfrom_bg_normal.png" to:@"chatto_bg_normal.png"];
self.currentChartView=nil;
[self resignFirstResponder];
}
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if(action ==@selector(copy:)){
return YES;
}
return [super canPerformAction:action withSender:sender];
}
-(void)copy:(id)sender
{
[[UIPasteboard generalPasteboard]setString:self.contentStr];
}
-(BOOL)canBecomeFirstResponder
{
return YES;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,16 @@
//
// ChartCellFrame.h
// 气泡
//
// Created by zzy on 14-5-13.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ChartMessage.h"
@interface ChartCellFrame : NSObject
@property (nonatomic,assign) CGRect iconRect;
@property (nonatomic,assign) CGRect chartViewRect;
@property (nonatomic,strong) ChartMessage *chartMessage;
@property (nonatomic, assign) CGFloat cellHeight; //cell高度
@end
@@ -0,0 +1,45 @@
//
// ChartCellFrame.m
// 气泡
//
// Created by zzy on 14-5-13.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#define kIconMarginX 5
#define kIconMarginY 5
#import "ChartCellFrame.h"
@implementation ChartCellFrame
-(void)setChartMessage:(ChartMessage *)chartMessage
{
_chartMessage=chartMessage;
CGSize winSize=[UIScreen mainScreen].bounds.size;
CGFloat iconX=kIconMarginX;
CGFloat iconY=kIconMarginY;
CGFloat iconWidth=40;
CGFloat iconHeight=40;
if(chartMessage.messageType==kMessageFrom){
}else if (chartMessage.messageType==kMessageTo){
iconX=winSize.width-kIconMarginX-iconWidth;
}
self.iconRect=CGRectMake(iconX, iconY, iconWidth, iconHeight);
CGFloat contentX=CGRectGetMaxX(self.iconRect)+kIconMarginX;
CGFloat contentY=iconY;
NSDictionary *attributes = @{NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue" size:13]};
CGSize contentSize=[chartMessage.content boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options: NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:attributes context:nil].size;
if(chartMessage.messageType==kMessageTo){
contentX=iconX-kIconMarginX-contentSize.width-iconWidth;
}
self.chartViewRect=CGRectMake(contentX, contentY, contentSize.width+35, contentSize.height+30);
self.cellHeight=MAX(CGRectGetMaxY(self.iconRect), CGRectGetMaxY(self.chartViewRect))+kIconMarginX;
}
@end
Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

+96
View File
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>content</key>
<string>喂,2B</string>
<key>icon</key>
<string>icon01.jpg</string>
<key>time</key>
<string>前天 10:25</string>
<key>type</key>
<integer>0</integer>
</dict>
<dict>
<key>content</key>
<string>问你个严肃的事</string>
<key>icon</key>
<string>icon01.jpg</string>
<key>time</key>
<string>前天 10:25</string>
<key>type</key>
<integer>0</integer>
</dict>
<dict>
<key>content</key>
<string>你妹夫啊,你才2B!说,什么事?</string>
<key>icon</key>
<string>icon02.jpg</string>
<key>time</key>
<string>昨天 20:05</string>
<key>type</key>
<integer>1</integer>
</dict>
<dict>
<key>content</key>
<string>你姐夫啊,我就想问下:你是不是我最好的朋友?</string>
<key>icon</key>
<string>icon01.jpg</string>
<key>time</key>
<string>昨天 20:07</string>
<key>type</key>
<integer>0</integer>
</dict>
<dict>
<key>content</key>
<string>不借</string>
<key>icon</key>
<string>icon02.jpg</string>
<key>time</key>
<string>昨天 20:07</string>
<key>type</key>
<integer>1</integer>
</dict>
<dict>
<key>content</key>
<string>借你妹夫啊,哥又不穷,不是找你借钱。你就回答“是”或者“不是”。</string>
<key>icon</key>
<string>icon01.jpg</string>
<key>time</key>
<string>昨天 20:07</string>
<key>type</key>
<integer>0</integer>
</dict>
<dict>
<key>content</key>
<string>是</string>
<key>icon</key>
<string>icon02.jpg</string>
<key>time</key>
<string>昨天 20:11</string>
<key>type</key>
<integer>1</integer>
</dict>
<dict>
<key>content</key>
<string>刚才看了部非常感人的电视剧,电视上说狗才是人类最好的朋友,所以我想确认一下</string>
<key>icon</key>
<string>icon01.jpg</string>
<key>time</key>
<string>昨天 20:15</string>
<key>type</key>
<integer>0</integer>
</dict>
<dict>
<key>content</key>
<string>你妈B的!!!滚!!!</string>
<key>icon</key>
<string>icon02.jpg</string>
<key>time</key>
<string>昨天 20:15</string>
<key>type</key>
<integer>1</integer>
</dict>
</array>
</plist>
Binary file not shown.
@@ -0,0 +1,22 @@
//
// ChartMessage.h
// 气泡
//
// Created by zzy on 14-5-13.
// Copyright (c) 2014年 zzy. All rights reserved.
//
typedef enum {
kMessageFrom=0,
kMessageTo
}ChartMessageType;
#import <Foundation/Foundation.h>
@interface ChartMessage : NSObject
@property (nonatomic,assign) ChartMessageType messageType;
@property (nonatomic, copy) NSString *icon;
//@property (nonatomic, copy) NSString *time;
@property (nonatomic, copy) NSString *content;
@property (nonatomic, copy) NSDictionary *dict;
@end
@@ -0,0 +1,22 @@
//
// ChartMessage.m
// 气泡
//
// Created by zzy on 14-5-13.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#import "ChartMessage.h"
@implementation ChartMessage
-(void)setDict:(NSDictionary *)dict
{
_dict=dict;
self.icon=dict[@"icon"];
// self.time=dict[@"time"];
self.content=dict[@"content"];
self.messageType=[dict[@"type"] intValue];
}
@end
Binary file not shown.
@@ -0,0 +1,24 @@
//
// ChartContentView.h
// 气泡
//
// Created by zzy on 14-5-13.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#import <UIKit/UIKit.h>
@class ChartContentView,ChartMessage;
@protocol ChartContentViewDelegate <NSObject>
-(void)chartContentViewLongPress:(ChartContentView *)chartView content:(NSString *)content;
-(void)chartContentViewTapPress:(ChartContentView *)chartView content:(NSString *)content;
@end
@interface ChartContentView : UIView
@property (nonatomic,strong) UIImageView *backImageView;
@property (nonatomic,strong) UILabel *contentLabel;
@property (nonatomic,strong) ChartMessage *chartMessage;
@property (nonatomic,assign) id <ChartContentViewDelegate> delegate;
@end
@@ -0,0 +1,63 @@
//
// ChartContentView.m
// 气泡
//
// Created by zzy on 14-5-13.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#define kContentStartMargin 25
#import "ChartContentView.h"
#import "ChartMessage.h"
@implementation ChartContentView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.backImageView=[[UIImageView alloc]init];
self.backImageView.userInteractionEnabled=YES;
[self addSubview:self.backImageView];
self.contentLabel=[[UILabel alloc]init];
self.contentLabel.numberOfLines=0;
self.contentLabel.textAlignment=NSTextAlignmentLeft;
self.contentLabel.font=[UIFont fontWithName:@"HelveticaNeue" size:13];
[self addSubview:self.contentLabel];
[self addGestureRecognizer: [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longTap:)]];
[self addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapPress:)]];
}
return self;
}
-(void)setFrame:(CGRect)frame
{
[super setFrame:frame];
self.backImageView.frame=self.bounds;
CGFloat contentLabelX=0;
if(self.chartMessage.messageType==kMessageFrom){
contentLabelX=kContentStartMargin*0.8;
}else if(self.chartMessage.messageType==kMessageTo){
contentLabelX=kContentStartMargin*0.5;
}
self.contentLabel.frame=CGRectMake(contentLabelX, -3, self.frame.size.width-kContentStartMargin-5, self.frame.size.height);
}
-(void)longTap:(UILongPressGestureRecognizer *)longTap
{
if([self.delegate respondsToSelector:@selector(chartContentViewLongPress:content:)]){
[self.delegate chartContentViewLongPress:self content:self.contentLabel.text];
}
}
-(void)tapPress:(UILongPressGestureRecognizer *)tapPress
{
if([self.delegate respondsToSelector:@selector(chartContentViewTapPress:content:)]){
[self.delegate chartContentViewTapPress:self content:self.contentLabel.text];
}
}
@end
@@ -0,0 +1,23 @@
//
// KeyBordVIew.h
// 气泡
//
// Created by zzy on 14-5-13.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#import <UIKit/UIKit.h>
@class KeyBordVIew;
@protocol KeyBordVIewDelegate <NSObject>
-(void)KeyBordView:(KeyBordVIew *)keyBoardView textFiledReturn:(UITextField *)textFiled;
-(void)KeyBordView:(KeyBordVIew *)keyBoardView textFiledBegin:(UITextField *)textFiled;
-(void)beginRecord;
-(void)finishRecord;
@end
@interface KeyBordVIew : UIView
@property (nonatomic,assign) id<KeyBordVIewDelegate>delegate;
@end
+149
View File
@@ -0,0 +1,149 @@
//
// KeyBordVIew.m
// 气泡
//
// Created by zzy on 14-5-13.
// Copyright (c) 2014年 zzy. All rights reserved.
//
#import "KeyBordVIew.h"
#import "ChartMessage.h"
#import "ChartCellFrame.h"
@interface KeyBordVIew()<UITextFieldDelegate>
@property (nonatomic,strong) UIImageView *backImageView;
@property (nonatomic,strong) UIButton *voiceBtn;
@property (nonatomic,strong) UIButton *imageBtn;
@property (nonatomic,strong) UIButton *addBtn;
@property (nonatomic,strong) UIButton *speakBtn;
@property (nonatomic,strong) UITextField *textField;
@end
@implementation KeyBordVIew
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
[self initialData];
}
return self;
}
-(UIButton *)buttonWith:(NSString *)noraml hightLight:(NSString *)hightLight action:(SEL)action
{
UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
[btn setImage:[UIImage imageNamed:noraml] forState:UIControlStateNormal];
[btn setImage:[UIImage imageNamed:hightLight] forState:UIControlStateHighlighted];
[btn addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];
return btn;
}
-(void)initialData
{
self.backImageView=[[UIImageView alloc]initWithFrame:self.bounds];
self.backImageView.image=[UIImage strethImageWith:@"toolbar_bottom_bar.png"];
[self addSubview:self.backImageView];
self.voiceBtn=[self buttonWith:@"chat_bottom_voice_nor.png" hightLight:@"chat_bottom_voice_press.png" action:@selector(voiceBtnPress:)];
[self.voiceBtn setFrame:CGRectMake(0,0, 33, 33)];
[self.voiceBtn setCenter:CGPointMake(30, self.frame.size.height*0.5)];
[self addSubview:self.voiceBtn];
self.textField=[[UITextField alloc]initWithFrame:CGRectMake(0, 0, 180, self.frame.size.height*0.8)];
self.textField.returnKeyType=UIReturnKeySend;
self.textField.center=CGPointMake(145, self.frame.size.height*0.5);
self.textField.font=[UIFont fontWithName:@"HelveticaNeue" size:14];
self.textField.placeholder=@"请输入...";
self.textField.background=[UIImage imageNamed:@"chat_bottom_textfield.png"];
self.textField.delegate=self;
[self addSubview:self.textField];
self.imageBtn=[self buttonWith:@"chat_bottom_smile_nor.png" hightLight:@"chat_bottom_smile_press.png" action:@selector(imageBtnPress:)];
[self.imageBtn setFrame:CGRectMake(0, 0, 33, 33)];
[self.imageBtn setCenter:CGPointMake(260, self.frame.size.height*0.5)];
[self addSubview:self.imageBtn];
self.addBtn=[self buttonWith:@"chat_bottom_up_nor.png" hightLight:@"chat_bottom_up_press.png" action:@selector(addBtnPress:)];
[self.addBtn setFrame:CGRectMake(0, 0, 33, 33)];
[self.addBtn setCenter:CGPointMake(300, self.frame.size.height*0.5)];
[self addSubview:self.addBtn];
self.speakBtn=[self buttonWith:nil hightLight:nil action:@selector(speakBtnPress:)];
[self.speakBtn setTitle:@"按住说话" forState:UIControlStateNormal];
[self.speakBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
[self.speakBtn addTarget:self action:@selector(touchDown:) forControlEvents:UIControlEventTouchDown];
[self.speakBtn setTitleColor:[UIColor redColor] forState:(UIControlState)UIControlEventTouchDown];
[self.speakBtn setBackgroundColor:[UIColor whiteColor]];
[self.speakBtn setFrame:self.textField.frame];
self.speakBtn.hidden=YES;
[self addSubview:self.speakBtn];
}
-(void)touchDown:(UIButton *)voice
{
//开始录音
if([self.delegate respondsToSelector:@selector(beginRecord)]){
[self.delegate beginRecord];
}
NSLog(@"开始录音");
}
-(void)speakBtnPress:(UIButton *)voice
{
//结束录音
if([self.delegate respondsToSelector:@selector(finishRecord)]){
[self.delegate finishRecord];
}
NSLog(@"结束录音");
}
-(void)voiceBtnPress:(UIButton *)voice
{
NSString *normal,*hightLight;
if(self.speakBtn.hidden==YES){
self.speakBtn.hidden=NO;
self.textField.hidden=YES;
normal=@"chat_bottom_keyboard_nor.png";
hightLight=@"chat_bottom_keyboard_press.png";
}else{
self.speakBtn.hidden=YES;
self.textField.hidden=NO;
normal=@"chat_bottom_voice_nor.png";
hightLight=@"chat_bottom_voice_press.png";
}
[voice setImage:[UIImage imageNamed:normal] forState:UIControlStateNormal];
[voice setImage:[UIImage imageNamed:hightLight] forState:UIControlStateHighlighted];
}
-(void)imageBtnPress:(UIButton *)image
{
}
-(void)addBtnPress:(UIButton *)image
{
}
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
if([self.delegate respondsToSelector:@selector(KeyBordView:textFiledBegin:)]){
[self.delegate KeyBordView:self textFiledBegin:textField];
}
return YES;
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
if([self.delegate respondsToSelector:@selector(KeyBordView:textFiledReturn:)]){
[self.delegate KeyBordView:self textFiledReturn:textField];
}
return YES;
}
@end