├── .gitignore ├── .gitmodules ├── Classes ├── SSMessageTableViewCell.h ├── SSMessageTableViewCell.m ├── SSMessageTableViewCellBubbleView.h ├── SSMessageTableViewCellBubbleView.m ├── SSMessagesViewController.h └── SSMessagesViewController.m ├── Demo ├── Classes │ ├── MDAppDelegate.h │ ├── MDAppDelegate.m │ ├── MDDemoViewController.h │ └── MDDemoViewController.m ├── Messages Demo.xcodeproj │ └── project.pbxproj ├── Messages_Demo-Info.plist ├── Messages_Demo_Prefix.pch └── main.m ├── Images ├── SSMessageTableViewCellBackgroundClear.png ├── SSMessageTableViewCellBackgroundClear@2x.png ├── SSMessageTableViewCellBackgroundGreen.png ├── SSMessageTableViewCellBackgroundGreen@2x.png ├── SSMessagesViewControllerInputBackground.png ├── SSMessagesViewControllerInputBackground@2x.png ├── SSMessagesViewControllerSendButtonBackground.png ├── SSMessagesViewControllerSendButtonBackground@2x.png ├── SSMessagesViewControllerTextFieldBackground.png └── SSMessagesViewControllerTextFieldBackground@2x.png ├── LICENSE └── Readme.markdown /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build 3 | *.mode1v3 4 | *.pbxuser 5 | *.perspectivev3 6 | *.xcworkspace 7 | xcuserdata 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Demo/SSToolkit"] 2 | path = Demo/SSToolkit 3 | url = git://github.com/samsoffes/sstoolkit.git 4 | -------------------------------------------------------------------------------- /Classes/SSMessageTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSMessageTableViewCell.h 3 | // Messages 4 | // 5 | // Created by Sam Soffes on 3/10/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | typedef enum { 10 | SSMessageStyleLeft = 0, 11 | SSMessageStyleRight = 1 12 | } SSMessageStyle; 13 | 14 | @class SSMessageTableViewCellBubbleView; 15 | 16 | @interface SSMessageTableViewCell : UITableViewCell { 17 | 18 | @private 19 | 20 | SSMessageTableViewCellBubbleView *_bubbleView; 21 | } 22 | 23 | @property (nonatomic, copy) NSString *messageText; 24 | @property (nonatomic, assign) SSMessageStyle messageStyle; 25 | 26 | - (void)setBackgroundImage:(UIImage *)backgroundImage forMessageStyle:(SSMessageStyle)messsageStyle; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Classes/SSMessageTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSMessageTableViewCell.m 3 | // Messages 4 | // 5 | // Created by Sam Soffes on 3/10/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSMessageTableViewCell.h" 10 | #import "SSMessageTableViewCellBubbleView.h" 11 | 12 | @implementation SSMessageTableViewCell 13 | 14 | #pragma mark NSObject 15 | 16 | - (void)dealloc { 17 | [_bubbleView release]; 18 | [super dealloc]; 19 | } 20 | 21 | 22 | #pragma mark UITableViewCell 23 | 24 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 25 | if ((self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier])) { 26 | self.selectionStyle = UITableViewCellSelectionStyleNone; 27 | self.textLabel.hidden = YES; 28 | 29 | _bubbleView = [[SSMessageTableViewCellBubbleView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.contentView.frame.size.width, self.contentView.frame.size.height)]; 30 | _bubbleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 31 | [self.contentView addSubview:_bubbleView]; 32 | [self.contentView sendSubviewToBack:_bubbleView]; 33 | } 34 | return self; 35 | } 36 | 37 | 38 | #pragma mark Getters 39 | 40 | - (SSMessageStyle)messageStyle { 41 | return _bubbleView.messageStyle; 42 | } 43 | 44 | 45 | - (NSString *)messageText { 46 | return _bubbleView.messageText; 47 | } 48 | 49 | 50 | #pragma mark Setters 51 | 52 | - (void)setMessageStyle:(SSMessageStyle)aMessageStyle { 53 | _bubbleView.messageStyle = aMessageStyle; 54 | [_bubbleView setNeedsDisplay]; 55 | } 56 | 57 | 58 | - (void)setMessageText:(NSString *)text { 59 | _bubbleView.messageText = text; 60 | [_bubbleView setNeedsDisplay]; 61 | } 62 | 63 | 64 | - (void)setBackgroundImage:(UIImage *)backgroundImage forMessageStyle:(SSMessageStyle)messsageStyle { 65 | if (messsageStyle == SSMessageStyleLeft) { 66 | _bubbleView.leftBackgroundImage = backgroundImage; 67 | } else if (messsageStyle == SSMessageStyleRight) { 68 | _bubbleView.rightBackgroundImage = backgroundImage; 69 | } 70 | } 71 | @end 72 | -------------------------------------------------------------------------------- /Classes/SSMessageTableViewCellBubbleView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSMessageTableViewCellBubbleView.h 3 | // Messages 4 | // 5 | // Created by Sam Soffes on 3/10/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSMessageTableViewCell.h" 10 | 11 | @interface SSMessageTableViewCellBubbleView : UIView { 12 | 13 | @private 14 | 15 | NSString *_messageText; 16 | UIImage *_leftBackgroundImage; 17 | UIImage *_rightBackgroundImage; 18 | SSMessageStyle _messageStyle; 19 | } 20 | 21 | @property (nonatomic, copy) NSString *messageText; 22 | @property (nonatomic, retain) UIImage *leftBackgroundImage; 23 | @property (nonatomic, retain) UIImage *rightBackgroundImage; 24 | @property (nonatomic, assign) SSMessageStyle messageStyle; 25 | 26 | + (CGSize)textSizeForText:(NSString *)text; 27 | + (CGSize)bubbleSizeForText:(NSString *)text; 28 | + (CGFloat)cellHeightForText:(NSString *)text; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Classes/SSMessageTableViewCellBubbleView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSMessageTableViewCellBubbleView.m 3 | // Messages 4 | // 5 | // Created by Sam Soffes on 3/10/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSMessageTableViewCellBubbleView.h" 10 | 11 | #define kFont [UIFont systemFontOfSize:15.0] 12 | static UILineBreakMode kLineBreakMode = UILineBreakModeWordWrap; 13 | static CGFloat kMaxWidth = 223.0f; // TODO: Make dynamic 14 | static CGFloat kPaddingTop = 4.0f; 15 | static CGFloat kPaddingBottom = 8.0f; 16 | static CGFloat kMarginTop = 2.0f; 17 | static CGFloat kMarginBottom = 2.0f; 18 | 19 | @implementation SSMessageTableViewCellBubbleView 20 | 21 | @synthesize messageText = _messageText; 22 | @synthesize leftBackgroundImage = _leftBackgroundImage; 23 | @synthesize rightBackgroundImage = _rightBackgroundImage; 24 | @synthesize messageStyle = _messageStyle; 25 | 26 | #pragma mark Class Methods 27 | 28 | + (CGSize)textSizeForText:(NSString *)text { 29 | CGSize maxSize = CGSizeMake(kMaxWidth - 35.0f, 1000.0f); 30 | return [text sizeWithFont:kFont constrainedToSize:maxSize lineBreakMode:kLineBreakMode]; 31 | } 32 | 33 | 34 | + (CGSize)bubbleSizeForText:(NSString *)text { 35 | CGSize textSize = [self textSizeForText:text]; 36 | return CGSizeMake(textSize.width + 35.0f, textSize.height + kPaddingTop + kPaddingBottom); 37 | } 38 | 39 | 40 | + (CGFloat)cellHeightForText:(NSString *)text { 41 | return [self bubbleSizeForText:text].height + kMarginTop + kMarginBottom; 42 | } 43 | 44 | 45 | #pragma mark NSObject 46 | 47 | - (void)dealloc { 48 | [_messageText release]; 49 | [_leftBackgroundImage release]; 50 | [_rightBackgroundImage release]; 51 | [super dealloc]; 52 | } 53 | 54 | 55 | #pragma mark UIView 56 | 57 | - (id)initWithFrame:(CGRect)frame { 58 | if (self = [super initWithFrame:frame]) { 59 | self.backgroundColor = [UIColor colorWithRed:0.859f green:0.886f blue:0.929f alpha:1.0f]; 60 | } 61 | return self; 62 | } 63 | 64 | 65 | - (void)drawRect:(CGRect)frame { 66 | UIImage *bubbleImage = _messageStyle == SSMessageStyleLeft ? _leftBackgroundImage : _rightBackgroundImage; 67 | CGSize bubbleSize = [[self class] bubbleSizeForText:_messageText]; 68 | CGRect bubbleFrame = CGRectMake((_messageStyle == SSMessageStyleRight ? self.frame.size.width - bubbleSize.width : 0.0f), kMarginTop, bubbleSize.width, bubbleSize.height); 69 | [bubbleImage drawInRect:bubbleFrame]; 70 | 71 | CGSize textSize = [[self class] textSizeForText:_messageText]; 72 | CGFloat textX = (CGFloat)bubbleImage.leftCapWidth - 3.0f + ((_messageStyle == SSMessageStyleRight) ? bubbleFrame.origin.x : 0.0f); 73 | CGRect textFrame = CGRectMake(textX, kPaddingTop + kMarginTop, textSize.width, textSize.height); 74 | [_messageText drawInRect:textFrame withFont:kFont lineBreakMode:kLineBreakMode alignment:(_messageStyle == SSMessageStyleRight) ? UITextAlignmentRight : UITextAlignmentLeft]; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /Classes/SSMessagesViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSMessagesViewController.h 3 | // Messages 4 | // 5 | // Created by Sam Soffes on 3/10/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | // This is an abstract class for displaying a UI similar to Apple's SMS application. A subclass should override the 9 | // messageStyleForRowAtIndexPath: and textForRowAtIndexPath: to customize this class. 10 | // 11 | 12 | #import "SSMessageTableViewCell.h" 13 | 14 | @class SSTextField; 15 | 16 | @interface SSMessagesViewController : UIViewController { 17 | 18 | @private 19 | 20 | UITableView *_tableView; 21 | UIImageView *_inputBackgroundView; 22 | SSTextField *_textField; 23 | UIButton *_sendButton; 24 | 25 | UIImage *_leftBackgroundImage; 26 | UIImage *_rightBackgroundImage; 27 | } 28 | 29 | @property (nonatomic, retain, readonly) UITableView *tableView; 30 | @property (nonatomic, retain, readonly) UIImageView *inputBackgroundView; 31 | @property (nonatomic, retain, readonly) SSTextField *textField; 32 | @property (nonatomic, retain, readonly) UIButton *sendButton; 33 | @property (nonatomic, retain) UIImage *leftBackgroundImage; 34 | @property (nonatomic, retain) UIImage *rightBackgroundImage; 35 | 36 | - (SSMessageStyle)messageStyleForRowAtIndexPath:(NSIndexPath *)indexPath; 37 | - (NSString *)textForRowAtIndexPath:(NSIndexPath *)indexPath; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Classes/SSMessagesViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSMessagesViewController.m 3 | // Messages 4 | // 5 | // Created by Sam Soffes on 3/10/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSMessagesViewController.h" 10 | #import "SSMessageTableViewCell.h" 11 | #import "SSMessageTableViewCellBubbleView.h" 12 | #import 13 | 14 | CGFloat kInputHeight = 40.0f; 15 | 16 | @implementation SSMessagesViewController 17 | 18 | @synthesize tableView = _tableView; 19 | @synthesize inputBackgroundView = _inputBackgroundView; 20 | @synthesize textField = _textField; 21 | @synthesize sendButton = _sendButton; 22 | @synthesize leftBackgroundImage = _leftBackgroundImage; 23 | @synthesize rightBackgroundImage = _rightBackgroundImage; 24 | 25 | #pragma mark NSObject 26 | 27 | - (void)dealloc { 28 | self.leftBackgroundImage = nil; 29 | self.rightBackgroundImage = nil; 30 | [_tableView release]; 31 | [_inputBackgroundView release]; 32 | [_textField release]; 33 | [_sendButton release]; 34 | [super dealloc]; 35 | } 36 | 37 | 38 | #pragma mark UIViewController 39 | 40 | - (void)viewDidLoad { 41 | self.view.backgroundColor = [UIColor colorWithRed:0.859f green:0.886f blue:0.929f alpha:1.0f]; 42 | 43 | CGSize size = self.view.frame.size; 44 | 45 | // Table view 46 | _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, size.width, size.height - kInputHeight) style:UITableViewStylePlain]; 47 | _tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 48 | _tableView.backgroundColor = self.view.backgroundColor; 49 | _tableView.dataSource = self; 50 | _tableView.delegate = self; 51 | _tableView.separatorColor = self.view.backgroundColor; 52 | [self.view addSubview:_tableView]; 53 | 54 | // Input 55 | _inputBackgroundView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, size.height - kInputHeight, size.width, kInputHeight)]; 56 | _inputBackgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; 57 | _inputBackgroundView.image = [UIImage imageNamed:@"SSMessagesViewControllerInputBackground.png"]; 58 | _inputBackgroundView.userInteractionEnabled = YES; 59 | [self.view addSubview:_inputBackgroundView]; 60 | 61 | // Text field 62 | _textField = [[SSTextField alloc] initWithFrame:CGRectMake(6.0f, 0.0f, size.width - 75.0f, kInputHeight)]; 63 | _textField.autoresizingMask = UIViewAutoresizingFlexibleWidth; 64 | _textField.backgroundColor = [UIColor whiteColor]; 65 | _textField.background = [[UIImage imageNamed:@"SSMessagesViewControllerTextFieldBackground.png"] stretchableImageWithLeftCapWidth:12 topCapHeight:0]; 66 | _textField.delegate = self; 67 | _textField.font = [UIFont systemFontOfSize:15.0f]; 68 | _textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 69 | _textField.textEdgeInsets = UIEdgeInsetsMake(4.0f, 12.0f, 0.0f, 12.0f); 70 | [_inputBackgroundView addSubview:_textField]; 71 | 72 | // Send button 73 | _sendButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain]; 74 | _sendButton.frame = CGRectMake(size.width - 65.0f, 8.0f, 59.0f, 27.0f); 75 | _sendButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; 76 | _sendButton.titleLabel.font = [UIFont boldSystemFontOfSize:16.0f]; 77 | _sendButton.titleLabel.shadowOffset = CGSizeMake(0.0f, -1.0f); 78 | [_sendButton setBackgroundImage:[[UIImage imageNamed:@"SSMessagesViewControllerSendButtonBackground.png"] stretchableImageWithLeftCapWidth:12 topCapHeight:0] forState:UIControlStateNormal]; 79 | [_sendButton setTitle:@"Send" forState:UIControlStateNormal]; 80 | [_sendButton setTitleColor:[UIColor colorWithWhite:1.0f alpha:0.4f] forState:UIControlStateNormal]; 81 | [_sendButton setTitleShadowColor:[UIColor colorWithRed:0.325f green:0.463f blue:0.675f alpha:1.0f] forState:UIControlStateNormal]; 82 | [_inputBackgroundView addSubview:_sendButton]; 83 | 84 | self.leftBackgroundImage = [[UIImage imageNamed:@"SSMessageTableViewCellBackgroundClear.png"] stretchableImageWithLeftCapWidth:24 topCapHeight:14]; 85 | self.rightBackgroundImage = [[UIImage imageNamed:@"SSMessageTableViewCellBackgroundGreen.png"] stretchableImageWithLeftCapWidth:17 topCapHeight:14]; 86 | } 87 | 88 | 89 | #pragma mark SSMessagesViewController 90 | 91 | // This method is intended to be overridden by subclasses 92 | - (SSMessageStyle)messageStyleForRowAtIndexPath:(NSIndexPath *)indexPath { 93 | return SSMessageStyleLeft; 94 | } 95 | 96 | 97 | // This method is intended to be overridden by subclasses 98 | - (NSString *)textForRowAtIndexPath:(NSIndexPath *)indexPath { 99 | return nil; 100 | } 101 | 102 | 103 | #pragma mark UITableViewDataSource 104 | 105 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 106 | return 1; 107 | } 108 | 109 | 110 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 111 | return 0; 112 | } 113 | 114 | 115 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 116 | static NSString *cellIdentifier = @"cellIdentifier"; 117 | 118 | SSMessageTableViewCell *cell = (SSMessageTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 119 | if (cell == nil) { 120 | cell = [[[SSMessageTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease]; 121 | [cell setBackgroundImage:self.leftBackgroundImage forMessageStyle:SSMessageStyleLeft]; 122 | [cell setBackgroundImage:self.rightBackgroundImage forMessageStyle:SSMessageStyleRight]; 123 | } 124 | 125 | cell.messageStyle = [self messageStyleForRowAtIndexPath:indexPath]; 126 | cell.messageText = [self textForRowAtIndexPath:indexPath]; 127 | 128 | return cell; 129 | } 130 | 131 | 132 | #pragma mark UITableViewDelegate 133 | 134 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 135 | return [SSMessageTableViewCellBubbleView cellHeightForText:[self textForRowAtIndexPath:indexPath]]; 136 | } 137 | 138 | 139 | #pragma mark UITextFieldDelegate 140 | 141 | - (void)textFieldDidBeginEditing:(UITextField *)textField { 142 | [UIView beginAnimations:@"beginEditing" context:_inputBackgroundView]; 143 | [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 144 | [UIView setAnimationDuration:0.3f]; 145 | _tableView.contentInset = UIEdgeInsetsMake(0.0f, 0.0f, 216.0f, 0.0f); 146 | _tableView.scrollIndicatorInsets = _tableView.contentInset; 147 | _inputBackgroundView.frame = CGRectMake(0.0f, 160.0f, self.view.frame.size.width, kInputHeight); 148 | [_sendButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 149 | [UIView commitAnimations]; 150 | } 151 | 152 | 153 | - (void)textFieldDidEndEditing:(UITextField *)textField { 154 | [UIView beginAnimations:@"endEditing" context:_inputBackgroundView]; 155 | [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 156 | [UIView setAnimationDuration:0.3f]; 157 | _tableView.contentInset = UIEdgeInsetsZero; 158 | _tableView.scrollIndicatorInsets = UIEdgeInsetsZero; 159 | _inputBackgroundView.frame = CGRectMake(0.0f, _tableView.frame.size.height, self.view.frame.size.width, kInputHeight); 160 | [_sendButton setTitleColor:[UIColor colorWithWhite:1.0f alpha:0.4f] forState:UIControlStateNormal]; 161 | [UIView commitAnimations]; 162 | } 163 | 164 | @end 165 | -------------------------------------------------------------------------------- /Demo/Classes/MDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // MDAppDelegate.h 3 | // Messages Demo 4 | // 5 | // Created by Sam Soffes on 11/7/10. 6 | // Copyright 2010 Sam Soffes. All rights reserved. 7 | // 8 | 9 | @interface MDAppDelegate : NSObject { 10 | 11 | UIWindow *_window; 12 | } 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Demo/Classes/MDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // MDAppDelegate.m 3 | // Messages Demo 4 | // 5 | // Created by Sam Soffes on 11/7/10. 6 | // Copyright 2010 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "MDAppDelegate.h" 10 | #import "MDDemoViewController.h" 11 | 12 | @implementation MDAppDelegate 13 | 14 | #pragma mark NSObject 15 | 16 | - (void)dealloc { 17 | [_window release]; 18 | [super dealloc]; 19 | } 20 | 21 | 22 | #pragma mark UIApplicationDelegate 23 | 24 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 25 | MDDemoViewController *viewController = [[MDDemoViewController alloc] init]; 26 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; 27 | [viewController release]; 28 | 29 | _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 30 | _window.rootViewController = navigationController; 31 | [_window makeKeyAndVisible]; 32 | 33 | [navigationController release]; 34 | 35 | return YES; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Demo/Classes/MDDemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MDDemoViewController.h 3 | // Messages Demo 4 | // 5 | // Created by Sam Soffes on 11/7/10. 6 | // Copyright 2010 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSMessagesViewController.h" 10 | 11 | @interface MDDemoViewController : SSMessagesViewController { 12 | 13 | } 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Demo/Classes/MDDemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MDDemoViewController.m 3 | // Messages Demo 4 | // 5 | // Created by Sam Soffes on 11/7/10. 6 | // Copyright 2010 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "MDDemoViewController.h" 10 | #import "SSMessageTableViewCell.h" 11 | 12 | @implementation MDDemoViewController 13 | 14 | NSString *lorem[] = { 15 | @"Hi", 16 | @"This is a work in progress", 17 | @"Ya I know", 18 | @"Fine then\nI see how it is", 19 | @"Do you? Do you really?", 20 | @"Yes" 21 | }; 22 | 23 | #pragma mark UIViewController 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | self.title = @"Messages"; 28 | } 29 | 30 | 31 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 32 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { 33 | return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown; 34 | } 35 | return YES; 36 | } 37 | 38 | 39 | #pragma mark SSMessagesViewController 40 | 41 | - (SSMessageStyle)messageStyleForRowAtIndexPath:(NSIndexPath *)indexPath { 42 | if (indexPath.row % 2) { 43 | return SSMessageStyleRight; 44 | } 45 | return SSMessageStyleLeft; 46 | } 47 | 48 | 49 | - (NSString *)textForRowAtIndexPath:(NSIndexPath *)indexPath { 50 | return lorem[indexPath.row]; 51 | } 52 | 53 | 54 | #pragma mark UITableViewDataSource 55 | 56 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 57 | return sizeof(lorem) / sizeof(NSString *); 58 | } 59 | 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Demo/Messages Demo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D3623260D0F684500981E51 /* MDAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* MDAppDelegate.m */; }; 11 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 12 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 13 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 14 | 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; 15 | B27D0FC912878A3300B58D1D /* MDDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B27D0FC812878A3300B58D1D /* MDDemoViewController.m */; }; 16 | B27D0FD412878AA300B58D1D /* SSMessagesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B27D0FCF12878AA300B58D1D /* SSMessagesViewController.m */; }; 17 | B27D0FD512878AA300B58D1D /* SSMessageTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B27D0FD112878AA300B58D1D /* SSMessageTableViewCell.m */; }; 18 | B27D0FD612878AA300B58D1D /* SSMessageTableViewCellBubbleView.m in Sources */ = {isa = PBXBuildFile; fileRef = B27D0FD312878AA300B58D1D /* SSMessageTableViewCellBubbleView.m */; }; 19 | B27D0FF012878B2200B58D1D /* SSToolkit.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B27D0FEF12878B2200B58D1D /* SSToolkit.bundle */; }; 20 | B2FEFBE41366956C00B4D828 /* SSMessagesViewControllerInputBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = B2FEFBDA1366956C00B4D828 /* SSMessagesViewControllerInputBackground.png */; }; 21 | B2FEFBE51366956C00B4D828 /* SSMessagesViewControllerInputBackground@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B2FEFBDB1366956C00B4D828 /* SSMessagesViewControllerInputBackground@2x.png */; }; 22 | B2FEFBE61366956C00B4D828 /* SSMessagesViewControllerSendButtonBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = B2FEFBDC1366956C00B4D828 /* SSMessagesViewControllerSendButtonBackground.png */; }; 23 | B2FEFBE71366956C00B4D828 /* SSMessagesViewControllerSendButtonBackground@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B2FEFBDD1366956C00B4D828 /* SSMessagesViewControllerSendButtonBackground@2x.png */; }; 24 | B2FEFBE81366956C00B4D828 /* SSMessagesViewControllerTextFieldBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = B2FEFBDE1366956C00B4D828 /* SSMessagesViewControllerTextFieldBackground.png */; }; 25 | B2FEFBE91366956C00B4D828 /* SSMessagesViewControllerTextFieldBackground@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B2FEFBDF1366956C00B4D828 /* SSMessagesViewControllerTextFieldBackground@2x.png */; }; 26 | B2FEFBEA1366956C00B4D828 /* SSMessageTableViewCellBackgroundClear.png in Resources */ = {isa = PBXBuildFile; fileRef = B2FEFBE01366956C00B4D828 /* SSMessageTableViewCellBackgroundClear.png */; }; 27 | B2FEFBEB1366956C00B4D828 /* SSMessageTableViewCellBackgroundClear@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B2FEFBE11366956C00B4D828 /* SSMessageTableViewCellBackgroundClear@2x.png */; }; 28 | B2FEFBEC1366956C00B4D828 /* SSMessageTableViewCellBackgroundGreen.png in Resources */ = {isa = PBXBuildFile; fileRef = B2FEFBE21366956C00B4D828 /* SSMessageTableViewCellBackgroundGreen.png */; }; 29 | B2FEFBED1366956C00B4D828 /* SSMessageTableViewCellBackgroundGreen@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B2FEFBE31366956C00B4D828 /* SSMessageTableViewCellBackgroundGreen@2x.png */; }; 30 | C94A5254134B0730004C7881 /* libSSToolkit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C94A5238134B05DB004C7881 /* libSSToolkit.a */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXContainerItemProxy section */ 34 | C94A5237134B05DB004C7881 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = B27D0FE412878B1900B58D1D /* SSToolkit.xcodeproj */; 37 | proxyType = 2; 38 | remoteGlobalIDString = D2AAC07E0554694100DB518D; 39 | remoteInfo = SSToolkit; 40 | }; 41 | C94A524F134B06D3004C7881 /* PBXContainerItemProxy */ = { 42 | isa = PBXContainerItemProxy; 43 | containerPortal = B27D0FE412878B1900B58D1D /* SSToolkit.xcodeproj */; 44 | proxyType = 1; 45 | remoteGlobalIDString = D2AAC07D0554694100DB518D; 46 | remoteInfo = SSToolkit; 47 | }; 48 | /* End PBXContainerItemProxy section */ 49 | 50 | /* Begin PBXFileReference section */ 51 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 52 | 1D3623240D0F684500981E51 /* MDAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MDAppDelegate.h; sourceTree = ""; }; 53 | 1D3623250D0F684500981E51 /* MDAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MDAppDelegate.m; sourceTree = ""; }; 54 | 1D6058910D05DD3D006BFB54 /* Messages Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Messages Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 56 | 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 57 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 58 | 32CA4F630368D1EE00C91783 /* Messages_Demo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Messages_Demo_Prefix.pch; sourceTree = ""; }; 59 | 8D1107310486CEB800E47090 /* Messages_Demo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Messages_Demo-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; 60 | B27D0FC712878A3300B58D1D /* MDDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MDDemoViewController.h; sourceTree = ""; }; 61 | B27D0FC812878A3300B58D1D /* MDDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MDDemoViewController.m; sourceTree = ""; }; 62 | B27D0FCE12878AA300B58D1D /* SSMessagesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SSMessagesViewController.h; path = ../Classes/SSMessagesViewController.h; sourceTree = ""; }; 63 | B27D0FCF12878AA300B58D1D /* SSMessagesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SSMessagesViewController.m; path = ../Classes/SSMessagesViewController.m; sourceTree = ""; }; 64 | B27D0FD012878AA300B58D1D /* SSMessageTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SSMessageTableViewCell.h; path = ../Classes/SSMessageTableViewCell.h; sourceTree = ""; }; 65 | B27D0FD112878AA300B58D1D /* SSMessageTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SSMessageTableViewCell.m; path = ../Classes/SSMessageTableViewCell.m; sourceTree = ""; }; 66 | B27D0FD212878AA300B58D1D /* SSMessageTableViewCellBubbleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SSMessageTableViewCellBubbleView.h; path = ../Classes/SSMessageTableViewCellBubbleView.h; sourceTree = ""; }; 67 | B27D0FD312878AA300B58D1D /* SSMessageTableViewCellBubbleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SSMessageTableViewCellBubbleView.m; path = ../Classes/SSMessageTableViewCellBubbleView.m; sourceTree = ""; }; 68 | B27D0FE412878B1900B58D1D /* SSToolkit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SSToolkit.xcodeproj; path = ../SSToolkit/SSToolkit.xcodeproj; sourceTree = ""; }; 69 | B27D0FEF12878B2200B58D1D /* SSToolkit.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = SSToolkit.bundle; path = SSToolkit/Resources/SSToolkit.bundle; sourceTree = ""; }; 70 | B2FEFBDA1366956C00B4D828 /* SSMessagesViewControllerInputBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SSMessagesViewControllerInputBackground.png; sourceTree = ""; }; 71 | B2FEFBDB1366956C00B4D828 /* SSMessagesViewControllerInputBackground@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "SSMessagesViewControllerInputBackground@2x.png"; sourceTree = ""; }; 72 | B2FEFBDC1366956C00B4D828 /* SSMessagesViewControllerSendButtonBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SSMessagesViewControllerSendButtonBackground.png; sourceTree = ""; }; 73 | B2FEFBDD1366956C00B4D828 /* SSMessagesViewControllerSendButtonBackground@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "SSMessagesViewControllerSendButtonBackground@2x.png"; sourceTree = ""; }; 74 | B2FEFBDE1366956C00B4D828 /* SSMessagesViewControllerTextFieldBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SSMessagesViewControllerTextFieldBackground.png; sourceTree = ""; }; 75 | B2FEFBDF1366956C00B4D828 /* SSMessagesViewControllerTextFieldBackground@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "SSMessagesViewControllerTextFieldBackground@2x.png"; sourceTree = ""; }; 76 | B2FEFBE01366956C00B4D828 /* SSMessageTableViewCellBackgroundClear.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SSMessageTableViewCellBackgroundClear.png; sourceTree = ""; }; 77 | B2FEFBE11366956C00B4D828 /* SSMessageTableViewCellBackgroundClear@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "SSMessageTableViewCellBackgroundClear@2x.png"; sourceTree = ""; }; 78 | B2FEFBE21366956C00B4D828 /* SSMessageTableViewCellBackgroundGreen.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = SSMessageTableViewCellBackgroundGreen.png; sourceTree = ""; }; 79 | B2FEFBE31366956C00B4D828 /* SSMessageTableViewCellBackgroundGreen@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "SSMessageTableViewCellBackgroundGreen@2x.png"; sourceTree = ""; }; 80 | /* End PBXFileReference section */ 81 | 82 | /* Begin PBXFrameworksBuildPhase section */ 83 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 84 | isa = PBXFrameworksBuildPhase; 85 | buildActionMask = 2147483647; 86 | files = ( 87 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 88 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 89 | 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */, 90 | C94A5254134B0730004C7881 /* libSSToolkit.a in Frameworks */, 91 | ); 92 | runOnlyForDeploymentPostprocessing = 0; 93 | }; 94 | /* End PBXFrameworksBuildPhase section */ 95 | 96 | /* Begin PBXGroup section */ 97 | 080E96DDFE201D6D7F000001 /* Demo */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | B27D0FE412878B1900B58D1D /* SSToolkit.xcodeproj */, 101 | 1D3623240D0F684500981E51 /* MDAppDelegate.h */, 102 | 1D3623250D0F684500981E51 /* MDAppDelegate.m */, 103 | B27D0FC712878A3300B58D1D /* MDDemoViewController.h */, 104 | B27D0FC812878A3300B58D1D /* MDDemoViewController.m */, 105 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 106 | 29B97317FDCFA39411CA2CEA /* Resources */, 107 | ); 108 | name = Demo; 109 | path = Classes; 110 | sourceTree = ""; 111 | }; 112 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 1D6058910D05DD3D006BFB54 /* Messages Demo.app */, 116 | ); 117 | name = Products; 118 | sourceTree = ""; 119 | }; 120 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | B2FEFAEC136686E400B4D828 /* SSMessagesViewController */, 124 | 080E96DDFE201D6D7F000001 /* Demo */, 125 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 126 | 19C28FACFE9D520D11CA2CBB /* Products */, 127 | ); 128 | name = CustomTemplate; 129 | sourceTree = ""; 130 | }; 131 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 32CA4F630368D1EE00C91783 /* Messages_Demo_Prefix.pch */, 135 | 29B97316FDCFA39411CA2CEA /* main.m */, 136 | ); 137 | name = "Other Sources"; 138 | path = ..; 139 | sourceTree = ""; 140 | }; 141 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | B27D0FEF12878B2200B58D1D /* SSToolkit.bundle */, 145 | 8D1107310486CEB800E47090 /* Messages_Demo-Info.plist */, 146 | ); 147 | name = Resources; 148 | path = ..; 149 | sourceTree = ""; 150 | }; 151 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 155 | 1D30AB110D05D00D00671497 /* Foundation.framework */, 156 | 288765FC0DF74451002DB57D /* CoreGraphics.framework */, 157 | ); 158 | name = Frameworks; 159 | sourceTree = ""; 160 | }; 161 | B27D0FD712878AAB00B58D1D /* Images */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | B2FEFBDA1366956C00B4D828 /* SSMessagesViewControllerInputBackground.png */, 165 | B2FEFBDB1366956C00B4D828 /* SSMessagesViewControllerInputBackground@2x.png */, 166 | B2FEFBDC1366956C00B4D828 /* SSMessagesViewControllerSendButtonBackground.png */, 167 | B2FEFBDD1366956C00B4D828 /* SSMessagesViewControllerSendButtonBackground@2x.png */, 168 | B2FEFBDE1366956C00B4D828 /* SSMessagesViewControllerTextFieldBackground.png */, 169 | B2FEFBDF1366956C00B4D828 /* SSMessagesViewControllerTextFieldBackground@2x.png */, 170 | B2FEFBE01366956C00B4D828 /* SSMessageTableViewCellBackgroundClear.png */, 171 | B2FEFBE11366956C00B4D828 /* SSMessageTableViewCellBackgroundClear@2x.png */, 172 | B2FEFBE21366956C00B4D828 /* SSMessageTableViewCellBackgroundGreen.png */, 173 | B2FEFBE31366956C00B4D828 /* SSMessageTableViewCellBackgroundGreen@2x.png */, 174 | ); 175 | name = Images; 176 | path = ../Images; 177 | sourceTree = ""; 178 | }; 179 | B2FEFAEC136686E400B4D828 /* SSMessagesViewController */ = { 180 | isa = PBXGroup; 181 | children = ( 182 | B27D0FCE12878AA300B58D1D /* SSMessagesViewController.h */, 183 | B27D0FCF12878AA300B58D1D /* SSMessagesViewController.m */, 184 | B27D0FD012878AA300B58D1D /* SSMessageTableViewCell.h */, 185 | B27D0FD112878AA300B58D1D /* SSMessageTableViewCell.m */, 186 | B27D0FD212878AA300B58D1D /* SSMessageTableViewCellBubbleView.h */, 187 | B27D0FD312878AA300B58D1D /* SSMessageTableViewCellBubbleView.m */, 188 | B27D0FD712878AAB00B58D1D /* Images */, 189 | ); 190 | name = SSMessagesViewController; 191 | sourceTree = ""; 192 | }; 193 | C94A5234134B05DB004C7881 /* Products */ = { 194 | isa = PBXGroup; 195 | children = ( 196 | C94A5238134B05DB004C7881 /* libSSToolkit.a */, 197 | ); 198 | name = Products; 199 | sourceTree = ""; 200 | }; 201 | /* End PBXGroup section */ 202 | 203 | /* Begin PBXNativeTarget section */ 204 | 1D6058900D05DD3D006BFB54 /* Messages Demo */ = { 205 | isa = PBXNativeTarget; 206 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Messages Demo" */; 207 | buildPhases = ( 208 | 1D60588D0D05DD3D006BFB54 /* Resources */, 209 | 1D60588E0D05DD3D006BFB54 /* Sources */, 210 | 1D60588F0D05DD3D006BFB54 /* Frameworks */, 211 | ); 212 | buildRules = ( 213 | ); 214 | dependencies = ( 215 | C94A5250134B06D3004C7881 /* PBXTargetDependency */, 216 | ); 217 | name = "Messages Demo"; 218 | productName = "Messages Demo"; 219 | productReference = 1D6058910D05DD3D006BFB54 /* Messages Demo.app */; 220 | productType = "com.apple.product-type.application"; 221 | }; 222 | /* End PBXNativeTarget section */ 223 | 224 | /* Begin PBXProject section */ 225 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 226 | isa = PBXProject; 227 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Messages Demo" */; 228 | compatibilityVersion = "Xcode 3.1"; 229 | developmentRegion = English; 230 | hasScannedForEncodings = 1; 231 | knownRegions = ( 232 | English, 233 | Japanese, 234 | French, 235 | German, 236 | ); 237 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; 238 | projectDirPath = ""; 239 | projectReferences = ( 240 | { 241 | ProductGroup = C94A5234134B05DB004C7881 /* Products */; 242 | ProjectRef = B27D0FE412878B1900B58D1D /* SSToolkit.xcodeproj */; 243 | }, 244 | ); 245 | projectRoot = ""; 246 | targets = ( 247 | 1D6058900D05DD3D006BFB54 /* Messages Demo */, 248 | ); 249 | }; 250 | /* End PBXProject section */ 251 | 252 | /* Begin PBXReferenceProxy section */ 253 | C94A5238134B05DB004C7881 /* libSSToolkit.a */ = { 254 | isa = PBXReferenceProxy; 255 | fileType = archive.ar; 256 | path = libSSToolkit.a; 257 | remoteRef = C94A5237134B05DB004C7881 /* PBXContainerItemProxy */; 258 | sourceTree = BUILT_PRODUCTS_DIR; 259 | }; 260 | /* End PBXReferenceProxy section */ 261 | 262 | /* Begin PBXResourcesBuildPhase section */ 263 | 1D60588D0D05DD3D006BFB54 /* Resources */ = { 264 | isa = PBXResourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | B27D0FF012878B2200B58D1D /* SSToolkit.bundle in Resources */, 268 | B2FEFBE41366956C00B4D828 /* SSMessagesViewControllerInputBackground.png in Resources */, 269 | B2FEFBE51366956C00B4D828 /* SSMessagesViewControllerInputBackground@2x.png in Resources */, 270 | B2FEFBE61366956C00B4D828 /* SSMessagesViewControllerSendButtonBackground.png in Resources */, 271 | B2FEFBE71366956C00B4D828 /* SSMessagesViewControllerSendButtonBackground@2x.png in Resources */, 272 | B2FEFBE81366956C00B4D828 /* SSMessagesViewControllerTextFieldBackground.png in Resources */, 273 | B2FEFBE91366956C00B4D828 /* SSMessagesViewControllerTextFieldBackground@2x.png in Resources */, 274 | B2FEFBEA1366956C00B4D828 /* SSMessageTableViewCellBackgroundClear.png in Resources */, 275 | B2FEFBEB1366956C00B4D828 /* SSMessageTableViewCellBackgroundClear@2x.png in Resources */, 276 | B2FEFBEC1366956C00B4D828 /* SSMessageTableViewCellBackgroundGreen.png in Resources */, 277 | B2FEFBED1366956C00B4D828 /* SSMessageTableViewCellBackgroundGreen@2x.png in Resources */, 278 | ); 279 | runOnlyForDeploymentPostprocessing = 0; 280 | }; 281 | /* End PBXResourcesBuildPhase section */ 282 | 283 | /* Begin PBXSourcesBuildPhase section */ 284 | 1D60588E0D05DD3D006BFB54 /* Sources */ = { 285 | isa = PBXSourcesBuildPhase; 286 | buildActionMask = 2147483647; 287 | files = ( 288 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 289 | 1D3623260D0F684500981E51 /* MDAppDelegate.m in Sources */, 290 | B27D0FC912878A3300B58D1D /* MDDemoViewController.m in Sources */, 291 | B27D0FD412878AA300B58D1D /* SSMessagesViewController.m in Sources */, 292 | B27D0FD512878AA300B58D1D /* SSMessageTableViewCell.m in Sources */, 293 | B27D0FD612878AA300B58D1D /* SSMessageTableViewCellBubbleView.m in Sources */, 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | /* End PBXSourcesBuildPhase section */ 298 | 299 | /* Begin PBXTargetDependency section */ 300 | C94A5250134B06D3004C7881 /* PBXTargetDependency */ = { 301 | isa = PBXTargetDependency; 302 | name = SSToolkit; 303 | targetProxy = C94A524F134B06D3004C7881 /* PBXContainerItemProxy */; 304 | }; 305 | /* End PBXTargetDependency section */ 306 | 307 | /* Begin XCBuildConfiguration section */ 308 | 1D6058940D05DD3E006BFB54 /* Debug */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | ALWAYS_SEARCH_USER_PATHS = NO; 312 | COPY_PHASE_STRIP = NO; 313 | GCC_DYNAMIC_NO_PIC = NO; 314 | GCC_OPTIMIZATION_LEVEL = 0; 315 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 316 | GCC_PREFIX_HEADER = Messages_Demo_Prefix.pch; 317 | HEADER_SEARCH_PATHS = SSToolkit; 318 | INFOPLIST_FILE = "Messages_Demo-Info.plist"; 319 | IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; 320 | PRODUCT_NAME = "Messages Demo"; 321 | }; 322 | name = Debug; 323 | }; 324 | 1D6058950D05DD3E006BFB54 /* Release */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | COPY_PHASE_STRIP = YES; 329 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 330 | GCC_PREFIX_HEADER = Messages_Demo_Prefix.pch; 331 | HEADER_SEARCH_PATHS = SSToolkit; 332 | INFOPLIST_FILE = "Messages_Demo-Info.plist"; 333 | IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; 334 | PRODUCT_NAME = "Messages Demo"; 335 | VALIDATE_PRODUCT = YES; 336 | }; 337 | name = Release; 338 | }; 339 | C01FCF4F08A954540054247B /* Debug */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 343 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 344 | GCC_C_LANGUAGE_STANDARD = c99; 345 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 346 | GCC_WARN_UNUSED_VARIABLE = YES; 347 | PREBINDING = NO; 348 | SDKROOT = iphoneos; 349 | }; 350 | name = Debug; 351 | }; 352 | C01FCF5008A954540054247B /* Release */ = { 353 | isa = XCBuildConfiguration; 354 | buildSettings = { 355 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 356 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 357 | GCC_C_LANGUAGE_STANDARD = c99; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 359 | GCC_WARN_UNUSED_VARIABLE = YES; 360 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 361 | PREBINDING = NO; 362 | SDKROOT = iphoneos; 363 | }; 364 | name = Release; 365 | }; 366 | /* End XCBuildConfiguration section */ 367 | 368 | /* Begin XCConfigurationList section */ 369 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Messages Demo" */ = { 370 | isa = XCConfigurationList; 371 | buildConfigurations = ( 372 | 1D6058940D05DD3E006BFB54 /* Debug */, 373 | 1D6058950D05DD3E006BFB54 /* Release */, 374 | ); 375 | defaultConfigurationIsVisible = 0; 376 | defaultConfigurationName = Release; 377 | }; 378 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Messages Demo" */ = { 379 | isa = XCConfigurationList; 380 | buildConfigurations = ( 381 | C01FCF4F08A954540054247B /* Debug */, 382 | C01FCF5008A954540054247B /* Release */, 383 | ); 384 | defaultConfigurationIsVisible = 0; 385 | defaultConfigurationName = Release; 386 | }; 387 | /* End XCConfigurationList section */ 388 | }; 389 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 390 | } 391 | -------------------------------------------------------------------------------- /Demo/Messages_Demo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.samsoffes.ssmessagesviewcontroller.demo 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Demo/Messages_Demo_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Messages_Demo_Prefix.pch 3 | // Messages Demo 4 | // 5 | // Created by Sam Soffes on 11/7/10. 6 | // Copyright 2010 Sam Soffes. All rights reserved. 7 | // 8 | // Prefix header for all source files of the 'Messages Demo' target in the 'Messages Demo' project 9 | // 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Messages Demo 4 | // 5 | // Created by Sam Soffes on 11/7/10. 6 | // Copyright 2010 Sam Soffes. All rights reserved. 7 | // 8 | 9 | int main(int argc, char *argv[]) { 10 | 11 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 12 | int retVal = UIApplicationMain(argc, argv, nil, @"MDAppDelegate"); 13 | [pool release]; 14 | return retVal; 15 | } 16 | -------------------------------------------------------------------------------- /Images/SSMessageTableViewCellBackgroundClear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soffes/ssmessagesviewcontroller/c2f226668cfe6fe1d04ed701bb68d2985c61e78a/Images/SSMessageTableViewCellBackgroundClear.png -------------------------------------------------------------------------------- /Images/SSMessageTableViewCellBackgroundClear@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soffes/ssmessagesviewcontroller/c2f226668cfe6fe1d04ed701bb68d2985c61e78a/Images/SSMessageTableViewCellBackgroundClear@2x.png -------------------------------------------------------------------------------- /Images/SSMessageTableViewCellBackgroundGreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soffes/ssmessagesviewcontroller/c2f226668cfe6fe1d04ed701bb68d2985c61e78a/Images/SSMessageTableViewCellBackgroundGreen.png -------------------------------------------------------------------------------- /Images/SSMessageTableViewCellBackgroundGreen@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soffes/ssmessagesviewcontroller/c2f226668cfe6fe1d04ed701bb68d2985c61e78a/Images/SSMessageTableViewCellBackgroundGreen@2x.png -------------------------------------------------------------------------------- /Images/SSMessagesViewControllerInputBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soffes/ssmessagesviewcontroller/c2f226668cfe6fe1d04ed701bb68d2985c61e78a/Images/SSMessagesViewControllerInputBackground.png -------------------------------------------------------------------------------- /Images/SSMessagesViewControllerInputBackground@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soffes/ssmessagesviewcontroller/c2f226668cfe6fe1d04ed701bb68d2985c61e78a/Images/SSMessagesViewControllerInputBackground@2x.png -------------------------------------------------------------------------------- /Images/SSMessagesViewControllerSendButtonBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soffes/ssmessagesviewcontroller/c2f226668cfe6fe1d04ed701bb68d2985c61e78a/Images/SSMessagesViewControllerSendButtonBackground.png -------------------------------------------------------------------------------- /Images/SSMessagesViewControllerSendButtonBackground@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soffes/ssmessagesviewcontroller/c2f226668cfe6fe1d04ed701bb68d2985c61e78a/Images/SSMessagesViewControllerSendButtonBackground@2x.png -------------------------------------------------------------------------------- /Images/SSMessagesViewControllerTextFieldBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soffes/ssmessagesviewcontroller/c2f226668cfe6fe1d04ed701bb68d2985c61e78a/Images/SSMessagesViewControllerTextFieldBackground.png -------------------------------------------------------------------------------- /Images/SSMessagesViewControllerTextFieldBackground@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soffes/ssmessagesviewcontroller/c2f226668cfe6fe1d04ed701bb68d2985c61e78a/Images/SSMessagesViewControllerTextFieldBackground@2x.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2011 Sam Soffes 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Readme.markdown: -------------------------------------------------------------------------------- 1 | # SSMessagesViewController 2 | 3 | Simple message UI like Messages.app. I started writing this to create an in-app SMS feature for a client. Since Apple has made in-app SMS part of UI, I removed this from [SSToolkit](http://sstoolk.it). 4 | 5 | ## Running the Demo 6 | 7 | You'll need to get SSToolkit first: 8 | 9 | $ git submodule update --init 10 | 11 | Then you can just open Xcode and build away. Enjoy. 12 | --------------------------------------------------------------------------------