diff --git a/example/UIBubbleTableViewExample.xcodeproj/project.pbxproj b/example/BTVBubbleTableViewExample.xcodeproj/project.pbxproj similarity index 71% rename from example/UIBubbleTableViewExample.xcodeproj/project.pbxproj rename to example/BTVBubbleTableViewExample.xcodeproj/project.pbxproj index 5aff5b7..4ad15be 100644 --- a/example/UIBubbleTableViewExample.xcodeproj/project.pbxproj +++ b/example/BTVBubbleTableViewExample.xcodeproj/project.pbxproj @@ -7,9 +7,9 @@ objects = { /* Begin PBXBuildFile section */ - 76687AFD1622039C00707588 /* UIBubbleTypingTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 76687AFC1622039C00707588 /* UIBubbleTypingTableViewCell.m */; }; + 76687AFD1622039C00707588 /* BTVBubbleTypingTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 76687AFC1622039C00707588 /* BTVBubbleTypingTableViewCell.m */; }; 76687AFF162203AF00707588 /* halloween.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 76687AFE162203AF00707588 /* halloween.jpg */; }; - 76D097CC1621F0E000C17816 /* UIBubbleHeaderTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D097CB1621F0E000C17816 /* UIBubbleHeaderTableViewCell.m */; }; + 76D097CC1621F0E000C17816 /* BTVBubbleHeaderTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D097CB1621F0E000C17816 /* BTVBubbleHeaderTableViewCell.m */; }; 76ED206315BF096C00E186D3 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76ED206215BF096C00E186D3 /* UIKit.framework */; }; 76ED206515BF096C00E186D3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76ED206415BF096C00E186D3 /* Foundation.framework */; }; 76ED206715BF096C00E186D3 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76ED206615BF096C00E186D3 /* CoreGraphics.framework */; }; @@ -18,9 +18,9 @@ 76ED207315BF096C00E186D3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 76ED207215BF096C00E186D3 /* AppDelegate.m */; }; 76ED207615BF096C00E186D3 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 76ED207515BF096C00E186D3 /* ViewController.m */; }; 76ED207915BF096C00E186D3 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 76ED207715BF096C00E186D3 /* ViewController.xib */; }; - 76ED208715BF09E300E186D3 /* UIBubbleTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 76ED208615BF09E300E186D3 /* UIBubbleTableView.m */; }; - 76ED208B15BF0BB100E186D3 /* NSBubbleData.m in Sources */ = {isa = PBXBuildFile; fileRef = 76ED208A15BF0BB100E186D3 /* NSBubbleData.m */; }; - 76ED209415BF29EE00E186D3 /* UIBubbleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 76ED209315BF29EE00E186D3 /* UIBubbleTableViewCell.m */; }; + 76ED208715BF09E300E186D3 /* BTVBubbleTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 76ED208615BF09E300E186D3 /* BTVBubbleTableView.m */; }; + 76ED208B15BF0BB100E186D3 /* BTVBubbleData.m in Sources */ = {isa = PBXBuildFile; fileRef = 76ED208A15BF0BB100E186D3 /* BTVBubbleData.m */; }; + 76ED209415BF29EE00E186D3 /* BTVBubbleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 76ED209315BF29EE00E186D3 /* BTVBubbleTableViewCell.m */; }; C836D5CA1625CBA5004CB4A9 /* missingAvatar.png in Resources */ = {isa = PBXBuildFile; fileRef = C836D5C81625CBA5004CB4A9 /* missingAvatar.png */; }; C836D5CB1625CBA5004CB4A9 /* missingAvatar@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C836D5C91625CBA5004CB4A9 /* missingAvatar@2x.png */; }; C836D5CE1625D718004CB4A9 /* avatar1.png in Resources */ = {isa = PBXBuildFile; fileRef = C836D5CD1625D718004CB4A9 /* avatar1.png */; }; @@ -37,31 +37,31 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 76687AFB1622039C00707588 /* UIBubbleTypingTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIBubbleTypingTableViewCell.h; path = ../../src/UIBubbleTypingTableViewCell.h; sourceTree = ""; }; - 76687AFC1622039C00707588 /* UIBubbleTypingTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIBubbleTypingTableViewCell.m; path = ../../src/UIBubbleTypingTableViewCell.m; sourceTree = ""; }; + 76687AFB1622039C00707588 /* BTVBubbleTypingTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BTVBubbleTypingTableViewCell.h; path = ../../src/BTVBubbleTypingTableViewCell.h; sourceTree = ""; }; + 76687AFC1622039C00707588 /* BTVBubbleTypingTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BTVBubbleTypingTableViewCell.m; path = ../../src/BTVBubbleTypingTableViewCell.m; sourceTree = ""; }; 76687AFE162203AF00707588 /* halloween.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = halloween.jpg; sourceTree = SOURCE_ROOT; }; - 76D097CA1621F0E000C17816 /* UIBubbleHeaderTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIBubbleHeaderTableViewCell.h; path = ../../src/UIBubbleHeaderTableViewCell.h; sourceTree = ""; }; - 76D097CB1621F0E000C17816 /* UIBubbleHeaderTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIBubbleHeaderTableViewCell.m; path = ../../src/UIBubbleHeaderTableViewCell.m; sourceTree = ""; }; - 76ED205E15BF096C00E186D3 /* UIBubbleTableViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIBubbleTableViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 76D097CA1621F0E000C17816 /* BTVBubbleHeaderTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BTVBubbleHeaderTableViewCell.h; path = ../../src/BTVBubbleHeaderTableViewCell.h; sourceTree = ""; }; + 76D097CB1621F0E000C17816 /* BTVBubbleHeaderTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BTVBubbleHeaderTableViewCell.m; path = ../../src/BTVBubbleHeaderTableViewCell.m; sourceTree = ""; }; + 76ED205E15BF096C00E186D3 /* BTVBubbleTableViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BTVBubbleTableViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 76ED206215BF096C00E186D3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 76ED206415BF096C00E186D3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 76ED206615BF096C00E186D3 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 76ED206A15BF096C00E186D3 /* UIBubbleTableViewExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UIBubbleTableViewExample-Info.plist"; sourceTree = ""; }; + 76ED206A15BF096C00E186D3 /* BTVBubbleTableViewExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BTVBubbleTableViewExample-Info.plist"; sourceTree = ""; }; 76ED206C15BF096C00E186D3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 76ED206E15BF096C00E186D3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 76ED207015BF096C00E186D3 /* UIBubbleTableViewExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIBubbleTableViewExample-Prefix.pch"; sourceTree = ""; }; + 76ED207015BF096C00E186D3 /* BTVBubbleTableViewExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BTVBubbleTableViewExample-Prefix.pch"; sourceTree = ""; }; 76ED207115BF096C00E186D3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 76ED207215BF096C00E186D3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 76ED207415BF096C00E186D3 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 76ED207515BF096C00E186D3 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 76ED207815BF096C00E186D3 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController.xib; sourceTree = ""; }; - 76ED208515BF09E300E186D3 /* UIBubbleTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIBubbleTableView.h; path = ../../src/UIBubbleTableView.h; sourceTree = ""; }; - 76ED208615BF09E300E186D3 /* UIBubbleTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIBubbleTableView.m; path = ../../src/UIBubbleTableView.m; sourceTree = ""; }; - 76ED208815BF0B4400E186D3 /* UIBubbleTableViewDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UIBubbleTableViewDataSource.h; path = ../../src/UIBubbleTableViewDataSource.h; sourceTree = ""; }; - 76ED208915BF0BB100E186D3 /* NSBubbleData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NSBubbleData.h; path = ../../src/NSBubbleData.h; sourceTree = ""; }; - 76ED208A15BF0BB100E186D3 /* NSBubbleData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NSBubbleData.m; path = ../../src/NSBubbleData.m; sourceTree = ""; }; - 76ED209215BF29EE00E186D3 /* UIBubbleTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIBubbleTableViewCell.h; path = ../../src/UIBubbleTableViewCell.h; sourceTree = ""; }; - 76ED209315BF29EE00E186D3 /* UIBubbleTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIBubbleTableViewCell.m; path = ../../src/UIBubbleTableViewCell.m; sourceTree = ""; }; + 76ED208515BF09E300E186D3 /* BTVBubbleTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BTVBubbleTableView.h; path = ../../src/BTVBubbleTableView.h; sourceTree = ""; }; + 76ED208615BF09E300E186D3 /* BTVBubbleTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BTVBubbleTableView.m; path = ../../src/BTVBubbleTableView.m; sourceTree = ""; }; + 76ED208815BF0B4400E186D3 /* BTVBubbleTableViewDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = BTVBubbleTableViewDataSource.h; path = ../../src/BTVBubbleTableViewDataSource.h; sourceTree = ""; }; + 76ED208915BF0BB100E186D3 /* BTVBubbleData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BTVBubbleData.h; path = ../../src/BTVBubbleData.h; sourceTree = ""; }; + 76ED208A15BF0BB100E186D3 /* BTVBubbleData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BTVBubbleData.m; path = ../../src/BTVBubbleData.m; sourceTree = ""; }; + 76ED209215BF29EE00E186D3 /* BTVBubbleTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BTVBubbleTableViewCell.h; path = ../../src/BTVBubbleTableViewCell.h; sourceTree = ""; }; + 76ED209315BF29EE00E186D3 /* BTVBubbleTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BTVBubbleTableViewCell.m; path = ../../src/BTVBubbleTableViewCell.m; sourceTree = ""; }; C836D5C81625CBA5004CB4A9 /* missingAvatar.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = missingAvatar.png; sourceTree = ""; }; C836D5C91625CBA5004CB4A9 /* missingAvatar@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "missingAvatar@2x.png"; sourceTree = ""; }; C836D5CD1625D718004CB4A9 /* avatar1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = avatar1.png; sourceTree = SOURCE_ROOT; }; @@ -94,7 +94,7 @@ 76ED205315BF096C00E186D3 = { isa = PBXGroup; children = ( - 76ED206815BF096C00E186D3 /* UIBubbleTableViewExample */, + 76ED206815BF096C00E186D3 /* BTVBubbleTableViewExample */, 76ED206115BF096C00E186D3 /* Frameworks */, 76ED205F15BF096C00E186D3 /* Products */, ); @@ -103,7 +103,7 @@ 76ED205F15BF096C00E186D3 /* Products */ = { isa = PBXGroup; children = ( - 76ED205E15BF096C00E186D3 /* UIBubbleTableViewExample.app */, + 76ED205E15BF096C00E186D3 /* BTVBubbleTableViewExample.app */, ); name = Products; sourceTree = ""; @@ -118,7 +118,7 @@ name = Frameworks; sourceTree = ""; }; - 76ED206815BF096C00E186D3 /* UIBubbleTableViewExample */ = { + 76ED206815BF096C00E186D3 /* BTVBubbleTableViewExample */ = { isa = PBXGroup; children = ( C83B107015DE43180067DADE /* images */, @@ -130,6 +130,7 @@ 76ED207715BF096C00E186D3 /* ViewController.xib */, 76ED206915BF096C00E186D3 /* Supporting Files */, ); + name = BTVBubbleTableViewExample; path = UIBubbleTableViewExample; sourceTree = ""; }; @@ -140,10 +141,10 @@ 76687AFE162203AF00707588 /* halloween.jpg */, C86D4FFD15BFEBC1003F161E /* icon_114.png */, C86D4FFB15BFEBBF003F161E /* icon_57.png */, - 76ED206A15BF096C00E186D3 /* UIBubbleTableViewExample-Info.plist */, + 76ED206A15BF096C00E186D3 /* BTVBubbleTableViewExample-Info.plist */, 76ED206B15BF096C00E186D3 /* InfoPlist.strings */, 76ED206E15BF096C00E186D3 /* main.m */, - 76ED207015BF096C00E186D3 /* UIBubbleTableViewExample-Prefix.pch */, + 76ED207015BF096C00E186D3 /* BTVBubbleTableViewExample-Prefix.pch */, ); name = "Supporting Files"; sourceTree = ""; @@ -151,17 +152,17 @@ 76ED208315BF09AD00E186D3 /* src */ = { isa = PBXGroup; children = ( - 76ED208915BF0BB100E186D3 /* NSBubbleData.h */, - 76ED208A15BF0BB100E186D3 /* NSBubbleData.m */, - 76ED208515BF09E300E186D3 /* UIBubbleTableView.h */, - 76ED208615BF09E300E186D3 /* UIBubbleTableView.m */, - 76ED209215BF29EE00E186D3 /* UIBubbleTableViewCell.h */, - 76ED209315BF29EE00E186D3 /* UIBubbleTableViewCell.m */, - 76D097CA1621F0E000C17816 /* UIBubbleHeaderTableViewCell.h */, - 76D097CB1621F0E000C17816 /* UIBubbleHeaderTableViewCell.m */, - 76687AFB1622039C00707588 /* UIBubbleTypingTableViewCell.h */, - 76687AFC1622039C00707588 /* UIBubbleTypingTableViewCell.m */, - 76ED208815BF0B4400E186D3 /* UIBubbleTableViewDataSource.h */, + 76ED208915BF0BB100E186D3 /* BTVBubbleData.h */, + 76ED208A15BF0BB100E186D3 /* BTVBubbleData.m */, + 76ED208515BF09E300E186D3 /* BTVBubbleTableView.h */, + 76ED208615BF09E300E186D3 /* BTVBubbleTableView.m */, + 76ED209215BF29EE00E186D3 /* BTVBubbleTableViewCell.h */, + 76ED209315BF29EE00E186D3 /* BTVBubbleTableViewCell.m */, + 76D097CA1621F0E000C17816 /* BTVBubbleHeaderTableViewCell.h */, + 76D097CB1621F0E000C17816 /* BTVBubbleHeaderTableViewCell.m */, + 76687AFB1622039C00707588 /* BTVBubbleTypingTableViewCell.h */, + 76687AFC1622039C00707588 /* BTVBubbleTypingTableViewCell.m */, + 76ED208815BF0B4400E186D3 /* BTVBubbleTableViewDataSource.h */, ); name = src; sourceTree = ""; @@ -187,9 +188,9 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 76ED205D15BF096C00E186D3 /* UIBubbleTableViewExample */ = { + 76ED205D15BF096C00E186D3 /* BTVBubbleTableViewExample */ = { isa = PBXNativeTarget; - buildConfigurationList = 76ED207C15BF096C00E186D3 /* Build configuration list for PBXNativeTarget "UIBubbleTableViewExample" */; + buildConfigurationList = 76ED207C15BF096C00E186D3 /* Build configuration list for PBXNativeTarget "BTVBubbleTableViewExample" */; buildPhases = ( 76ED205A15BF096C00E186D3 /* Sources */, 76ED205B15BF096C00E186D3 /* Frameworks */, @@ -199,9 +200,9 @@ ); dependencies = ( ); - name = UIBubbleTableViewExample; + name = BTVBubbleTableViewExample; productName = UIBubbleTableViewExample; - productReference = 76ED205E15BF096C00E186D3 /* UIBubbleTableViewExample.app */; + productReference = 76ED205E15BF096C00E186D3 /* BTVBubbleTableViewExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -212,7 +213,7 @@ attributes = { LastUpgradeCheck = 0430; }; - buildConfigurationList = 76ED205815BF096C00E186D3 /* Build configuration list for PBXProject "UIBubbleTableViewExample" */; + buildConfigurationList = 76ED205815BF096C00E186D3 /* Build configuration list for PBXProject "BTVBubbleTableViewExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -224,7 +225,7 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 76ED205D15BF096C00E186D3 /* UIBubbleTableViewExample */, + 76ED205D15BF096C00E186D3 /* BTVBubbleTableViewExample */, ); }; /* End PBXProject section */ @@ -263,11 +264,11 @@ 76ED206F15BF096C00E186D3 /* main.m in Sources */, 76ED207315BF096C00E186D3 /* AppDelegate.m in Sources */, 76ED207615BF096C00E186D3 /* ViewController.m in Sources */, - 76ED208715BF09E300E186D3 /* UIBubbleTableView.m in Sources */, - 76ED208B15BF0BB100E186D3 /* NSBubbleData.m in Sources */, - 76ED209415BF29EE00E186D3 /* UIBubbleTableViewCell.m in Sources */, - 76D097CC1621F0E000C17816 /* UIBubbleHeaderTableViewCell.m in Sources */, - 76687AFD1622039C00707588 /* UIBubbleTypingTableViewCell.m in Sources */, + 76ED208715BF09E300E186D3 /* BTVBubbleTableView.m in Sources */, + 76ED208B15BF0BB100E186D3 /* BTVBubbleData.m in Sources */, + 76ED209415BF29EE00E186D3 /* BTVBubbleTableViewCell.m in Sources */, + 76D097CC1621F0E000C17816 /* BTVBubbleHeaderTableViewCell.m in Sources */, + 76687AFD1622039C00707588 /* BTVBubbleTypingTableViewCell.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -340,9 +341,9 @@ isa = XCBuildConfiguration; buildSettings = { GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "UIBubbleTableViewExample/UIBubbleTableViewExample-Prefix.pch"; - INFOPLIST_FILE = "UIBubbleTableViewExample/UIBubbleTableViewExample-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; + GCC_PREFIX_HEADER = "UIBubbleTableViewExample/BTVBubbleTableViewExample-Prefix.pch"; + INFOPLIST_FILE = "UIBubbleTableViewExample/BTVBubbleTableViewExample-Info.plist"; + PRODUCT_NAME = BTVBubbleTableViewExample; WRAPPER_EXTENSION = app; }; name = Debug; @@ -351,9 +352,9 @@ isa = XCBuildConfiguration; buildSettings = { GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "UIBubbleTableViewExample/UIBubbleTableViewExample-Prefix.pch"; - INFOPLIST_FILE = "UIBubbleTableViewExample/UIBubbleTableViewExample-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; + GCC_PREFIX_HEADER = "UIBubbleTableViewExample/BTVBubbleTableViewExample-Prefix.pch"; + INFOPLIST_FILE = "UIBubbleTableViewExample/BTVBubbleTableViewExample-Info.plist"; + PRODUCT_NAME = BTVBubbleTableViewExample; WRAPPER_EXTENSION = app; }; name = Release; @@ -361,7 +362,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 76ED205815BF096C00E186D3 /* Build configuration list for PBXProject "UIBubbleTableViewExample" */ = { + 76ED205815BF096C00E186D3 /* Build configuration list for PBXProject "BTVBubbleTableViewExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 76ED207A15BF096C00E186D3 /* Debug */, @@ -370,7 +371,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 76ED207C15BF096C00E186D3 /* Build configuration list for PBXNativeTarget "UIBubbleTableViewExample" */ = { + 76ED207C15BF096C00E186D3 /* Build configuration list for PBXNativeTarget "BTVBubbleTableViewExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 76ED207D15BF096C00E186D3 /* Debug */, diff --git a/example/UIBubbleTableViewExample/UIBubbleTableViewExample-Info.plist b/example/UIBubbleTableViewExample/BTVBubbleTableViewExample-Info.plist similarity index 100% rename from example/UIBubbleTableViewExample/UIBubbleTableViewExample-Info.plist rename to example/UIBubbleTableViewExample/BTVBubbleTableViewExample-Info.plist diff --git a/example/UIBubbleTableViewExample/UIBubbleTableViewExample-Prefix.pch b/example/UIBubbleTableViewExample/BTVBubbleTableViewExample-Prefix.pch similarity index 100% rename from example/UIBubbleTableViewExample/UIBubbleTableViewExample-Prefix.pch rename to example/UIBubbleTableViewExample/BTVBubbleTableViewExample-Prefix.pch diff --git a/example/UIBubbleTableViewExample/ViewController.h b/example/UIBubbleTableViewExample/ViewController.h index 9c8ecb9..4ebde9c 100644 --- a/example/UIBubbleTableViewExample/ViewController.h +++ b/example/UIBubbleTableViewExample/ViewController.h @@ -9,8 +9,8 @@ // #import -#import "UIBubbleTableViewDataSource.h" +#import "BTVBubbleTableViewDataSource.h" -@interface ViewController : UIViewController +@interface ViewController : UIViewController @end diff --git a/example/UIBubbleTableViewExample/ViewController.m b/example/UIBubbleTableViewExample/ViewController.m index 5516175..f0562ad 100644 --- a/example/UIBubbleTableViewExample/ViewController.m +++ b/example/UIBubbleTableViewExample/ViewController.m @@ -15,13 +15,13 @@ // #import "ViewController.h" -#import "UIBubbleTableView.h" -#import "UIBubbleTableViewDataSource.h" -#import "NSBubbleData.h" +#import "BTVBubbleTableView.h" +#import "BTVBubbleTableViewDataSource.h" +#import "BTVBubbleData.h" @interface ViewController () { - IBOutlet UIBubbleTableView *bubbleTable; + IBOutlet BTVBubbleTableView *bubbleTable; IBOutlet UIView *textInputView; IBOutlet UITextField *textField; @@ -36,13 +36,13 @@ - (void)viewDidLoad { [super viewDidLoad]; - NSBubbleData *heyBubble = [NSBubbleData dataWithText:@"Hey, halloween is soon" date:[NSDate dateWithTimeIntervalSinceNow:-300] type:BubbleTypeSomeoneElse]; + BTVBubbleData *heyBubble = [BTVBubbleData dataWithText:@"Hey, halloween is soon" date:[NSDate dateWithTimeIntervalSinceNow:-300] type:BubbleTypeSomeoneElse]; heyBubble.avatar = [UIImage imageNamed:@"avatar1.png"]; - NSBubbleData *photoBubble = [NSBubbleData dataWithImage:[UIImage imageNamed:@"halloween.jpg"] date:[NSDate dateWithTimeIntervalSinceNow:-290] type:BubbleTypeSomeoneElse]; + BTVBubbleData *photoBubble = [BTVBubbleData dataWithImage:[UIImage imageNamed:@"halloween.jpg"] date:[NSDate dateWithTimeIntervalSinceNow:-290] type:BubbleTypeSomeoneElse]; photoBubble.avatar = [UIImage imageNamed:@"avatar1.png"]; - NSBubbleData *replyBubble = [NSBubbleData dataWithText:@"Wow.. Really cool picture out there. iPhone 5 has really nice camera, yeah?" date:[NSDate dateWithTimeIntervalSinceNow:-5] type:BubbleTypeMine]; + BTVBubbleData *replyBubble = [BTVBubbleData dataWithText:@"Wow.. Really cool picture out there. iPhone 5 has really nice camera, yeah?" date:[NSDate dateWithTimeIntervalSinceNow:-5] type:BubbleTypeMine]; replyBubble.avatar = nil; bubbleData = [[NSMutableArray alloc] initWithObjects:heyBubble, photoBubble, replyBubble, nil]; @@ -82,12 +82,12 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface #pragma mark - UIBubbleTableViewDataSource implementation -- (NSInteger)rowsForBubbleTable:(UIBubbleTableView *)tableView +- (NSInteger)numberOfRowsForBubbleTable:(BTVBubbleTableView *)tableView { return [bubbleData count]; } -- (NSBubbleData *)bubbleTableView:(UIBubbleTableView *)tableView dataForRow:(NSInteger)row +- (BTVBubbleData *)bubbleTableView:(BTVBubbleTableView *)tableView dataForRow:(NSInteger)row { return [bubbleData objectAtIndex:row]; } @@ -134,7 +134,7 @@ - (IBAction)sayPressed:(id)sender { bubbleTable.typingBubble = NSBubbleTypingTypeNobody; - NSBubbleData *sayBubble = [NSBubbleData dataWithText:textField.text date:[NSDate dateWithTimeIntervalSinceNow:0] type:BubbleTypeMine]; + BTVBubbleData *sayBubble = [BTVBubbleData dataWithText:textField.text date:[NSDate dateWithTimeIntervalSinceNow:0] type:BubbleTypeMine]; [bubbleData addObject:sayBubble]; [bubbleTable reloadData]; diff --git a/example/UIBubbleTableViewExample/en.lproj/ViewController.xib b/example/UIBubbleTableViewExample/en.lproj/ViewController.xib index 9839644..9a5bc84 100644 --- a/example/UIBubbleTableViewExample/en.lproj/ViewController.xib +++ b/example/UIBubbleTableViewExample/en.lproj/ViewController.xib @@ -2,13 +2,13 @@ 1536 - 11E53 - 2840 - 1138.47 - 569.00 + 12C60 + 2844 + 1187.34 + 625.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1926 + 1930 IBProxyObject @@ -34,7 +34,7 @@ IBCocoaTouchFramework - + 274 @@ -42,7 +42,6 @@ 274 {320, 425} - _NS:9 @@ -68,7 +67,6 @@ 292 {{2, 3}, {235, 30}} - _NS:9 NO @@ -104,7 +102,6 @@ 292 {{245, 2}, {73, 32}} - _NS:9 NO IBCocoaTouchFramework @@ -134,7 +131,6 @@ {{0, 425}, {320, 35}} - _NS:9 @@ -145,8 +141,6 @@ {{0, 20}, {320, 460}} - - 3 @@ -265,7 +259,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIBubbleTableView + BTVBubbleTableView com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -343,6 +337,6 @@ YES 3 - 1926 + 1930 diff --git a/src/BTVBubbleData.h b/src/BTVBubbleData.h new file mode 100644 index 0000000..70f7d20 --- /dev/null +++ b/src/BTVBubbleData.h @@ -0,0 +1,37 @@ +// +// NSBubbleData.h +// +// Created by Alex Barinov +// Project home page: http://alexbarinov.github.com/UIBubbleTableView/ +// +// This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. +// To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ +// + +#import + +typedef enum _BTVBubbleType +{ + BubbleTypeMine = 0, + BubbleTypeSomeoneElse = 1, + BubbleTypeInfo = 2 +} BTVBubbleType; + +@interface BTVBubbleData : NSObject + +@property (readonly, nonatomic, strong) NSDate *date; +@property (readonly, nonatomic) BTVBubbleType type; +@property (readonly, nonatomic, strong) UIView *view; +@property (readonly, nonatomic) UIEdgeInsets insets; +@property (nonatomic, strong) UIImage *avatar; +@property (strong, nonatomic) NSString *text; +@property (strong, nonatomic) NSString *userLabel; + +- (id)initWithText:(NSString *)text date:(NSDate *)date type:(BTVBubbleType)type; ++ (id)dataWithText:(NSString *)text date:(NSDate *)date type:(BTVBubbleType)type; +- (id)initWithImage:(UIImage *)image date:(NSDate *)date type:(BTVBubbleType)type; ++ (id)dataWithImage:(UIImage *)image date:(NSDate *)date type:(BTVBubbleType)type; +- (id)initWithView:(UIView *)view date:(NSDate *)date type:(BTVBubbleType)type insets:(UIEdgeInsets)insets; ++ (id)dataWithView:(UIView *)view date:(NSDate *)date type:(BTVBubbleType)type insets:(UIEdgeInsets)insets; + +@end diff --git a/src/NSBubbleData.m b/src/BTVBubbleData.m similarity index 71% rename from src/NSBubbleData.m rename to src/BTVBubbleData.m index 317cc53..893a072 100644 --- a/src/NSBubbleData.m +++ b/src/BTVBubbleData.m @@ -8,10 +8,10 @@ // To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ // -#import "NSBubbleData.h" +#import "BTVBubbleData.h" #import -@implementation NSBubbleData +@implementation BTVBubbleData #pragma mark - Properties @@ -42,33 +42,36 @@ - (void)dealloc const UIEdgeInsets textInsetsMine = {5, 10, 11, 17}; const UIEdgeInsets textInsetsSomeone = {5, 15, 11, 10}; -+ (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type ++ (id)dataWithText:(NSString *)text date:(NSDate *)date type:(BTVBubbleType)type { #if !__has_feature(objc_arc) - return [[[NSBubbleData alloc] initWithText:text date:date type:type] autorelease]; + return [[[BTVBubbleData alloc] initWithText:text date:date type:type] autorelease]; #else return [[NSBubbleData alloc] initWithText:text date:date type:type]; #endif } -- (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type +- (id)initWithText:(NSString *)text date:(NSDate *)date type:(BTVBubbleType)type { UIFont *font = [UIFont systemFontOfSize:[UIFont systemFontSize]]; - CGSize size = [(text ? text : @"") sizeWithFont:font constrainedToSize:CGSizeMake(220, 9999) lineBreakMode:UILineBreakModeWordWrap]; + CGSize size = [(text ? text : @"") sizeWithFont:font constrainedToSize:CGSizeMake(220, 9999) lineBreakMode:NSLineBreakByWordWrapping]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)]; label.numberOfLines = 0; - label.lineBreakMode = UILineBreakModeWordWrap; + label.lineBreakMode = NSLineBreakByWordWrapping; label.text = (text ? text : @""); label.font = font; label.backgroundColor = [UIColor clearColor]; - #if !__has_feature(objc_arc) [label autorelease]; #endif UIEdgeInsets insets = (type == BubbleTypeMine ? textInsetsMine : textInsetsSomeone); - return [self initWithView:label date:date type:type insets:insets]; + if((self = [self initWithView:label date:date type:type insets:insets])) + { + self.text = text; + } + return self; } #pragma mark - Image bubble @@ -76,16 +79,16 @@ - (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type const UIEdgeInsets imageInsetsMine = {11, 13, 16, 22}; const UIEdgeInsets imageInsetsSomeone = {11, 18, 16, 14}; -+ (id)dataWithImage:(UIImage *)image date:(NSDate *)date type:(NSBubbleType)type ++ (id)dataWithImage:(UIImage *)image date:(NSDate *)date type:(BTVBubbleType)type { #if !__has_feature(objc_arc) - return [[[NSBubbleData alloc] initWithImage:image date:date type:type] autorelease]; + return [[[BTVBubbleData alloc] initWithImage:image date:date type:type] autorelease]; #else return [[NSBubbleData alloc] initWithImage:image date:date type:type]; #endif } -- (id)initWithImage:(UIImage *)image date:(NSDate *)date type:(NSBubbleType)type +- (id)initWithImage:(UIImage *)image date:(NSDate *)date type:(BTVBubbleType)type { CGSize size = image.size; if (size.width > 220) @@ -110,16 +113,16 @@ - (id)initWithImage:(UIImage *)image date:(NSDate *)date type:(NSBubbleType)type #pragma mark - Custom view bubble -+ (id)dataWithView:(UIView *)view date:(NSDate *)date type:(NSBubbleType)type insets:(UIEdgeInsets)insets ++ (id)dataWithView:(UIView *)view date:(NSDate *)date type:(BTVBubbleType)type insets:(UIEdgeInsets)insets { #if !__has_feature(objc_arc) - return [[[NSBubbleData alloc] initWithView:view date:date type:type insets:insets] autorelease]; + return [[[BTVBubbleData alloc] initWithView:view date:date type:type insets:insets] autorelease]; #else return [[NSBubbleData alloc] initWithView:view date:date type:type insets:insets]; #endif } -- (id)initWithView:(UIView *)view date:(NSDate *)date type:(NSBubbleType)type insets:(UIEdgeInsets)insets +- (id)initWithView:(UIView *)view date:(NSDate *)date type:(BTVBubbleType)type insets:(UIEdgeInsets)insets { self = [super init]; if (self) diff --git a/src/UIBubbleHeaderTableViewCell.h b/src/BTVBubbleHeaderTableViewCell.h similarity index 73% rename from src/UIBubbleHeaderTableViewCell.h rename to src/BTVBubbleHeaderTableViewCell.h index f7beccf..35337ba 100644 --- a/src/UIBubbleHeaderTableViewCell.h +++ b/src/BTVBubbleHeaderTableViewCell.h @@ -8,10 +8,11 @@ #import -@interface UIBubbleHeaderTableViewCell : UITableViewCell +@interface BTVBubbleHeaderTableViewCell : UITableViewCell + (CGFloat)height; @property (nonatomic, strong) NSDate *date; +@property (strong, nonatomic) NSString *info; @end diff --git a/src/BTVBubbleHeaderTableViewCell.m b/src/BTVBubbleHeaderTableViewCell.m new file mode 100644 index 0000000..cbbee3c --- /dev/null +++ b/src/BTVBubbleHeaderTableViewCell.m @@ -0,0 +1,70 @@ +// +// UIBubbleHeaderTableViewCell.m +// UIBubbleTableViewExample +// +// Created by Александр Баринов on 10/7/12. +// Copyright (c) 2012 Stex Group. All rights reserved. +// + +#import "BTVBubbleHeaderTableViewCell.h" + +@interface BTVBubbleHeaderTableViewCell () + +@property (nonatomic, retain) UILabel *label; + +@end + +@implementation BTVBubbleHeaderTableViewCell + +@synthesize label = _label; +@synthesize date = _date; + ++ (CGFloat)height +{ + return 28.0; +} + +- (void)setDate:(NSDate *)value +{ + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setDateStyle:NSDateFormatterMediumStyle]; + [dateFormatter setTimeStyle:NSDateFormatterShortStyle]; + NSString *text = [dateFormatter stringFromDate:value]; + [dateFormatter release]; + + if(!self.label) + { + self.selectionStyle = UITableViewCellSelectionStyleNone; + self.label = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, [BTVBubbleHeaderTableViewCell height])] autorelease]; + self.label.font = [UIFont boldSystemFontOfSize:12]; + self.label.textAlignment = NSTextAlignmentCenter; + self.label.shadowOffset = CGSizeMake(0, 1); + self.label.shadowColor = [UIColor whiteColor]; + self.label.textColor = [UIColor darkGrayColor]; + self.label.backgroundColor = [UIColor clearColor]; + [self addSubview:self.label]; + } + + self.label.text = text; +} + +-(void)setInfo:(NSString *)info +{ + if(!self.label) + { + self.selectionStyle = UITableViewCellSelectionStyleNone; + self.label = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, [BTVBubbleHeaderTableViewCell height])] autorelease]; + self.label.font = [UIFont boldSystemFontOfSize:12]; + self.label.textAlignment = NSTextAlignmentCenter; + self.label.shadowOffset = CGSizeMake(0, 1); + self.label.shadowColor = [UIColor whiteColor]; + self.label.textColor = [UIColor darkGrayColor]; + self.label.backgroundColor = [UIColor clearColor]; + [self addSubview:self.label]; + } + self.label.text = info; + _info = info; +} + + +@end diff --git a/src/UIBubbleTableView.h b/src/BTVBubbleTableView.h similarity index 52% rename from src/UIBubbleTableView.h rename to src/BTVBubbleTableView.h index e7a617d..4942764 100644 --- a/src/UIBubbleTableView.h +++ b/src/BTVBubbleTableView.h @@ -10,21 +10,24 @@ #import -#import "UIBubbleTableViewDataSource.h" -#import "UIBubbleTableViewCell.h" +#import "BTVBubbleTableViewDataSource.h" +#import "BTVBubbleTableViewCell.h" -typedef enum _NSBubbleTypingType +typedef enum _BTVBubbleTypingType { NSBubbleTypingTypeNobody = 0, NSBubbleTypingTypeMe = 1, NSBubbleTypingTypeSomebody = 2 -} NSBubbleTypingType; +} BTVBubbleTypingType; -@interface UIBubbleTableView : UITableView +@interface BTVBubbleTableView : UITableView -@property (nonatomic, assign) IBOutlet id bubbleDataSource; +@property (nonatomic, assign) IBOutlet id bubbleDataSource; @property (nonatomic) NSTimeInterval snapInterval; -@property (nonatomic) NSBubbleTypingType typingBubble; +@property (nonatomic) BTVBubbleTypingType typingBubble; @property (nonatomic) BOOL showAvatars; +@property (nonatomic) BOOL showUsernameLabel; +@property (nonatomic) BOOL scrollOnActivity; +-(void)scrollToBottomAnimated:(BOOL)animated; @end diff --git a/src/UIBubbleTableView.m b/src/BTVBubbleTableView.m similarity index 63% rename from src/UIBubbleTableView.m rename to src/BTVBubbleTableView.m index 8b91982..63a14c3 100644 --- a/src/UIBubbleTableView.m +++ b/src/BTVBubbleTableView.m @@ -8,18 +8,18 @@ // To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ // -#import "UIBubbleTableView.h" -#import "NSBubbleData.h" -#import "UIBubbleHeaderTableViewCell.h" -#import "UIBubbleTypingTableViewCell.h" +#import "BTVBubbleTableView.h" +#import "BTVBubbleData.h" +#import "BTVBubbleHeaderTableViewCell.h" +#import "BTVBubbleTypingTableViewCell.h" -@interface UIBubbleTableView () +@interface BTVBubbleTableView () @property (nonatomic, retain) NSMutableArray *bubbleSection; @end -@implementation UIBubbleTableView +@implementation BTVBubbleTableView @synthesize bubbleDataSource = _bubbleDataSource; @synthesize snapInterval = _snapInterval; @@ -102,7 +102,7 @@ - (void)reloadData self.bubbleSection = [[NSMutableArray alloc] init]; #endif - if (self.bubbleDataSource && (count = [self.bubbleDataSource rowsForBubbleTable:self]) > 0) + if (self.bubbleDataSource && (count = [self.bubbleDataSource numberOfRowsForBubbleTable:self]) > 0) { #if !__has_feature(objc_arc) NSMutableArray *bubbleData = [[[NSMutableArray alloc] initWithCapacity:count] autorelease]; @@ -113,14 +113,14 @@ - (void)reloadData for (int i = 0; i < count; i++) { NSObject *object = [self.bubbleDataSource bubbleTableView:self dataForRow:i]; - assert([object isKindOfClass:[NSBubbleData class]]); + assert([object isKindOfClass:[BTVBubbleData class]]); [bubbleData addObject:object]; } [bubbleData sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { - NSBubbleData *bubbleData1 = (NSBubbleData *)obj1; - NSBubbleData *bubbleData2 = (NSBubbleData *)obj2; + BTVBubbleData *bubbleData1 = (BTVBubbleData *)obj1; + BTVBubbleData *bubbleData2 = (BTVBubbleData *)obj2; return [bubbleData1.date compare:bubbleData2.date]; }]; @@ -130,7 +130,7 @@ - (void)reloadData for (int i = 0; i < count; i++) { - NSBubbleData *data = (NSBubbleData *)[bubbleData objectAtIndex:i]; + BTVBubbleData *data = (BTVBubbleData *)[bubbleData objectAtIndex:i]; if ([data.date timeIntervalSinceDate:last] > self.snapInterval) { @@ -148,6 +148,23 @@ - (void)reloadData } [super reloadData]; + + if(self.scrollOnActivity) + { + [self scrollToBottomAnimated:YES]; + } +} + +-(void)scrollToBottomAnimated:(BOOL)animated; +{ + NSInteger sectionCount = [self numberOfSections]; + if(sectionCount == 0) + return; + + NSInteger rowCount = [self numberOfRowsInSection:sectionCount - 1]; + + NSIndexPath* scrollTo = [NSIndexPath indexPathForRow:rowCount-1 inSection:sectionCount - 1]; + [self scrollToRowAtIndexPath:scrollTo atScrollPosition:UITableViewScrollPositionTop animated:animated]; } #pragma mark - UITableViewDelegate implementation @@ -174,17 +191,28 @@ - (float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath // Now typing if (indexPath.section >= [self.bubbleSection count]) { - return MAX([UIBubbleTypingTableViewCell height], self.showAvatars ? 52 : 0); + if(self.showUsernameLabel) + return MAX([BTVBubbleTypingTableViewCell height], 78); + if(self.showAvatars) + return MAX([BTVBubbleTypingTableViewCell height], 52); + + return [BTVBubbleTypingTableViewCell height]; } // Header if (indexPath.row == 0) { - return [UIBubbleHeaderTableViewCell height]; + return [BTVBubbleHeaderTableViewCell height]; } - NSBubbleData *data = [[self.bubbleSection objectAtIndex:indexPath.section] objectAtIndex:indexPath.row - 1]; - return MAX(data.insets.top + data.view.frame.size.height + data.insets.bottom, self.showAvatars ? 52 : 0); + BTVBubbleData *data = [[self.bubbleSection objectAtIndex:indexPath.section] objectAtIndex:indexPath.row - 1]; + + if(self.showUsernameLabel) + return MAX(data.insets.top + data.view.frame.size.height + data.insets.bottom, 78); + if(self.showAvatars) + return MAX(data.insets.top + data.view.frame.size.height + data.insets.bottom, 52); + + return (data.insets.top + data.view.frame.size.height + data.insets.bottom); } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath @@ -193,9 +221,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (indexPath.section >= [self.bubbleSection count]) { static NSString *cellId = @"tblBubbleTypingCell"; - UIBubbleTypingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; + BTVBubbleTypingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; - if (cell == nil) cell = [[UIBubbleTypingTableViewCell alloc] init]; + if (cell == nil) cell = [[[BTVBubbleTypingTableViewCell alloc] init] autorelease]; cell.type = self.typingBubble; cell.showAvatar = self.showAvatars; @@ -207,10 +235,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (indexPath.row == 0) { static NSString *cellId = @"tblBubbleHeaderCell"; - UIBubbleHeaderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; - NSBubbleData *data = [[self.bubbleSection objectAtIndex:indexPath.section] objectAtIndex:0]; + BTVBubbleHeaderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; + BTVBubbleData *data = [[self.bubbleSection objectAtIndex:indexPath.section] objectAtIndex:0]; - if (cell == nil) cell = [[UIBubbleHeaderTableViewCell alloc] init]; + if (cell == nil) cell = [[[BTVBubbleHeaderTableViewCell alloc] init] autorelease]; cell.date = data.date; @@ -218,11 +246,23 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } // Standard bubble - static NSString *cellId = @"tblBubbleCell"; - UIBubbleTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; - NSBubbleData *data = [[self.bubbleSection objectAtIndex:indexPath.section] objectAtIndex:indexPath.row - 1]; + BTVBubbleData *data = [[self.bubbleSection objectAtIndex:indexPath.section] objectAtIndex:indexPath.row - 1]; + + if(data.type == BubbleTypeInfo) + { + static NSString *cellId = @"tblBubbleHeaderCell"; + BTVBubbleHeaderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; + + if (cell == nil) cell = [[[BTVBubbleHeaderTableViewCell alloc] init] autorelease]; + + cell.info = data.text; + + return cell; + } - if (cell == nil) cell = [[UIBubbleTableViewCell alloc] init]; + static NSString *cellId = @"tblBubbleCell"; + BTVBubbleTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; + if (cell == nil) cell = [[[BTVBubbleTableViewCell alloc] init] autorelease]; cell.data = data; cell.showAvatar = self.showAvatars; diff --git a/src/UIBubbleTableViewCell.h b/src/BTVBubbleTableViewCell.h similarity index 75% rename from src/UIBubbleTableViewCell.h rename to src/BTVBubbleTableViewCell.h index 7d38287..3f88c34 100644 --- a/src/UIBubbleTableViewCell.h +++ b/src/BTVBubbleTableViewCell.h @@ -9,11 +9,11 @@ // #import -#import "NSBubbleData.h" +#import "BTVBubbleData.h" -@interface UIBubbleTableViewCell : UITableViewCell +@interface BTVBubbleTableViewCell : UITableViewCell -@property (nonatomic, strong) NSBubbleData *data; +@property (nonatomic, strong) BTVBubbleData *data; @property (nonatomic) BOOL showAvatar; @end diff --git a/src/UIBubbleTableViewCell.m b/src/BTVBubbleTableViewCell.m similarity index 71% rename from src/UIBubbleTableViewCell.m rename to src/BTVBubbleTableViewCell.m index 3aeaa1d..bb38262 100644 --- a/src/UIBubbleTableViewCell.m +++ b/src/BTVBubbleTableViewCell.m @@ -9,20 +9,21 @@ // #import -#import "UIBubbleTableViewCell.h" -#import "NSBubbleData.h" +#import "BTVBubbleTableViewCell.h" +#import "BTVBubbleData.h" -@interface UIBubbleTableViewCell () +@interface BTVBubbleTableViewCell () @property (nonatomic, retain) UIView *customView; @property (nonatomic, retain) UIImageView *bubbleImage; @property (nonatomic, retain) UIImageView *avatarImage; +@property (strong, nonatomic) UILabel *nameLabel; - (void) setupInternalData; @end -@implementation UIBubbleTableViewCell +@implementation BTVBubbleTableViewCell @synthesize data = _data; @synthesize customView = _customView; @@ -47,7 +48,7 @@ - (void) dealloc } #endif -- (void)setDataInternal:(NSBubbleData *)value +- (void)setDataInternal:(BTVBubbleData *)value { self.data = value; [self setupInternalData]; @@ -67,7 +68,7 @@ - (void) setupInternalData [self addSubview:self.bubbleImage]; } - NSBubbleType type = self.data.type; + BTVBubbleType type = self.data.type; CGFloat width = self.data.view.frame.size.width; CGFloat height = self.data.view.frame.size.height; @@ -101,10 +102,11 @@ - (void) setupInternalData if (type == BubbleTypeSomeoneElse) x += 54; if (type == BubbleTypeMine) x -= 54; } - + [self.customView removeFromSuperview]; self.customView = self.data.view; self.customView.frame = CGRectMake(x + self.data.insets.left, y + self.data.insets.top, width, height); + [self.contentView addSubview:self.customView]; if (type == BubbleTypeSomeoneElse) @@ -117,6 +119,27 @@ - (void) setupInternalData } self.bubbleImage.frame = CGRectMake(x, y, width + self.data.insets.left + self.data.insets.right, height + self.data.insets.top + self.data.insets.bottom); + + if(self.data.userLabel) + { + // adjust everything else to allow room for the label... + self.customView.center = CGPointMake(self.customView.center.x, self.customView.center.y - (self.avatarImage.frame.size.height/2)); + self.bubbleImage.center = CGPointMake(self.bubbleImage.center.x, self.bubbleImage.center.y - (self.avatarImage.frame.size.height/2)); + self.avatarImage.center = CGPointMake(self.avatarImage.center.x, self.avatarImage.center.y - (self.avatarImage.frame.size.height/2)); + + self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; + self.nameLabel.text = self.data.userLabel; + CGRect nameLabelFrame = self.avatarImage.frame; + nameLabelFrame.origin.y += self.avatarImage.frame.size.height; + nameLabelFrame.size.height = self.avatarImage.frame.size.height/2; + nameLabelFrame.size.width = self.bounds.size.width; + self.nameLabel.frame = nameLabelFrame; + self.nameLabel.textColor = [UIColor grayColor]; + self.nameLabel.textAlignment = NSTextAlignmentLeft; + self.nameLabel.font = [UIFont fontWithName:@"Avenir" size:14]; + [self addSubview:self.nameLabel]; + + } } @end diff --git a/src/UIBubbleTableViewDataSource.h b/src/BTVBubbleTableViewDataSource.h similarity index 59% rename from src/UIBubbleTableViewDataSource.h rename to src/BTVBubbleTableViewDataSource.h index 01194e7..9d41f2d 100644 --- a/src/UIBubbleTableViewDataSource.h +++ b/src/BTVBubbleTableViewDataSource.h @@ -10,15 +10,15 @@ #import -@class NSBubbleData; -@class UIBubbleTableView; -@protocol UIBubbleTableViewDataSource +@class BTVBubbleData; +@class BTVBubbleTableView; +@protocol BTVBubbleTableViewDataSource @optional @required -- (NSInteger)rowsForBubbleTable:(UIBubbleTableView *)tableView; -- (NSBubbleData *)bubbleTableView:(UIBubbleTableView *)tableView dataForRow:(NSInteger)row; +- (NSInteger)numberOfRowsForBubbleTable:(BTVBubbleTableView *)tableView; +- (BTVBubbleData *)bubbleTableView:(BTVBubbleTableView *)tableView dataForRow:(NSInteger)row; @end diff --git a/src/UIBubbleTypingTableViewCell.h b/src/BTVBubbleTypingTableViewCell.h similarity index 66% rename from src/UIBubbleTypingTableViewCell.h rename to src/BTVBubbleTypingTableViewCell.h index feda2e7..5ee70ed 100644 --- a/src/UIBubbleTypingTableViewCell.h +++ b/src/BTVBubbleTypingTableViewCell.h @@ -7,14 +7,14 @@ // #import -#import "UIBubbleTableView.h" +#import "BTVBubbleTableView.h" -@interface UIBubbleTypingTableViewCell : UITableViewCell +@interface BTVBubbleTypingTableViewCell : UITableViewCell + (CGFloat)height; -@property (nonatomic) NSBubbleTypingType type; +@property (nonatomic) BTVBubbleTypingType type; @property (nonatomic) BOOL showAvatar; @end diff --git a/src/UIBubbleTypingTableViewCell.m b/src/BTVBubbleTypingTableViewCell.m similarity index 80% rename from src/UIBubbleTypingTableViewCell.m rename to src/BTVBubbleTypingTableViewCell.m index 8a4018b..32e492a 100644 --- a/src/UIBubbleTypingTableViewCell.m +++ b/src/BTVBubbleTypingTableViewCell.m @@ -6,15 +6,15 @@ // Copyright (c) 2012 Stex Group. All rights reserved. // -#import "UIBubbleTypingTableViewCell.h" +#import "BTVBubbleTypingTableViewCell.h" -@interface UIBubbleTypingTableViewCell () +@interface BTVBubbleTypingTableViewCell () @property (nonatomic, retain) UIImageView *typingImageView; @end -@implementation UIBubbleTypingTableViewCell +@implementation BTVBubbleTypingTableViewCell @synthesize type = _type; @synthesize typingImageView = _typingImageView; @@ -25,11 +25,11 @@ + (CGFloat)height return 40.0; } -- (void)setType:(NSBubbleTypingType)value +- (void)setType:(BTVBubbleTypingType)value { if (!self.typingImageView) { - self.typingImageView = [[UIImageView alloc] init]; + self.typingImageView = [[[UIImageView alloc] init] autorelease]; [self addSubview:self.typingImageView]; } diff --git a/src/NSBubbleData.h b/src/NSBubbleData.h deleted file mode 100644 index e43c4af..0000000 --- a/src/NSBubbleData.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// NSBubbleData.h -// -// Created by Alex Barinov -// Project home page: http://alexbarinov.github.com/UIBubbleTableView/ -// -// This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. -// To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ -// - -#import - -typedef enum _NSBubbleType -{ - BubbleTypeMine = 0, - BubbleTypeSomeoneElse = 1 -} NSBubbleType; - -@interface NSBubbleData : NSObject - -@property (readonly, nonatomic, strong) NSDate *date; -@property (readonly, nonatomic) NSBubbleType type; -@property (readonly, nonatomic, strong) UIView *view; -@property (readonly, nonatomic) UIEdgeInsets insets; -@property (nonatomic, strong) UIImage *avatar; - -- (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type; -+ (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type; -- (id)initWithImage:(UIImage *)image date:(NSDate *)date type:(NSBubbleType)type; -+ (id)dataWithImage:(UIImage *)image date:(NSDate *)date type:(NSBubbleType)type; -- (id)initWithView:(UIView *)view date:(NSDate *)date type:(NSBubbleType)type insets:(UIEdgeInsets)insets; -+ (id)dataWithView:(UIView *)view date:(NSDate *)date type:(NSBubbleType)type insets:(UIEdgeInsets)insets; - -@end diff --git a/src/UIBubbleHeaderTableViewCell.m b/src/UIBubbleHeaderTableViewCell.m deleted file mode 100644 index 330e825..0000000 --- a/src/UIBubbleHeaderTableViewCell.m +++ /dev/null @@ -1,55 +0,0 @@ -// -// UIBubbleHeaderTableViewCell.m -// UIBubbleTableViewExample -// -// Created by Александр Баринов on 10/7/12. -// Copyright (c) 2012 Stex Group. All rights reserved. -// - -#import "UIBubbleHeaderTableViewCell.h" - -@interface UIBubbleHeaderTableViewCell () - -@property (nonatomic, retain) UILabel *label; - -@end - -@implementation UIBubbleHeaderTableViewCell - -@synthesize label = _label; -@synthesize date = _date; - -+ (CGFloat)height -{ - return 28.0; -} - -- (void)setDate:(NSDate *)value -{ - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; - [dateFormatter setDateStyle:NSDateFormatterMediumStyle]; - [dateFormatter setTimeStyle:NSDateFormatterShortStyle]; - NSString *text = [dateFormatter stringFromDate:value]; - [dateFormatter release]; - - if (self.label) - { - self.label.text = text; - return; - } - - self.selectionStyle = UITableViewCellSelectionStyleNone; - self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, [UIBubbleHeaderTableViewCell height])]; - self.label.text = text; - self.label.font = [UIFont boldSystemFontOfSize:12]; - self.label.textAlignment = UITextAlignmentCenter; - self.label.shadowOffset = CGSizeMake(0, 1); - self.label.shadowColor = [UIColor whiteColor]; - self.label.textColor = [UIColor darkGrayColor]; - self.label.backgroundColor = [UIColor clearColor]; - [self addSubview:self.label]; -} - - - -@end