Skip to content
This repository was archived by the owner on Mar 9, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions UIBubbleTableView.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Pod::Spec.new do |s|
s.name = "UIBubbleTableView"
s.version = "0.2.1"
s.summary = "Cocoa UI component for chat bubbles with avatars and images support."
s.homepage = "http://alexbarinov.github.com/UIBubbleTableView/"
s.license = {
:type => 'Creative Commons Attribution 3.0 Unported License',
:text => 'This work is licensed under the Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.'
}
s.author = { "Alex Barinov" => "github@alex.barinov.name" }
s.source = { :git => "https://github.com/fuJiin/UIBubbleTableView.git" }
s.source_files = 'src/**/*.{h,m}'
s.resources = "images/*.png"
end
Binary file added example/Default-568h@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions example/UIBubbleTableViewExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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 */; };
83DDB83E18777872001D626D /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83DDB83D18777872001D626D /* Default-568h@2x.png */; };
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 */; };
Expand Down Expand Up @@ -62,6 +63,7 @@
76ED208A15BF0BB100E186D3 /* NSBubbleData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NSBubbleData.m; path = ../../src/NSBubbleData.m; sourceTree = "<group>"; };
76ED209215BF29EE00E186D3 /* UIBubbleTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIBubbleTableViewCell.h; path = ../../src/UIBubbleTableViewCell.h; sourceTree = "<group>"; };
76ED209315BF29EE00E186D3 /* UIBubbleTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIBubbleTableViewCell.m; path = ../../src/UIBubbleTableViewCell.m; sourceTree = "<group>"; };
83DDB83D18777872001D626D /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
C836D5C81625CBA5004CB4A9 /* missingAvatar.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = missingAvatar.png; sourceTree = "<group>"; };
C836D5C91625CBA5004CB4A9 /* missingAvatar@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "missingAvatar@2x.png"; sourceTree = "<group>"; };
C836D5CD1625D718004CB4A9 /* avatar1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = avatar1.png; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -94,6 +96,7 @@
76ED205315BF096C00E186D3 = {
isa = PBXGroup;
children = (
83DDB83D18777872001D626D /* Default-568h@2x.png */,
76ED206815BF096C00E186D3 /* UIBubbleTableViewExample */,
76ED206115BF096C00E186D3 /* Frameworks */,
76ED205F15BF096C00E186D3 /* Products */,
Expand Down Expand Up @@ -242,6 +245,7 @@
C83B107A15DE43180067DADE /* bubbleMine@2x.png in Resources */,
C83B107B15DE43180067DADE /* bubbleSomeone.png in Resources */,
C83B107C15DE43180067DADE /* bubbleSomeone@2x.png in Resources */,
83DDB83E18777872001D626D /* Default-568h@2x.png in Resources */,
C83B107D15DE43180067DADE /* typingMine.png in Resources */,
C83B107E15DE43180067DADE /* typingMine@2x.png in Resources */,
C83B107F15DE43180067DADE /* typingSomeone.png in Resources */,
Expand Down
2 changes: 1 addition & 1 deletion example/UIBubbleTableViewExample/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface

#pragma mark - UIBubbleTableViewDataSource implementation

- (NSInteger)rowsForBubbleTable:(UIBubbleTableView *)tableView
- (NSUInteger)rowsForBubbleTable:(UIBubbleTableView *)tableView
{
return [bubbleData count];
}
Expand Down
2 changes: 1 addition & 1 deletion src/NSBubbleData.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ + (id)dataWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type
- (id)initWithText:(NSString *)text date:(NSDate *)date type:(NSBubbleType)type
{
UIFont *font = [UIFont systemFontOfSize:[UIFont systemFontSize]];
CGSize size = [(text ? text : @"") sizeWithFont:font constrainedToSize:CGSizeMake(220, 9999) lineBreakMode:NSLineBreakByWordWrapping];
CGSize size = [(text ? text : @"") boundingRectWithSize: CGSizeMake(220, 9999) options: NSStringDrawingUsesLineFragmentOrigin attributes: @{ NSFontAttributeName:font }context: nil].size;

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
label.numberOfLines = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/UIBubbleTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ - (void)reloadData
self.bubbleSection = nil;

// Loading new data
int count = 0;
NSUInteger count = 0;
#if !__has_feature(objc_arc)
self.bubbleSection = [[[NSMutableArray alloc] init] autorelease];
#else
Expand Down Expand Up @@ -156,7 +156,7 @@ - (void)reloadData

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
int result = [self.bubbleSection count];
NSInteger result = [self.bubbleSection count];
if (self.typingBubble != NSBubbleTypingTypeNobody) result++;
return result;
}
Expand All @@ -169,7 +169,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
return [[self.bubbleSection objectAtIndex:section] count] + 1;
}

- (float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Now typing
if (indexPath.section >= [self.bubbleSection count])
Expand Down
2 changes: 1 addition & 1 deletion src/UIBubbleTableViewDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

@required

- (NSInteger)rowsForBubbleTable:(UIBubbleTableView *)tableView;
- (NSUInteger)rowsForBubbleTable:(UIBubbleTableView *)tableView;
- (NSBubbleData *)bubbleTableView:(UIBubbleTableView *)tableView dataForRow:(NSInteger)row;

@end