├── .gitignore ├── Classes ├── .gitignore ├── HPGrowingTextView.h ├── HPGrowingTextView.m ├── HPTextViewInternal.h ├── HPTextViewInternal.m ├── PESMSLabel.h ├── PESMSLabel.m ├── PESMSScrollView.h ├── PESMSScrollView.m ├── PESMSTextArea.h ├── PESMSTextArea.m ├── PESMSTextLabel.h ├── PESMSTextLabel.m ├── TiSmsviewModule.h ├── TiSmsviewModule.m ├── TiSmsviewModuleAssets.h ├── TiSmsviewModuleAssets.m ├── TiSmsviewView.h ├── TiSmsviewView.m ├── TiSmsviewViewProxy.h └── TiSmsviewViewProxy.m ├── LICENSE ├── README ├── TiSmsview_Prefix.pch ├── assets ├── .DS_Store └── README ├── build.py ├── documentation ├── index.md └── smsview.md ├── example ├── app.js └── assets │ └── smsview.bundle │ ├── BlueBalloonLeft.png │ ├── BlueBalloonRight.png │ ├── GrayBalloonLeft.png │ ├── GrayBalloonRight.png │ ├── GreenBalloonLeft.png │ ├── GreenBalloonRight.png │ ├── MessageEntryBackground.png │ ├── MessageEntryBackground@2x.png │ ├── MessageEntryInputField.png │ ├── MessageEntryInputField@2x.png │ ├── MessageEntrySendButton.png │ ├── MessageEntrySendButton@2x.png │ ├── MessageEntrySendButtonPressed.png │ ├── MessageEntrySendButtonPressed@2x.png │ ├── PurpleBalloonLeft.png │ ├── PurpleBalloonRight.png │ ├── WhiteBalloonLeft.png │ ├── WhiteBalloonRight.png │ ├── cameraButtonN.png │ ├── cameraButtonN@2x.png │ ├── cameraButtonP.png │ └── cameraButtonP@2x.png ├── hooks ├── README ├── add.py ├── install.py ├── remove.py └── uninstall.py ├── manifest ├── module.xcconfig ├── platform └── README ├── screenshots ├── five.png ├── four.png ├── one.png ├── six.png ├── three.png └── two.png ├── textfield.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── penrique.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── penrique.xcuserdatad │ ├── xcdebugger │ └── Breakpoints.xcbkptlist │ └── xcschemes │ ├── Build & Test.xcscheme │ ├── textfield.xcscheme │ └── xcschememanagement.plist ├── timodule.xml └── titanium.xcconfig /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | tmp 3 | bin 4 | build 5 | dist 6 | *.zip 7 | modules 8 | .apt_generated 9 | build.properties 10 | .svn 11 | *.pyc 12 | *~.nib/ 13 | *.pbxuser 14 | *.perspective 15 | *.perspectivev3 16 | *.xcworkspace/ 17 | xcuserdata 18 | *.xcuserstate 19 | *.xcuserdata* 20 | .idea/ 21 | -------------------------------------------------------------------------------- /Classes/.gitignore: -------------------------------------------------------------------------------- 1 | PecTf.h 2 | PecTf.m 3 | -------------------------------------------------------------------------------- /Classes/HPGrowingTextView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HPTextView.h 3 | // 4 | // Created by Hans Pinckaers on 29-06-10. 5 | // 6 | // MIT License 7 | // 8 | // Copyright (c) 2011 Hans Pinckaers 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to deal 12 | // in the Software without restriction, including without limitation the rights 13 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | // copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | // THE SOFTWARE. 27 | 28 | #import 29 | 30 | @class HPGrowingTextView; 31 | @class HPTextViewInternal; 32 | 33 | @protocol HPGrowingTextViewDelegate 34 | 35 | @optional 36 | - (BOOL)growingTextViewShouldBeginEditing:(HPGrowingTextView *)growingTextView; 37 | - (BOOL)growingTextViewShouldEndEditing:(HPGrowingTextView *)growingTextView; 38 | 39 | - (void)growingTextViewDidBeginEditing:(HPGrowingTextView *)growingTextView; 40 | - (void)growingTextViewDidEndEditing:(HPGrowingTextView *)growingTextView; 41 | 42 | - (BOOL)growingTextView:(HPGrowingTextView *)growingTextView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; 43 | - (void)growingTextViewDidChange:(HPGrowingTextView *)growingTextView; 44 | 45 | - (void)growingTextView:(HPGrowingTextView *)growingTextView willChangeHeight:(float)height; 46 | - (void)growingTextView:(HPGrowingTextView *)growingTextView didChangeHeight:(float)height; 47 | 48 | - (void)growingTextViewDidChangeSelection:(HPGrowingTextView *)growingTextView; 49 | - (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView; 50 | @end 51 | 52 | @interface HPGrowingTextView : UIView { 53 | HPTextViewInternal *internalTextView; 54 | 55 | int minHeight; 56 | int maxHeight; 57 | 58 | //class properties 59 | int maxNumberOfLines; 60 | int minNumberOfLines; 61 | 62 | BOOL animateHeightChange; 63 | 64 | //uitextview properties 65 | NSObject *delegate; 66 | NSString *text; 67 | UIFont *font; 68 | UIColor *textColor; 69 | UITextAlignment textAlignment; 70 | NSRange selectedRange; 71 | BOOL editable; 72 | UIDataDetectorTypes dataDetectorTypes; 73 | UIReturnKeyType returnKeyType; 74 | 75 | UIEdgeInsets contentInset; 76 | } 77 | 78 | //real class properties 79 | @property int maxNumberOfLines; 80 | @property int minNumberOfLines; 81 | @property BOOL animateHeightChange; 82 | @property (retain) UITextView *internalTextView; 83 | 84 | 85 | //uitextview properties 86 | @property(assign) NSObject *delegate; 87 | @property(nonatomic,assign) NSString *text; 88 | @property(nonatomic,assign) UIFont *font; 89 | @property(nonatomic,assign) UIColor *textColor; 90 | @property(nonatomic) UITextAlignment textAlignment; // default is UITextAlignmentLeft 91 | @property(nonatomic) NSRange selectedRange; // only ranges of length 0 are supported 92 | @property(nonatomic,getter=isEditable) BOOL editable; 93 | @property(nonatomic) UIDataDetectorTypes dataDetectorTypes __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0); 94 | @property (nonatomic) UIReturnKeyType returnKeyType; 95 | @property (assign) UIEdgeInsets contentInset; 96 | @property(nonatomic)UITextAutocorrectionType autocorrectionType; 97 | 98 | //uitextview methods 99 | //need others? use .internalTextView 100 | - (BOOL)becomeFirstResponder; 101 | - (BOOL)resignFirstResponder; 102 | 103 | - (BOOL)hasText; 104 | - (void)scrollRangeToVisible:(NSRange)range; 105 | 106 | 107 | -(void)setText:(NSString *)newText; 108 | -(void)setFont:(UIFont *)afont; 109 | -(void)setTextColor:(UIColor *)color; 110 | -(void)setTextAlignment:(UITextAlignment)aligment; 111 | -(void)setEditable:(BOOL)beditable; 112 | -(void)setReturnKeyType:(UIReturnKeyType)keyType; 113 | -(void)setAutocorrectionType:(UITextAutocorrectionType)autocorrection; 114 | 115 | 116 | @end 117 | -------------------------------------------------------------------------------- /Classes/HPGrowingTextView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HPTextView.m 3 | // 4 | // Created by Hans Pinckaers on 29-06-10. 5 | // 6 | // MIT License 7 | // 8 | // Copyright (c) 2011 Hans Pinckaers 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to deal 12 | // in the Software without restriction, including without limitation the rights 13 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | // copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | // THE SOFTWARE. 27 | 28 | #import "HPGrowingTextView.h" 29 | #import "HPTextViewInternal.h" 30 | 31 | 32 | @implementation HPGrowingTextView 33 | @synthesize internalTextView; 34 | @synthesize delegate; 35 | 36 | @synthesize font; 37 | @synthesize textColor; 38 | @synthesize textAlignment; 39 | @synthesize selectedRange; 40 | @synthesize editable; 41 | @synthesize dataDetectorTypes; 42 | @synthesize animateHeightChange; 43 | @synthesize returnKeyType; 44 | @synthesize autocorrectionType; 45 | 46 | 47 | - (id)initWithFrame:(CGRect)frame { 48 | if ((self = [super initWithFrame:frame])) { 49 | // Initialization code 50 | CGRect r = frame; 51 | r.origin.y = 0; 52 | r.origin.x = 0; 53 | internalTextView = [[HPTextViewInternal alloc] initWithFrame:r]; 54 | internalTextView.delegate = self; 55 | internalTextView.scrollEnabled = NO; 56 | internalTextView.font = [UIFont fontWithName:@"Helvetica" size:13]; 57 | internalTextView.contentInset = UIEdgeInsetsZero; 58 | internalTextView.showsHorizontalScrollIndicator = NO; 59 | internalTextView.text = @"-"; 60 | [self addSubview:internalTextView]; 61 | 62 | UIView *internal = (UIView*)[[internalTextView subviews] objectAtIndex:0]; 63 | minHeight = internal.frame.size.height; 64 | minNumberOfLines = 1; 65 | 66 | animateHeightChange = YES; 67 | 68 | internalTextView.text = @""; 69 | 70 | [self setMaxNumberOfLines:3]; 71 | } 72 | return self; 73 | } 74 | 75 | -(void)sizeToFit 76 | { 77 | CGRect r = self.frame; 78 | 79 | // check if the text is available in text view or not, if it is available, no need to set it to minimum lenth, it could vary as per the text length 80 | // fix from Ankit Thakur 81 | if ([self.text length] > 0) { 82 | return; 83 | } else { 84 | r.size.height = minHeight; 85 | self.frame = r; 86 | } 87 | } 88 | 89 | -(void)setFrame:(CGRect)aframe 90 | { 91 | CGRect r = aframe; 92 | r.origin.y = 0; 93 | r.origin.x = contentInset.left; 94 | r.size.width -= contentInset.left + contentInset.right; 95 | 96 | internalTextView.frame = r; 97 | 98 | [super setFrame:aframe]; 99 | } 100 | 101 | -(void)setContentInset:(UIEdgeInsets)inset 102 | { 103 | contentInset = inset; 104 | 105 | CGRect r = self.frame; 106 | r.origin.y = inset.top - inset.bottom; 107 | r.origin.x = inset.left; 108 | r.size.width -= inset.left + inset.right; 109 | 110 | internalTextView.frame = r; 111 | 112 | [self setMaxNumberOfLines:maxNumberOfLines]; 113 | [self setMaxNumberOfLines:minNumberOfLines]; 114 | } 115 | 116 | -(UIEdgeInsets)contentInset 117 | { 118 | return contentInset; 119 | } 120 | 121 | -(void)setMaxNumberOfLines:(int)n 122 | { 123 | // Use internalTextView for height calculations, thanks to Gwynne 124 | NSString *saveText = internalTextView.text, *newText = @"-"; 125 | 126 | internalTextView.delegate = nil; 127 | internalTextView.hidden = YES; 128 | 129 | for (int i = 1; i < n; ++i) 130 | newText = [newText stringByAppendingString:@"\n|W|"]; 131 | 132 | internalTextView.text = newText; 133 | 134 | maxHeight = internalTextView.contentSize.height; 135 | 136 | internalTextView.text = saveText; 137 | internalTextView.hidden = NO; 138 | internalTextView.delegate = self; 139 | 140 | [self sizeToFit]; 141 | 142 | maxNumberOfLines = n; 143 | } 144 | 145 | -(int)maxNumberOfLines 146 | { 147 | return maxNumberOfLines; 148 | } 149 | 150 | -(void)setMinNumberOfLines:(int)m 151 | { 152 | // Use internalTextView for height calculations, thanks to Gwynne 153 | NSString *saveText = internalTextView.text, *newText = @"-"; 154 | 155 | internalTextView.delegate = nil; 156 | internalTextView.hidden = YES; 157 | 158 | for (int i = 1; i < m; ++i) 159 | newText = [newText stringByAppendingString:@"\n|W|"]; 160 | 161 | internalTextView.text = newText; 162 | 163 | minHeight = internalTextView.contentSize.height; 164 | 165 | internalTextView.text = saveText; 166 | internalTextView.hidden = NO; 167 | internalTextView.delegate = self; 168 | 169 | [self sizeToFit]; 170 | 171 | minNumberOfLines = m; 172 | } 173 | 174 | -(int)minNumberOfLines 175 | { 176 | return minNumberOfLines; 177 | } 178 | 179 | 180 | - (void)textViewDidChange:(UITextView *)textView 181 | { 182 | //size of content, so we can set the frame of self 183 | NSInteger newSizeH = internalTextView.contentSize.height+5; 184 | if(newSizeH < minHeight || !internalTextView.hasText) newSizeH = minHeight+5; //not smalles than minHeight 185 | 186 | if (internalTextView.frame.size.height != newSizeH) 187 | { 188 | // [fixed] Pasting too much text into the view failed to fire the height change, 189 | // thanks to Gwynne 190 | 191 | if (newSizeH > maxHeight && internalTextView.frame.size.height <= maxHeight) 192 | { 193 | newSizeH = maxHeight; 194 | } 195 | 196 | if (newSizeH <= maxHeight) 197 | { 198 | if(animateHeightChange){ 199 | [UIView beginAnimations:@"" context:nil]; 200 | [UIView setAnimationDuration:0.1f]; 201 | [UIView setAnimationDelegate:self]; 202 | [UIView setAnimationDidStopSelector:@selector(growDidStop)]; 203 | [UIView setAnimationBeginsFromCurrentState:YES]; 204 | } 205 | 206 | if ([delegate respondsToSelector:@selector(growingTextView:willChangeHeight:)]) { 207 | [delegate growingTextView:self willChangeHeight:newSizeH]; 208 | } 209 | 210 | // internalTextView 211 | CGRect internalTextViewFrame = self.frame; 212 | internalTextViewFrame.size.height = newSizeH; // + padding 213 | self.frame = internalTextViewFrame; 214 | 215 | internalTextViewFrame.origin.y = contentInset.top - contentInset.bottom; 216 | internalTextViewFrame.origin.x = contentInset.left; 217 | internalTextViewFrame.size.height = newSizeH; 218 | internalTextViewFrame.size.width = internalTextView.contentSize.width; 219 | 220 | internalTextView.frame = internalTextViewFrame; 221 | 222 | // [fixed] The growingTextView:didChangeHeight: delegate method was not called at all when not animating height changes. 223 | // thanks to Gwynne 224 | 225 | if(animateHeightChange){ 226 | [UIView commitAnimations]; 227 | } else if ([delegate respondsToSelector:@selector(growingTextView:didChangeHeight:)]) { 228 | [delegate growingTextView:self didChangeHeight:newSizeH]; 229 | } 230 | } 231 | 232 | 233 | // if our new height is greater than the maxHeight 234 | // sets not set the height or move things 235 | // around and enable scrolling 236 | if (newSizeH >= maxHeight) 237 | { 238 | if(!internalTextView.scrollEnabled){ 239 | internalTextView.scrollEnabled = YES; 240 | [internalTextView flashScrollIndicators]; 241 | } 242 | 243 | } else { 244 | internalTextView.scrollEnabled = NO; 245 | } 246 | 247 | } 248 | 249 | 250 | if ([delegate respondsToSelector:@selector(growingTextViewDidChange:)]) { 251 | [delegate growingTextViewDidChange:self]; 252 | } 253 | 254 | } 255 | 256 | -(void)growDidStop 257 | { 258 | if ([delegate respondsToSelector:@selector(growingTextView:didChangeHeight:)]) { 259 | [delegate growingTextView:self didChangeHeight:self.frame.size.height]; 260 | } 261 | 262 | } 263 | 264 | -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 265 | { 266 | [internalTextView becomeFirstResponder]; 267 | } 268 | 269 | - (BOOL)becomeFirstResponder 270 | { 271 | [super becomeFirstResponder]; 272 | return [self.internalTextView becomeFirstResponder]; 273 | } 274 | 275 | -(BOOL)resignFirstResponder 276 | { 277 | [super resignFirstResponder]; 278 | return [internalTextView resignFirstResponder]; 279 | } 280 | 281 | - (void)dealloc { 282 | [internalTextView release]; 283 | [super dealloc]; 284 | } 285 | 286 | 287 | /////////////////////////////////////////////////////////////////////////////////////////////////// 288 | #pragma mark UITextView properties 289 | /////////////////////////////////////////////////////////////////////////////////////////////////// 290 | 291 | -(void)setText:(NSString *)newText 292 | { 293 | internalTextView.text = newText; 294 | 295 | // include this line to analyze the height of the textview. 296 | // fix from Ankit Thakur 297 | [self performSelector:@selector(textViewDidChange:) withObject:internalTextView]; 298 | } 299 | 300 | -(NSString*) text 301 | { 302 | return internalTextView.text; 303 | } 304 | 305 | /////////////////////////////////////////////////////////////////////////////////////////////////// 306 | 307 | -(void)setFont:(UIFont *)afont 308 | { 309 | internalTextView.font= afont; 310 | 311 | [self setMaxNumberOfLines:maxNumberOfLines]; 312 | [self setMinNumberOfLines:minNumberOfLines]; 313 | } 314 | 315 | -(UIFont *)font 316 | { 317 | return internalTextView.font; 318 | } 319 | 320 | /////////////////////////////////////////////////////////////////////////////////////////////////// 321 | 322 | -(void)setTextColor:(UIColor *)color 323 | { 324 | internalTextView.textColor = color; 325 | } 326 | 327 | -(UIColor*)textColor{ 328 | return internalTextView.textColor; 329 | } 330 | 331 | /////////////////////////////////////////////////////////////////////////////////////////////////// 332 | 333 | -(void)setTextAlignment:(UITextAlignment)aligment 334 | { 335 | internalTextView.textAlignment = aligment; 336 | } 337 | 338 | -(UITextAlignment)textAlignment 339 | { 340 | return internalTextView.textAlignment; 341 | } 342 | 343 | /////////////////////////////////////////////////////////////////////////////////////////////////// 344 | 345 | -(void)setSelectedRange:(NSRange)range 346 | { 347 | internalTextView.selectedRange = range; 348 | } 349 | 350 | -(NSRange)selectedRange 351 | { 352 | return internalTextView.selectedRange; 353 | } 354 | 355 | /////////////////////////////////////////////////////////////////////////////////////////////////// 356 | 357 | -(void)setEditable:(BOOL)beditable 358 | { 359 | internalTextView.editable = beditable; 360 | } 361 | 362 | -(BOOL)isEditable 363 | { 364 | return internalTextView.editable; 365 | } 366 | 367 | /////////////////////////////////////////////////////////////////////////////////////////////////// 368 | 369 | -(void)setReturnKeyType:(UIReturnKeyType)keyType 370 | { 371 | internalTextView.returnKeyType = keyType; 372 | } 373 | 374 | -(UIReturnKeyType)returnKeyType 375 | { 376 | return internalTextView.returnKeyType; 377 | } 378 | 379 | /////////////////////////////////////////////////////////////////////////////////////////////////// 380 | 381 | -(void)setDataDetectorTypes:(UIDataDetectorTypes)datadetector 382 | { 383 | internalTextView.dataDetectorTypes = datadetector; 384 | } 385 | 386 | -(UIDataDetectorTypes)dataDetectorTypes 387 | { 388 | return internalTextView.dataDetectorTypes; 389 | } 390 | 391 | /////////////////////////////////////////////////////////////////////////////////////////////////// 392 | 393 | - (BOOL)hasText{ 394 | return [internalTextView hasText]; 395 | } 396 | 397 | - (void)scrollRangeToVisible:(NSRange)range 398 | { 399 | [internalTextView scrollRangeToVisible:range]; 400 | } 401 | 402 | 403 | //========== Pedro Enrique =============== 404 | 405 | -(void)setAutocorrectionType:(UITextAutocorrectionType)autocorrection 406 | { 407 | internalTextView.autocorrectionType = autocorrection; 408 | } 409 | 410 | -(UITextAutocorrectionType)autocorrectionType 411 | { 412 | return internalTextView.autocorrectionType; 413 | } 414 | 415 | //========== Pedro Enrique =============== 416 | 417 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 418 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 419 | #pragma mark - 420 | #pragma mark UITextViewDelegate 421 | 422 | 423 | /////////////////////////////////////////////////////////////////////////////////////////////////// 424 | - (BOOL)textViewShouldBeginEditing:(UITextView *)textView { 425 | if ([delegate respondsToSelector:@selector(growingTextViewShouldBeginEditing:)]) { 426 | return [delegate growingTextViewShouldBeginEditing:self]; 427 | 428 | } else { 429 | return YES; 430 | } 431 | } 432 | 433 | 434 | /////////////////////////////////////////////////////////////////////////////////////////////////// 435 | - (BOOL)textViewShouldEndEditing:(UITextView *)textView { 436 | if ([delegate respondsToSelector:@selector(growingTextViewShouldEndEditing:)]) { 437 | return [delegate growingTextViewShouldEndEditing:self]; 438 | 439 | } else { 440 | return YES; 441 | } 442 | } 443 | 444 | 445 | /////////////////////////////////////////////////////////////////////////////////////////////////// 446 | - (void)textViewDidBeginEditing:(UITextView *)textView { 447 | if ([delegate respondsToSelector:@selector(growingTextViewDidBeginEditing:)]) { 448 | [delegate growingTextViewDidBeginEditing:self]; 449 | } 450 | } 451 | 452 | 453 | /////////////////////////////////////////////////////////////////////////////////////////////////// 454 | - (void)textViewDidEndEditing:(UITextView *)textView { 455 | if ([delegate respondsToSelector:@selector(growingTextViewDidEndEditing:)]) { 456 | [delegate growingTextViewDidEndEditing:self]; 457 | } 458 | } 459 | 460 | 461 | /////////////////////////////////////////////////////////////////////////////////////////////////// 462 | - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range 463 | replacementText:(NSString *)atext { 464 | 465 | //weird 1 pixel bug when clicking backspace when textView is empty 466 | if(![textView hasText] && [atext isEqualToString:@""]) return NO; 467 | 468 | if ([atext isEqualToString:@"\n"]) { 469 | if ([delegate respondsToSelector:@selector(growingTextViewShouldReturn:)]) { 470 | if (![delegate performSelector:@selector(growingTextViewShouldReturn:) withObject:self]) { 471 | return YES; 472 | } else { 473 | [textView resignFirstResponder]; 474 | return NO; 475 | } 476 | } 477 | } 478 | 479 | return YES; 480 | 481 | 482 | } 483 | 484 | /////////////////////////////////////////////////////////////////////////////////////////////////// 485 | - (void)textViewDidChangeSelection:(UITextView *)textView { 486 | if ([delegate respondsToSelector:@selector(growingTextViewDidChangeSelection:)]) { 487 | [delegate growingTextViewDidChangeSelection:self]; 488 | } 489 | } 490 | 491 | 492 | 493 | @end 494 | -------------------------------------------------------------------------------- /Classes/HPTextViewInternal.h: -------------------------------------------------------------------------------- 1 | // 2 | // HPTextViewInternal.h 3 | // 4 | // Created by Hans Pinckaers on 29-06-10. 5 | // 6 | // MIT License 7 | // 8 | // Copyright (c) 2011 Hans Pinckaers 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to deal 12 | // in the Software without restriction, including without limitation the rights 13 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | // copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | // THE SOFTWARE. 27 | 28 | #import 29 | 30 | 31 | @interface HPTextViewInternal : UITextView { 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Classes/HPTextViewInternal.m: -------------------------------------------------------------------------------- 1 | // 2 | // HPTextViewInternal.m 3 | // 4 | // Created by Hans Pinckaers on 29-06-10. 5 | // 6 | // MIT License 7 | // 8 | // Copyright (c) 2011 Hans Pinckaers 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to deal 12 | // in the Software without restriction, including without limitation the rights 13 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | // copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | // THE SOFTWARE. 27 | 28 | #import "HPTextViewInternal.h" 29 | 30 | 31 | @implementation HPTextViewInternal 32 | 33 | -(void)setContentOffset:(CGPoint)s 34 | { 35 | if(self.tracking || self.decelerating){ 36 | //initiated by user... 37 | 38 | UIEdgeInsets insets = self.contentInset; 39 | insets.bottom = 0; 40 | insets.top = 0; 41 | self.contentInset = insets; 42 | 43 | } else { 44 | 45 | float bottomOffset = (self.contentSize.height - self.frame.size.height + self.contentInset.bottom); 46 | if(s.y < bottomOffset && self.scrollEnabled){ 47 | UIEdgeInsets insets = self.contentInset; 48 | insets.bottom = 8; 49 | insets.top = 0; 50 | self.contentInset = insets; 51 | } 52 | } 53 | 54 | [super setContentOffset:s]; 55 | } 56 | 57 | -(void)setContentInset:(UIEdgeInsets)s 58 | { 59 | UIEdgeInsets insets = s; 60 | 61 | if(s.bottom>8) insets.bottom = 0; 62 | insets.top = 0; 63 | 64 | [super setContentInset:insets]; 65 | } 66 | 67 | -(void)setContentSize:(CGSize)contentSize 68 | { 69 | // is this an iOS5 bug? Need testing! 70 | if(self.contentSize.height > contentSize.height) 71 | { 72 | UIEdgeInsets insets = self.contentInset; 73 | insets.bottom = 0; 74 | insets.top = 0; 75 | self.contentInset = insets; 76 | } 77 | 78 | [super setContentSize:contentSize]; 79 | } 80 | 81 | 82 | - (void)dealloc { 83 | [super dealloc]; 84 | } 85 | 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /Classes/PESMSLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // Label.h 3 | // chat 4 | // 5 | // Created by Pedro Enrique on 8/13/11. 6 | // Copyright 2011 Appcelerator. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "TiUIView.h" 11 | #import "TiProxy.h" 12 | 13 | @interface PESMSLabel : UIImageView 14 | { 15 | UILabel *label; 16 | UIImageView *innerImage; 17 | UIView *innerView; 18 | UILongPressGestureRecognizer *hold; 19 | } 20 | 21 | @property(nonatomic, retain)NSString *sColor; 22 | @property(nonatomic, retain)NSString *rColor; 23 | @property(nonatomic, retain)NSString *thisPos; 24 | @property(nonatomic, retain)NSString *thisColor; 25 | @property(nonatomic, retain)NSString *selectedColor; 26 | @property(nonatomic, retain)NSString *textValue; 27 | @property(nonatomic, retain)UILabel *label; 28 | @property(nonatomic, retain)UIView *innerView; 29 | @property(nonatomic, retain)NSString *folder; 30 | @property(nonatomic, retain)TiProxy *prox; 31 | @property(nonatomic, retain)UIImage *imageValue; 32 | @property(nonatomic)BOOL isImage; 33 | @property(nonatomic)BOOL isText; 34 | @property(nonatomic)BOOL isView; 35 | @property(nonatomic)int index_; 36 | @property(nonatomic)UIDeviceOrientation orient; 37 | 38 | -(void)addImage:(UIImage *)image; 39 | -(void)addText:(NSString *)text; 40 | -(void)position:(NSString *)pos:(NSString *)color:(NSString *)selCol; 41 | -(void)addImageView:(TiUIView *)view; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Classes/PESMSLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // Label.m 3 | // chat 4 | // 5 | // Created by Pedro Enrique on 8/13/11. 6 | // Copyright 2011 Appcelerator. All rights reserved. 7 | // 8 | 9 | #import "PESMSLabel.h" 10 | #import "TiHost.h" 11 | 12 | @implementation PESMSLabel 13 | 14 | @synthesize rColor; 15 | @synthesize sColor; 16 | @synthesize isText; 17 | @synthesize isImage; 18 | @synthesize isView; 19 | @synthesize thisPos; 20 | @synthesize thisColor; 21 | @synthesize selectedColor; 22 | @synthesize textValue; 23 | @synthesize innerView; 24 | @synthesize folder; 25 | @synthesize imageValue; 26 | @synthesize prox; 27 | @synthesize index_; 28 | @synthesize orient; 29 | @synthesize label; 30 | 31 | -(void)dealloc 32 | { 33 | if(self.isText) 34 | RELEASE_TO_NIL(label); 35 | if(self.isImage) 36 | RELEASE_TO_NIL(innerImage); 37 | if(self.isView) 38 | RELEASE_TO_NIL(innerView); 39 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:[UIDevice currentDevice]]; 40 | 41 | [super dealloc]; 42 | } 43 | 44 | -(id)init 45 | { 46 | if(self = [super init]) 47 | { 48 | [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 49 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:[UIDevice currentDevice]]; 50 | } 51 | return self; 52 | } 53 | 54 | 55 | - (void)doLongTouch 56 | { 57 | [self becomeFirstResponder]; 58 | UIMenuController *menu = [UIMenuController sharedMenuController]; 59 | [menu setTargetRect:CGRectMake(0,0,self.frame.size.width,self.frame.size.height) inView:self]; 60 | [menu setMenuVisible:YES animated:YES]; 61 | } 62 | 63 | - (BOOL)canBecomeFirstResponder; 64 | { 65 | return YES; 66 | } 67 | 68 | - (BOOL)canPerformAction:(SEL)action withSender:(id)sender; 69 | { 70 | BOOL r = NO; 71 | if (action == @selector(copy:)) { 72 | r = YES; 73 | } else { 74 | r = [super canPerformAction:action withSender:sender]; 75 | } 76 | return r; 77 | } 78 | 79 | - (void)copy:(id)sender 80 | { 81 | UIPasteboard *paste = [UIPasteboard generalPasteboard]; 82 | paste.persistent = YES; 83 | [paste setString:self.textValue]; 84 | } 85 | 86 | - (void)orientationChanged:(NSNotification *)note 87 | { 88 | UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; 89 | 90 | if (orientation == UIDeviceOrientationLandscapeLeft || 91 | orientation == UIDeviceOrientationLandscapeRight || 92 | orientation == UIDeviceOrientationPortrait || 93 | orientation == UIDeviceOrientationPortraitUpsideDown) 94 | { 95 | if(orientation != orient && [self.thisPos isEqualToString:@"Right"]) 96 | { 97 | CGRect a = self.frame; 98 | a.origin.x = (self.superview.frame.size.width-self.frame.size.width)-5; 99 | [self setFrame:a]; 100 | [self setNeedsDisplay]; 101 | orient = orientation; 102 | } 103 | if(orientation != orient && [self.thisPos isEqualToString:@"Center"]) 104 | { 105 | CGRect a = self.frame; 106 | a.size.width = self.superview.frame.size.width;///2-a.size.width/2; 107 | a.origin.x = 0; 108 | CGRect b = self.label.frame; 109 | b.size.width = a.size.width; 110 | b.origin.x = 0; 111 | [self.label setFrame:b]; 112 | [self setFrame:a]; 113 | [self setNeedsDisplay]; 114 | orient = orientation; 115 | } 116 | } 117 | 118 | } 119 | 120 | -(UIImageView *)innerImage:(UIImage *)image 121 | { 122 | if(!innerImage) 123 | { 124 | innerImage = [[UIImageView alloc] initWithImage:image]; 125 | self.isImage = YES; 126 | } 127 | return innerImage; 128 | } 129 | 130 | -(UILabel *)label 131 | { 132 | if(!label) 133 | { 134 | hold = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(doLongTouch)]; 135 | [self addGestureRecognizer:hold]; 136 | [hold release]; 137 | label = [[UILabel alloc] init]; 138 | label.numberOfLines = 0; 139 | label.backgroundColor = [UIColor clearColor]; 140 | self.isText = YES; 141 | } 142 | return label; 143 | } 144 | 145 | -(void)setUpTextImageSize 146 | { 147 | CGRect x = [self label].frame; 148 | if(x.size.width > 270)//self.superview.frame.size.width-100) 149 | { 150 | x.size.width = 270;//self.superview.frame.size.width-100; 151 | [[self label] setFrame:x]; 152 | [[self label] sizeToFit]; 153 | 154 | } 155 | CGRect a = [self label].frame; 156 | a.size.width +=25; 157 | a.size.height +=10; 158 | a.origin.y = 10; 159 | a.origin.x = 5; 160 | self.frame = a; 161 | 162 | CGRect b = [self label].frame; 163 | b.origin.y = 3; 164 | b.origin.x = 15; 165 | [[self label] setFrame:b]; 166 | } 167 | 168 | -(void)setUpInnerImageImageSize 169 | { 170 | CGRect a = [self innerImage:nil].frame; 171 | a.size.width +=25; 172 | a.size.height +=20; 173 | a.origin.y = 10; 174 | a.origin.x = 10; 175 | self.frame = a; 176 | 177 | CGRect b = [self innerImage:nil].frame; 178 | b.origin.y = 8; 179 | b.origin.x = 15; 180 | 181 | [[self innerImage:nil] setFrame:b]; 182 | } 183 | 184 | -(void)setUpInnerImageViewSize 185 | { 186 | CGRect a = self.innerView.frame; 187 | a.size.width +=25; 188 | a.size.height +=20; 189 | a.origin.y = 10; 190 | a.origin.x = 10; 191 | self.frame = a; 192 | 193 | CGRect b = self.innerView.frame; 194 | b.origin.y = 8; 195 | b.origin.x = 10; 196 | 197 | [self.innerView setFrame:b]; 198 | } 199 | 200 | -(BOOL)isUserInteractionEnabled 201 | { 202 | return YES; 203 | } 204 | 205 | -(void)addText:(NSString *)text 206 | { 207 | self.textValue = text; 208 | [[self label] performSelectorOnMainThread : @selector(setText:) withObject:text waitUntilDone:YES]; 209 | [self addSubview:[self label]]; 210 | [[self label] sizeToFit]; 211 | [self setUpTextImageSize]; 212 | } 213 | 214 | -(void)addImage:(UIImage *)image 215 | { 216 | self.imageValue = image; 217 | [self addSubview:[self innerImage:image]]; 218 | [[self innerImage:nil] sizeToFit]; 219 | [self setUpInnerImageImageSize]; 220 | } 221 | 222 | -(void)addImageView:(TiUIView *)view 223 | { 224 | [view setUserInteractionEnabled:NO]; 225 | self.isView = YES; 226 | self.prox = view.proxy; 227 | self.innerView = view; 228 | 229 | //this is just a quick workaround, just for now 230 | 231 | CGRect a = view.frame; 232 | a.origin.x = 0; 233 | a.origin.y = 0; 234 | [view setFrame:a]; 235 | [self performSelectorOnMainThread:@selector(addSubview:) withObject:view waitUntilDone:YES]; 236 | [self setUpInnerImageViewSize]; 237 | } 238 | 239 | 240 | -(NSString*)getNormalizedPath:(NSString*)source 241 | { 242 | if ([source hasPrefix:@"file:/"]) { 243 | NSURL* url = [NSURL URLWithString:source]; 244 | return [url path]; 245 | } 246 | return source; 247 | } 248 | 249 | -(NSString *)resourcesDir:(NSString *)url 250 | { 251 | url = [[TiHost resourcePath] stringByAppendingPathComponent:[self getNormalizedPath:url]]; 252 | 253 | return url; 254 | } 255 | 256 | -(NSString *)pathOfImage:(NSString *)pos:(NSString *)color 257 | { 258 | if(!self.folder) 259 | self.folder = @""; 260 | NSString *imgName = [[[[[self.folder 261 | stringByAppendingString:@"smsview.bundle/"] 262 | stringByAppendingString:color ] 263 | stringByAppendingString:@"Balloon"] 264 | stringByAppendingString:pos] 265 | stringByAppendingString:@".png" ]; 266 | return [self resourcesDir:imgName]; 267 | } 268 | 269 | -(void)position:(NSString *)pos:(NSString *)color:(NSString *)selCol 270 | { 271 | if([pos isEqualToString:@""] || !pos) 272 | pos = @"Left"; 273 | if([color isEqualToString:@""] || !color) 274 | color = @"Green"; 275 | if([selCol isEqualToString:@""] || !selCol) 276 | selCol = @"Blue"; 277 | 278 | self.thisColor = color; 279 | self.thisPos = pos; 280 | self.selectedColor = selCol; 281 | 282 | NSString *imgName = [self pathOfImage:pos :color]; 283 | 284 | if([pos isEqualToString:@"Left"]) 285 | { 286 | if(self.isText) 287 | { 288 | CGRect a = [self label].frame; 289 | a.origin.x +=5; 290 | [[self label] setFrame:a]; 291 | } 292 | if(self.isImage) 293 | { 294 | CGRect a = [self innerImage:nil].frame; 295 | a.origin.x +=5; 296 | [[self innerImage:nil] setFrame:a]; 297 | } 298 | if(self.isView) 299 | { 300 | CGRect a = self.innerView.frame; 301 | a.origin.x +=5; 302 | [self.innerView setFrame:a]; 303 | } 304 | 305 | CGRect b = self.frame; 306 | b.size.width +=10; 307 | [self setFrame:b]; 308 | self.image = [[UIImage imageWithContentsOfFile:imgName] stretchableImageWithLeftCapWidth:22 topCapHeight:14]; 309 | } 310 | else if([pos isEqualToString:@"Right"]) 311 | { 312 | self.image = [[UIImage imageWithContentsOfFile:imgName] stretchableImageWithLeftCapWidth:20 topCapHeight:14]; 313 | CGRect a = self.frame; 314 | a.origin.x = (self.superview.frame.size.width-self.frame.size.width)-8; 315 | a.size.width +=5; 316 | [self setFrame:a]; 317 | } 318 | else if([pos isEqualToString:@"Center"]) 319 | { 320 | //only used by addLabel currently 321 | self.label.font= [UIFont boldSystemFontOfSize:14]; 322 | self.label.textColor = [UIColor grayColor]; 323 | self.label.textAlignment = UITextAlignmentCenter; 324 | CGRect a = self.frame; 325 | a.size.width = self.superview.frame.size.width;///2-a.size.width/2; 326 | a.origin.x = 0; 327 | CGRect b = self.label.frame; 328 | b.size.width = a.size.width; 329 | b.origin.x = 0; 330 | a.size.height = b.size.height; 331 | [self.label setFrame:b]; 332 | [self setFrame:a]; 333 | } 334 | else 335 | { 336 | NSLog(@"[ERROR] need to know if it's \"Left\" or \"Center\" or \"Right\", stupid!"); 337 | } 338 | 339 | } 340 | 341 | -(void)resetImage 342 | { 343 | self.image = [[UIImage imageWithContentsOfFile:[self pathOfImage:self.thisPos:self.thisColor]] stretchableImageWithLeftCapWidth:21 topCapHeight:14]; 344 | } 345 | 346 | -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 347 | { 348 | [self resetImage]; 349 | } 350 | 351 | -(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event 352 | { 353 | [self resetImage]; 354 | } 355 | 356 | -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 357 | { 358 | [self resetImage]; 359 | } 360 | 361 | -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 362 | { 363 | NSString *imgName = [self pathOfImage:self.thisPos:self.selectedColor]; 364 | self.image = [[UIImage imageWithContentsOfFile:imgName] stretchableImageWithLeftCapWidth:21 topCapHeight:14]; 365 | 366 | } 367 | 368 | @end -------------------------------------------------------------------------------- /Classes/PESMSScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ScrollView.h 3 | // chat 4 | // 5 | // Created by Pedro Enrique on 8/12/11. 6 | // Copyright 2011 Appcelerator. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PESMSLabel.h" 11 | #import "PESMSTextLabel.h" 12 | #import "TiUIView.h" 13 | 14 | 15 | @interface PESMSScrollView : UIScrollView { 16 | UILabel *sentLabel; 17 | UILabel *recieveLabel; 18 | PESMSLabel *label; 19 | PESMSTextLabel *textLabel; 20 | NSMutableArray *allMessages; 21 | NSMutableDictionary *tempDict; 22 | } 23 | 24 | @property(nonatomic) CGRect labelsPosition; 25 | @property(nonatomic, retain)NSString *sColor; 26 | @property(nonatomic, retain)NSString *rColor; 27 | @property(nonatomic, retain)NSString *selectedColor; 28 | @property(nonatomic, retain)NSString *folder; 29 | @property(nonatomic, retain)NSMutableArray *allMessages; 30 | @property(nonatomic, retain)NSMutableDictionary *tempDict; 31 | @property(nonatomic)BOOL animated; 32 | @property(nonatomic)int numberOfMessage; 33 | 34 | -(void)sendMessage:(NSString *)text; 35 | -(void)recieveMessage:(NSString *)text; 36 | -(void)addLabel:(NSString *)msg; 37 | -(void)sendImageView:(TiUIView *)view; 38 | -(void)recieveImageView:(TiUIView *)view; 39 | -(void)sendImage:(UIImage *)image; 40 | -(void)recieveImage:(UIImage *)image; 41 | -(void)reloadContentSize; 42 | -(void)backgroundColor:(UIColor *)col; 43 | -(void)sendColor:(NSString *)col; 44 | -(void)recieveColor:(NSString *)col; 45 | -(void)animate:(BOOL)arg; 46 | -(void)selectedColor:(NSString *)col; 47 | -(void)empty; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Classes/PESMSScrollView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ScrollView.m 3 | // chat 4 | // 5 | // Created by Pedro Enrique on 8/12/11. 6 | // Copyright 2011 Appcelerator. All rights reserved. 7 | // 8 | 9 | #import "PESMSScrollView.h" 10 | #import "TiUtils.h" 11 | 12 | @implementation PESMSScrollView 13 | @synthesize delegate; 14 | @synthesize labelsPosition; 15 | @synthesize sColor; 16 | @synthesize rColor; 17 | @synthesize animated; 18 | @synthesize selectedColor; 19 | @synthesize folder; 20 | @synthesize allMessages; 21 | @synthesize numberOfMessage; 22 | @synthesize tempDict; 23 | 24 | -(void)dealloc 25 | { 26 | RELEASE_TO_NIL(allMessages); 27 | //[tempDict release]; 28 | [super dealloc]; 29 | } 30 | 31 | - (id)initWithFrame:(CGRect)aRect { 32 | self = [super initWithFrame:aRect]; 33 | if (self) { 34 | self.labelsPosition = self.frame; 35 | self.animated = YES; 36 | tempDict = [[NSMutableDictionary alloc] init]; 37 | self.tempDict = tempDict; 38 | allMessages = [[NSMutableArray alloc] init]; 39 | self.allMessages = allMessages; 40 | self.numberOfMessage = 0; 41 | } 42 | return self; 43 | } 44 | 45 | -(PESMSTextLabel *)textLabel:(NSString *)text 46 | { 47 | [self performSelectorOnMainThread:@selector(reloadContentSize) withObject:nil waitUntilDone:YES]; 48 | 49 | textLabel = [[PESMSTextLabel alloc] initWithFrame:self.frame]; 50 | [textLabel addText:text]; 51 | 52 | [textLabel resize:self.frame]; 53 | 54 | CGRect frame = textLabel.frame; 55 | frame.origin.y += labelsPosition.origin.y; 56 | [textLabel setFrame:frame]; 57 | 58 | CGRect a = self.labelsPosition; 59 | a.origin.y = frame.origin.y+frame.size.height; 60 | self.labelsPosition = a; 61 | 62 | [textLabel setIndex_:self.numberOfMessage]; 63 | 64 | [self.tempDict setObject:[NSString stringWithFormat:@"%i",self.numberOfMessage] forKey:@"index"]; 65 | 66 | self.numberOfMessage++; 67 | 68 | [self.allMessages addObject:[NSDictionary dictionaryWithDictionary:self.tempDict]]; 69 | 70 | [self addSubview:textLabel]; 71 | 72 | return textLabel; 73 | } 74 | 75 | -(PESMSLabel *)label:(NSString *)text:(UIImage *)image:(TiUIView *)view:(NSString *)pos 76 | { 77 | 78 | [self performSelectorOnMainThread:@selector(reloadContentSize) withObject:nil waitUntilDone:YES]; 79 | 80 | label = [[PESMSLabel alloc] init]; 81 | [label setFolder:self.folder]; 82 | 83 | [self.tempDict removeAllObjects]; 84 | 85 | [self addSubview:label]; 86 | 87 | if(text) 88 | { 89 | [label addText:text]; 90 | [self.tempDict setObject:text forKey:pos]; 91 | } 92 | if(image) 93 | { 94 | [label addImage:image]; 95 | TiBlob *blob = [[[TiBlob alloc] initWithImage:image] autorelease]; 96 | [self.tempDict setObject:blob forKey:pos]; 97 | } 98 | if(view) 99 | { 100 | [label addImageView:view]; 101 | [self.tempDict setObject:view.proxy forKey:pos]; 102 | } 103 | CGRect frame = label.frame; 104 | frame.origin.y += labelsPosition.origin.y; 105 | [label setFrame:frame]; 106 | 107 | CGRect a = self.labelsPosition; 108 | a.origin.y = frame.origin.y+frame.size.height; 109 | self.labelsPosition = a; 110 | 111 | [label setIndex_:self.numberOfMessage]; 112 | 113 | [self.tempDict setObject:[NSString stringWithFormat:@"%i",self.numberOfMessage] forKey:@"index"]; 114 | 115 | self.numberOfMessage++; 116 | 117 | [self.allMessages addObject:[NSDictionary dictionaryWithDictionary:self.tempDict]]; 118 | return label; 119 | } 120 | 121 | -(void)reloadContentSize 122 | { 123 | if(CGRectIsEmpty(self.labelsPosition)) 124 | self.labelsPosition = self.frame; 125 | 126 | CGFloat bottomOfContent = self.labelsPosition.origin.y;//+self.labelsPosition.size.height; 127 | 128 | CGSize contentSize1 = CGSizeMake(self.frame.size.width , bottomOfContent); 129 | 130 | 131 | [self setContentSize:contentSize1]; 132 | 133 | CGRect contentSize2 = CGRectMake(0,0,self.frame.size.width, bottomOfContent); 134 | 135 | [self scrollRectToVisible: contentSize2 animated: self.animated]; 136 | } 137 | 138 | -(void)sendColor:(NSString *)col 139 | { 140 | self.sColor = col; 141 | } 142 | -(void)recieveColor:(NSString *)col 143 | { 144 | self.rColor = col; 145 | } 146 | 147 | -(void)selectedColor:(NSString *)col 148 | { 149 | self.selectedColor = col; 150 | } 151 | 152 | -(void)backgroundColor:(UIColor *)col 153 | { 154 | self.backgroundColor = col; 155 | } 156 | 157 | -(void)recieveImage:(UIImage *)image 158 | { 159 | if(!self.rColor) 160 | self.rColor = @"White"; 161 | [[self label:nil:image:nil:@"recieve"] position:@"Left":self.rColor:self.selectedColor]; 162 | RELEASE_TO_NIL(label); 163 | } 164 | 165 | -(void)sendImage:(UIImage *)image 166 | { 167 | if(!self.sColor) 168 | self.sColor = @"Green"; 169 | [[self label:nil:image:nil:@"send"] position:@"Right":self.sColor:self.selectedColor]; 170 | RELEASE_TO_NIL(label); 171 | } 172 | 173 | -(void)recieveImageView:(TiUIView *)view 174 | { 175 | if(!self.rColor) 176 | self.rColor = @"White"; 177 | [[self label:nil:nil:view:@"recieve"] position:@"Left":self.rColor:self.selectedColor]; 178 | RELEASE_TO_NIL(label); 179 | } 180 | 181 | -(void)sendImageView:(TiUIView *)view 182 | { 183 | if(!self.sColor) 184 | self.sColor = @"Green"; 185 | [[self label:nil:nil:view:@"send"] position:@"Right":self.sColor:self.selectedColor]; 186 | RELEASE_TO_NIL(label); 187 | } 188 | 189 | -(void)recieveMessage:(NSString *)text; 190 | { 191 | if(!self.rColor) 192 | self.rColor = @"White"; 193 | 194 | [[self label:text:nil:nil:@"recieve"] position:@"Left":self.rColor:self.selectedColor]; 195 | RELEASE_TO_NIL(label); 196 | } 197 | 198 | -(void)sendMessage:(NSString *)text; 199 | { 200 | if(!self.sColor) 201 | self.sColor = @"Green"; 202 | 203 | [[self label:text:nil:nil:@"send"] position:@"Right":self.sColor:self.selectedColor]; 204 | RELEASE_TO_NIL(label); 205 | } 206 | 207 | -(void)addLabel:(NSString *)text; 208 | { 209 | [self textLabel:text]; 210 | RELEASE_TO_NIL(textLabel); 211 | } 212 | 213 | -(void)animate:(BOOL)arg 214 | { 215 | self.animated = arg; 216 | } 217 | 218 | -(void)empty 219 | { 220 | ENSURE_UI_THREAD_0_ARGS 221 | [[self subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)]; 222 | self.labelsPosition = self.frame; 223 | [self.allMessages removeAllObjects]; 224 | self.numberOfMessage = 0; 225 | [self reloadContentSize]; 226 | [self setNeedsDisplay]; 227 | } 228 | 229 | @end 230 | -------------------------------------------------------------------------------- /Classes/PESMSTextArea.h: -------------------------------------------------------------------------------- 1 | // 2 | // TextArea.h 3 | // chat 4 | // 5 | // Created by Pedro Enrique on 8/12/11. 6 | // Copyright 2011 Appcelerator. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HPGrowingTextView.h" 11 | 12 | @class HPGrowingTextView; 13 | 14 | @protocol PESMSTextAreaDelegate 15 | @optional 16 | 17 | -(void)heightOfTextViewDidChange:(float)height; 18 | -(void)textViewSendButtonPressed:(NSString *)text; 19 | -(void)textViewCamButtonPressed:(NSString *)text; 20 | -(void)textViewFocus; 21 | -(void)textViewBlur; 22 | -(void)textViewTextChange:(NSString *)text;; 23 | 24 | @end 25 | 26 | @interface PESMSTextArea : UIView { 27 | NSObject * delegate; 28 | HPGrowingTextView *textView; 29 | UIButton *doneBtn; 30 | UIButton *camButton; 31 | UIImageView *entryImageView; 32 | UIImageView *imageView; 33 | UIImage *images; 34 | NSString *imagesPath; 35 | } 36 | 37 | @property(assign) NSObject *delegate; 38 | @property(nonatomic, retain)NSString *text; 39 | @property(nonatomic, retain)NSString *folder; 40 | @property(nonatomic)BOOL hasCam; 41 | @property(nonatomic)BOOL firstTime; 42 | @property(nonatomic)int maxLines; 43 | @property(nonatomic)int minLines; 44 | 45 | -(void)resize:(float)bottom; 46 | -(void)resignTextView; 47 | -(void)emptyTextView; 48 | -(void)becomeTextView; 49 | -(void)buttonTitle:(NSString *)title; 50 | -(void)setCamera:(BOOL)val; 51 | -(void)disableDoneButon:(BOOL)arg; 52 | -(void)disableCamButon:(BOOL)arg; 53 | - (HPGrowingTextView *)textView; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Classes/PESMSTextArea.m: -------------------------------------------------------------------------------- 1 | // 2 | // TextArea.m 3 | // chat 4 | // 5 | // Created by Pedro Enrique on 8/12/11. 6 | // Copyright 2011 Appcelerator. All rights reserved. 7 | // 8 | 9 | #import "PESMSTextArea.h" 10 | #import "TiSmsviewView.h" 11 | #import "TiHost.h" 12 | 13 | @implementation PESMSTextArea 14 | @synthesize delegate; 15 | @synthesize text; 16 | @synthesize hasCam; 17 | @synthesize firstTime; 18 | @synthesize folder; 19 | @synthesize maxLines; 20 | @synthesize minLines; 21 | 22 | -(void)dealloc 23 | { 24 | 25 | RELEASE_TO_NIL(textView); 26 | RELEASE_TO_NIL(entryImageView); 27 | RELEASE_TO_NIL(imageView); 28 | 29 | [super dealloc]; 30 | } 31 | 32 | -(NSString*)getNormalizedPath:(NSString*)source 33 | { 34 | if(!self.folder) 35 | self.folder = @""; 36 | source = [self.folder stringByAppendingString:source]; 37 | 38 | if ([source hasPrefix:@"file:/"]) { 39 | NSURL* url = [NSURL URLWithString:source]; 40 | return [url path]; 41 | } 42 | 43 | return source; 44 | } 45 | 46 | -(UIImage *)resourcesImage:(NSString *)url 47 | { 48 | return [UIImage imageWithContentsOfFile:[[TiHost resourcePath] stringByAppendingPathComponent:[self getNormalizedPath:url]]]; 49 | } 50 | 51 | 52 | - (HPGrowingTextView *)textView { 53 | if(textView==nil) 54 | { 55 | textView = [[HPGrowingTextView alloc] init]; 56 | textView.minNumberOfLines = self.minLines ? self.minLines : 1; 57 | textView.maxNumberOfLines = self.maxLines ? self.maxLines : 4; 58 | textView.returnKeyType = UIReturnKeyDefault; 59 | textView.font = [UIFont systemFontOfSize:15.0f]; 60 | textView.delegate = self; 61 | [textView sizeToFit]; 62 | } 63 | return textView; 64 | } 65 | 66 | -(UIButton *)doneBtn 67 | { 68 | if(!doneBtn) 69 | { 70 | doneBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 71 | doneBtn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin; 72 | 73 | [doneBtn setTitle:@"Send" forState:UIControlStateNormal]; 74 | 75 | [doneBtn setTitleShadowColor:[UIColor colorWithWhite:0 alpha:0.4] forState:UIControlStateNormal]; 76 | doneBtn.titleLabel.shadowOffset = CGSizeMake (0.0, -1.0); 77 | doneBtn.titleLabel.font = [UIFont boldSystemFontOfSize:18.0f]; 78 | 79 | [doneBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 80 | [doneBtn addTarget:self action:@selector(doneButtonPressed) forControlEvents:UIControlEventTouchUpInside]; 81 | 82 | } 83 | 84 | return doneBtn; 85 | } 86 | 87 | -(UIButton *)camButton 88 | { 89 | if(!camButton) 90 | { 91 | camButton = [UIButton buttonWithType:UIButtonTypeCustom]; 92 | camButton.autoresizingMask = UIViewAutoresizingFlexibleTopMargin; 93 | 94 | [camButton addTarget:self action:@selector(camButtonPressed) forControlEvents:UIControlEventTouchUpInside]; 95 | 96 | camButton.backgroundColor = [UIColor clearColor]; 97 | [self addSubview:camButton]; 98 | } 99 | return camButton; 100 | 101 | } 102 | 103 | -(UIImageView *)entryImageView 104 | { 105 | if(!entryImageView) 106 | { 107 | entryImageView = [[UIImageView alloc] init]; 108 | entryImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 109 | } 110 | return entryImageView; 111 | } 112 | 113 | -(void)buttonTitle:(NSString *)title 114 | { 115 | [[self doneBtn] setTitle:title forState:UIControlStateNormal]; 116 | } 117 | 118 | -(UIImageView *)imageView 119 | { 120 | if(!imageView) 121 | { 122 | imageView = [[UIImageView alloc] init]; 123 | imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 124 | } 125 | return imageView; 126 | } 127 | 128 | -(void)resize:(float)bottom 129 | { 130 | imageView = [self imageView]; 131 | textView = [self textView]; 132 | entryImageView = [self entryImageView]; 133 | doneBtn = [self doneBtn]; 134 | camButton = [self camButton]; 135 | 136 | if(self.firstTime == NO){ 137 | self.firstTime = YES; 138 | // view hierachy 139 | [self addSubview: imageView]; 140 | [self addSubview: textView]; 141 | [self addSubview: entryImageView]; 142 | [self addSubview: doneBtn]; 143 | [self addSubview: camButton]; 144 | 145 | [imageView setImage: [[self resourcesImage:@"smsview.bundle/MessageEntryBackground.png"] stretchableImageWithLeftCapWidth:13 topCapHeight:22]]; 146 | [entryImageView setImage: [[self resourcesImage:@"smsview.bundle/MessageEntryInputField.png"] stretchableImageWithLeftCapWidth:13 topCapHeight:22]]; 147 | [doneBtn setBackgroundImage: [[self resourcesImage:@"smsview.bundle/MessageEntrySendButton.png"] stretchableImageWithLeftCapWidth:13 topCapHeight:0] forState:UIControlStateNormal]; 148 | [doneBtn setBackgroundImage: [[self resourcesImage:@"smsview.bundle/MessageEntrySendButton.png"] stretchableImageWithLeftCapWidth:13 topCapHeight:0] forState:UIControlStateSelected]; 149 | [camButton setBackgroundImage: [self resourcesImage:@"smsview.bundle/cameraButtonN.png"] forState:UIControlStateNormal]; 150 | [camButton setBackgroundImage: [self resourcesImage:@"smsview.bundle/cameraButtonP.png"] forState:UIControlStateSelected]; 151 | 152 | } 153 | 154 | CGFloat w = CGRectGetWidth(self.superview.frame); 155 | CGFloat h = (float)CGRectGetHeight(self.superview.frame) - bottom; 156 | CGFloat height = 40; 157 | 158 | [self setFrame: CGRectMake(0, h - height, w, height)]; 159 | [imageView setFrame: CGRectMake(0, 0, w, height)]; 160 | [textView setFrame: CGRectMake(6, 3, w - 80, height)]; 161 | [entryImageView setFrame: CGRectMake(5, 0, w-72, height)]; 162 | [doneBtn setFrame: CGRectMake(w - 69, 8, 63, 27)]; 163 | 164 | if(self.hasCam) 165 | { 166 | [textView setFrame: CGRectMake(41, 3, w - 116, height)]; 167 | [entryImageView setFrame: CGRectMake(40, 0, w-107, height)]; 168 | [camButton setFrame: CGRectMake(5, 7, 30, 30)]; 169 | } 170 | [[self doneBtn].titleLabel setAdjustsFontSizeToFitWidth:YES]; 171 | 172 | // still a little buggy here 173 | [[self textView] setText:self.text]; 174 | } 175 | 176 | -(void)setCamera:(BOOL)val 177 | { 178 | self.hasCam = val; 179 | } 180 | 181 | -(void)disableDoneButon:(BOOL)arg 182 | { 183 | if(arg == NO || !arg) 184 | [[self doneBtn] setEnabled:YES]; 185 | if(arg == YES) 186 | [[self doneBtn] setEnabled:NO]; 187 | } 188 | 189 | -(void)disableCamButon:(BOOL)arg 190 | { 191 | if(arg == NO || !arg) 192 | [[self camButton] setEnabled:YES]; 193 | if(arg == YES) 194 | [[self camButton] setEnabled:NO]; 195 | 196 | } 197 | 198 | - (id)initWithFrame:(CGRect)frame 199 | { 200 | if(self = [super initWithFrame:frame]) 201 | { 202 | self.backgroundColor = [UIColor clearColor]; 203 | } 204 | //[self resize]; 205 | return self; 206 | } 207 | 208 | -(void)doneButtonPressed 209 | { 210 | if ([delegate respondsToSelector:@selector(textViewSendButtonPressed:)]) { 211 | [delegate textViewSendButtonPressed:[self textView].text]; 212 | } 213 | 214 | } 215 | 216 | -(void)camButtonPressed 217 | { 218 | if ([delegate respondsToSelector:@selector(textViewCamButtonPressed:)]) { 219 | [delegate textViewCamButtonPressed:[self textView].text]; 220 | } 221 | 222 | } 223 | 224 | -(void)becomeTextView 225 | { 226 | if ([delegate respondsToSelector:@selector(textViewFocus)]) { 227 | [delegate textViewFocus]; 228 | } 229 | [[self textView] becomeFirstResponder]; 230 | } 231 | 232 | -(void)growingTextViewDidBeginEditing:(HPGrowingTextView *)growingTextView 233 | { 234 | [self becomeTextView]; 235 | } 236 | 237 | -(void)resignTextView 238 | { 239 | if ([delegate respondsToSelector:@selector(textViewBlur)]) { 240 | [delegate textViewBlur]; 241 | } 242 | [[self textView ] resignFirstResponder]; 243 | } 244 | 245 | -(void)emptyTextView 246 | { 247 | [[self textView] setText:@""]; 248 | } 249 | 250 | -(void)growingTextViewDidChange:(HPGrowingTextView *)growingTextView 251 | { 252 | self.text = [self textView].text; 253 | if([delegate respondsToSelector:@selector(textViewTextChange:)]) 254 | { 255 | [delegate textViewTextChange:self.text]; 256 | } 257 | } 258 | 259 | - (void)growingTextView:(HPGrowingTextView *)growingTextView willChangeHeight:(float)height 260 | { 261 | float diff = (self.frame.size.height - height); 262 | 263 | CGRect r = self.frame; 264 | r.size.height -= diff; 265 | r.origin.y += diff; 266 | self.frame = r; 267 | if ([delegate respondsToSelector:@selector(heightOfTextViewDidChange:)]) { 268 | [delegate heightOfTextViewDidChange:diff]; 269 | } 270 | } 271 | 272 | 273 | @end 274 | -------------------------------------------------------------------------------- /Classes/PESMSTextLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // PESMSTextLabel.h 3 | // textfield 4 | // 5 | // Created by Pedro Enrique on 10/26/11. 6 | // Copyright 2011 Appcelerator. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PESMSTextLabel : UILabel 12 | 13 | @property(nonatomic)int index_; 14 | 15 | -(void)addText:(NSString *)text; 16 | -(void)resize:(CGRect)frame; 17 | @end 18 | -------------------------------------------------------------------------------- /Classes/PESMSTextLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // PESMSTextLabel.m 3 | // textfield 4 | // 5 | // Created by Pedro Enrique on 10/26/11. 6 | // Copyright 2011 Appcelerator. All rights reserved. 7 | // 8 | 9 | #import "PESMSTextLabel.h" 10 | 11 | @implementation PESMSTextLabel 12 | @synthesize index_; 13 | 14 | -(void)dealloc 15 | { 16 | // [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:[UIDevice currentDevice]]; 17 | 18 | [super dealloc]; 19 | } 20 | 21 | -(id)init 22 | { 23 | if(self = [super init]) 24 | { 25 | // [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 26 | // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resize:) name:UIDeviceOrientationDidChangeNotification object:[UIDevice currentDevice]]; 27 | } 28 | return self; 29 | } 30 | 31 | -(void)resize:(CGRect)frame 32 | { 33 | if (![NSThread isMainThread]) 34 | [self performSelectorOnMainThread:@selector(resize:) withObject:nil waitUntilDone:NO]; 35 | 36 | float width = frame.size.width - 40; 37 | 38 | self.frame = CGRectMake(20, 0, width, 0); 39 | 40 | [self sizeToFit]; 41 | 42 | CGRect a = self.frame; 43 | 44 | a.size.width = width; 45 | a.origin.x = 20; 46 | 47 | [self setFrame:a]; 48 | 49 | } 50 | 51 | -(void)addText:(NSString *)text 52 | { 53 | if (![NSThread isMainThread]) 54 | [self performSelectorOnMainThread:@selector(addText:) withObject:text waitUntilDone:NO]; 55 | self.text = text; 56 | self.font = [UIFont boldSystemFontOfSize:14]; 57 | self.textColor = [UIColor grayColor]; 58 | self.backgroundColor = [UIColor clearColor]; 59 | self.textAlignment = UITextAlignmentCenter; 60 | self.numberOfLines = 0; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Classes/TiSmsviewModule.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Your Copyright Here 3 | * 4 | * Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc. 5 | * and licensed under the Apache Public License (version 2) 6 | */ 7 | #import "TiModule.h" 8 | 9 | @interface TiSmsviewModule : TiModule 10 | { 11 | } 12 | 13 | @property(nonatomic,readonly) NSNumber *RETURNKEY_DEFAULT; 14 | @property(nonatomic,readonly) NSNumber *RETURNKEY_GO; 15 | @property(nonatomic,readonly) NSNumber *RETURNKEY_GOOGLE; 16 | @property(nonatomic,readonly) NSNumber *RETURNKEY_JOIN; 17 | @property(nonatomic,readonly) NSNumber *RETURNKEY_NEXT; 18 | @property(nonatomic,readonly) NSNumber *RETURNKEY_ROUTE; 19 | @property(nonatomic,readonly) NSNumber *RETURNKEY_SEARCH; 20 | @property(nonatomic,readonly) NSNumber *RETURNKEY_SEND; 21 | @property(nonatomic,readonly) NSNumber *RETURNKEY_YAHOO; 22 | @property(nonatomic,readonly) NSNumber *RETURNKEY_DONE; 23 | @property(nonatomic,readonly) NSNumber *RETURNKEY_EMERGENCY_CALL; 24 | 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Classes/TiSmsviewModule.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Your Copyright Here 3 | * 4 | * Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc. 5 | * and licensed under the Apache Public License (version 2) 6 | */ 7 | #import "TiSmsviewModule.h" 8 | #import "TiBase.h" 9 | #import "TiHost.h" 10 | #import "TiUtils.h" 11 | 12 | @implementation TiSmsviewModule 13 | 14 | MAKE_SYSTEM_PROP(RETURNKEY_DEFAULT,UIReturnKeyDefault); 15 | MAKE_SYSTEM_PROP(RETURNKEY_GO,UIReturnKeyGo); 16 | MAKE_SYSTEM_PROP(RETURNKEY_GOOGLE,UIReturnKeyGoogle); 17 | MAKE_SYSTEM_PROP(RETURNKEY_JOIN,UIReturnKeyJoin); 18 | MAKE_SYSTEM_PROP(RETURNKEY_NEXT,UIReturnKeyNext); 19 | MAKE_SYSTEM_PROP(RETURNKEY_ROUTE,UIReturnKeyRoute); 20 | MAKE_SYSTEM_PROP(RETURNKEY_SEARCH,UIReturnKeySearch); 21 | MAKE_SYSTEM_PROP(RETURNKEY_SEND,UIReturnKeySend); 22 | MAKE_SYSTEM_PROP(RETURNKEY_YAHOO,UIReturnKeyYahoo); 23 | MAKE_SYSTEM_PROP(RETURNKEY_DONE,UIReturnKeyDone); 24 | MAKE_SYSTEM_PROP(RETURNKEY_EMERGENCY_CALL,UIReturnKeyEmergencyCall); 25 | 26 | #pragma mark Internal 27 | 28 | // this is generated for your module, please do not change it 29 | -(id)moduleGUID 30 | { 31 | return @"8e4fdf7d-b3e7-4ba4-b76a-697113808c33"; 32 | } 33 | 34 | // this is generated for your module, please do not change it 35 | -(NSString*)moduleId 36 | { 37 | return @"ti.Smsview"; 38 | } 39 | 40 | #pragma mark Lifecycle 41 | 42 | -(void)startup 43 | { 44 | // this method is called when the module is first loaded 45 | // you *must* call the superclass 46 | [super startup]; 47 | 48 | NSLog(@"[INFO] %@ loaded",self); 49 | } 50 | 51 | -(void)shutdown:(id)sender 52 | { 53 | // this method is called when the module is being unloaded 54 | // typically this is during shutdown. make sure you don't do too 55 | // much processing here or the app will be quit forceably 56 | 57 | // you *must* call the superclass 58 | [super shutdown:sender]; 59 | } 60 | 61 | #pragma mark Cleanup 62 | 63 | -(void)dealloc 64 | { 65 | // release any resources that have been retained by the module 66 | [super dealloc]; 67 | } 68 | 69 | #pragma mark Internal Memory Management 70 | 71 | -(void)didReceiveMemoryWarning:(NSNotification*)notification 72 | { 73 | // optionally release any resources that can be dynamically 74 | // reloaded once memory is available - such as caches 75 | [super didReceiveMemoryWarning:notification]; 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /Classes/TiSmsviewModuleAssets.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a generated file. Do not edit or your changes will be lost 3 | */ 4 | 5 | @interface TiSmsviewModuleAssets : NSObject 6 | { 7 | } 8 | - (NSData*) moduleAsset; 9 | @end 10 | -------------------------------------------------------------------------------- /Classes/TiSmsviewModuleAssets.m: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a generated file. Do not edit or your changes will be lost 3 | */ 4 | #import "TiSmsviewModuleAssets.h" 5 | 6 | extern NSData * dataWithHexString (NSString * hexString); 7 | 8 | @implementation TiSmsviewModuleAssets 9 | 10 | - (NSData*) moduleAsset 11 | { 12 | return nil; 13 | } 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Classes/TiSmsviewView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PecTfTextField.h 3 | // textfield 4 | // 5 | // Created by Pedro Enrique on 7/3/11. 6 | // Copyright 2011 Appcelerator. All rights reserved. 7 | // 8 | 9 | #import "TiUIView.h" 10 | #import "PESMSTextArea.h" 11 | #import "PESMSScrollView.h" 12 | 13 | 14 | @interface TiSmsviewView : TiUIView { 15 | PESMSTextArea *textArea; 16 | PESMSScrollView *scrollView; 17 | BOOL deallocOnce; 18 | NSString *value; 19 | UITapGestureRecognizer *clickGestureRecognizer; 20 | } 21 | 22 | @property(nonatomic, retain)NSString *value; 23 | @property(nonatomic, retain)NSString *folder; 24 | @property(nonatomic, retain)NSString *buttonTitle; 25 | @property(nonatomic)BOOL firstTime; 26 | @property(nonatomic)UIReturnKeyType returnType; 27 | @property(nonatomic, retain)WebFont* font; 28 | @property(nonatomic, retain)TiColor *textColor; 29 | @property(nonatomic)UITextAlignment textAlignment; 30 | @property(nonatomic)BOOL autocorrect; 31 | @property(nonatomic)BOOL beditable; 32 | @property(nonatomic)BOOL hasCam; 33 | @property(nonatomic)BOOL shouldAnimate; 34 | @property(nonatomic)BOOL sendDisabled; 35 | @property(nonatomic)BOOL camDisabled; 36 | @property(nonatomic)BOOL hasTabbar; 37 | @property(nonatomic)float bottomOfWin; 38 | 39 | -(void)sendImageView:(TiUIView *)view; 40 | -(void)recieveImageView:(TiUIView *)view; 41 | -(void)sendImage:(UIImage *)image; 42 | -(void)recieveImage:(UIImage *)image; 43 | -(void)sendMessage:(NSString *)msg; 44 | -(void)recieveMessage:(NSString *)msg; 45 | -(void)addLabel:(NSString *)msg; 46 | -(void)_blur; 47 | -(void)_focus; 48 | -(void)empty; 49 | -(NSArray *)getMessages; 50 | @end 51 | -------------------------------------------------------------------------------- /Classes/TiSmsviewView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PecTfTextField.m 3 | // textfield 4 | // 5 | // Created by Pedro Enrique on 7/3/11. 6 | // Copyright 2011 Appcelerator. All rights reserved. 7 | // 8 | 9 | #import "TiSmsviewView.h" 10 | #import "TiBase.h" 11 | #import "TiUtils.h" 12 | #import "TiHost.h" 13 | 14 | 15 | @implementation TiSmsviewView 16 | @synthesize value; 17 | @synthesize firstTime; 18 | @synthesize returnType; 19 | @synthesize font; 20 | @synthesize textColor; 21 | @synthesize textAlignment; 22 | @synthesize autocorrect; 23 | @synthesize beditable; 24 | @synthesize hasCam; 25 | @synthesize folder; 26 | @synthesize buttonTitle; 27 | @synthesize shouldAnimate; 28 | @synthesize sendDisabled; 29 | @synthesize camDisabled; 30 | @synthesize hasTabbar; 31 | @synthesize bottomOfWin; 32 | 33 | -(void)dealloc 34 | { 35 | RELEASE_TO_NIL(textArea); 36 | RELEASE_TO_NIL(scrollView); 37 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; 38 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; 39 | 40 | [super dealloc]; 41 | } 42 | 43 | -(id)init 44 | { 45 | if(self = [super init]) 46 | { 47 | self.firstTime = YES; 48 | self.autocorrect = YES; 49 | self.beditable = YES; 50 | self.hasCam = NO; 51 | self.shouldAnimate = YES; 52 | self.sendDisabled = NO; 53 | self.camDisabled = NO; 54 | self.hasTabbar = NO; 55 | self.bottomOfWin = 0.0; 56 | } 57 | return self; 58 | } 59 | 60 | #pragma mark UI Elements 61 | 62 | -(PESMSTextArea *)textArea 63 | { 64 | if(!textArea){ 65 | textArea = [[PESMSTextArea alloc] initWithFrame:self.frame]; 66 | textArea.delegate = self; 67 | } 68 | return textArea; 69 | } 70 | 71 | -(PESMSScrollView *)scrollView 72 | { 73 | if(!scrollView) 74 | { 75 | CGFloat h = CGRectGetHeight(self.frame); 76 | CGRect a = self.frame; 77 | a.size.height = h - 40; 78 | a.origin.y = 0; 79 | scrollView = [[PESMSScrollView alloc] initWithFrame:a]; 80 | clickGestureRecognizer = [[UITapGestureRecognizer alloc] 81 | initWithTarget:self action:@selector(handleClick:)]; 82 | clickGestureRecognizer.numberOfTapsRequired = 1; 83 | [scrollView addGestureRecognizer:clickGestureRecognizer]; 84 | } 85 | return scrollView; 86 | } 87 | 88 | #pragma mark Keyboard stuff 89 | 90 | -(NSInteger)keyboardHeight:(NSNotification *)val 91 | { 92 | // get keyboard size and location 93 | NSDictionary* info = [val userInfo]; 94 | NSValue* aValue = [info objectForKey:UIKeyboardFrameEndUserInfoKey]; 95 | CGSize keyboardSize = [aValue CGRectValue].size; 96 | int tabHeight = 0; 97 | if(self.hasTabbar == YES){ 98 | tabHeight = 49; 99 | } 100 | 101 | if ([[UIApplication sharedApplication]statusBarOrientation] == UIDeviceOrientationPortrait || 102 | [[UIApplication sharedApplication]statusBarOrientation] == UIDeviceOrientationPortraitUpsideDown) 103 | self.bottomOfWin = keyboardSize.height - tabHeight; 104 | else 105 | self.bottomOfWin = keyboardSize.width - tabHeight; 106 | 107 | return self.bottomOfWin; 108 | } 109 | 110 | //Code from Brett Schumann 111 | -(void) keyboardWillShow:(NSNotification *)note{ 112 | 113 | // get the height since this is the main value that we need. 114 | NSInteger kbSizeH = [self keyboardHeight:note]; 115 | 116 | // get a rect for the textView frame 117 | CGRect containerFrame = [self textArea].frame; 118 | containerFrame.origin.y -= kbSizeH; 119 | CGRect scrollViewFrame = [self scrollView].frame; 120 | scrollViewFrame.size.height -=kbSizeH; 121 | 122 | // animations settings 123 | [UIView beginAnimations:nil context:NULL]; 124 | [UIView setAnimationBeginsFromCurrentState:YES]; 125 | [UIView setAnimationDuration:0.25f]; 126 | 127 | // set views with new info 128 | [self scrollView].frame = scrollViewFrame; 129 | [self textArea].frame = containerFrame; 130 | 131 | // commit animations 132 | [UIView commitAnimations]; 133 | [[self scrollView] reloadContentSize]; 134 | } 135 | 136 | 137 | -(void) keyboardWillHide:(NSNotification *)note{ 138 | 139 | // get the height since this is the main value that we need. 140 | NSInteger kbSizeH = [self keyboardHeight:note]; 141 | 142 | // get a rect for the textView frame 143 | CGRect containerFrame = [self textArea].frame; 144 | containerFrame.origin.y += kbSizeH; 145 | CGRect scrollViewFrame = [self scrollView].frame; 146 | scrollViewFrame.size.height +=kbSizeH; 147 | 148 | // animations settings 149 | [UIView beginAnimations:nil context:NULL]; 150 | [UIView setAnimationBeginsFromCurrentState:YES]; 151 | [UIView setAnimationDuration:0.25f]; 152 | 153 | // set views with new info 154 | [[self scrollView]setFrame: scrollViewFrame]; 155 | [[self textArea] setFrame: containerFrame]; 156 | 157 | // commit animations 158 | [UIView commitAnimations]; 159 | self.bottomOfWin = 0.0; 160 | } 161 | 162 | -(void)heightOfTextViewDidChange:(float)height 163 | { 164 | CGRect scrollViewFrame = [self scrollView].frame; 165 | scrollViewFrame.size.height +=height; 166 | [[self scrollView]setFrame: scrollViewFrame]; 167 | [[self scrollView] reloadContentSize]; 168 | } 169 | 170 | #pragma mark methods to be used in Javascript 171 | 172 | -(void)_blur 173 | { 174 | [[[self textArea] textView] performSelectorOnMainThread:@selector(resignFirstResponder) withObject:nil waitUntilDone:YES]; 175 | } 176 | -(void)_focus 177 | { 178 | [[[self textArea] textView] performSelectorOnMainThread:@selector(becomeFirstResponder) withObject:nil waitUntilDone:YES]; 179 | } 180 | 181 | -(void)sendImage:(UIImage *)image 182 | { 183 | ENSURE_UI_THREAD(sendImage, image); 184 | [[self scrollView] sendImage:image]; 185 | [[self scrollView] reloadContentSize]; 186 | } 187 | -(void)recieveImage:(UIImage *)image 188 | { 189 | ENSURE_UI_THREAD(recieveImage, image); 190 | [[self scrollView] recieveImage:image]; 191 | [[self scrollView] reloadContentSize]; 192 | } 193 | 194 | -(void)sendImageView:(TiUIView *)view 195 | { 196 | ENSURE_UI_THREAD(sendImageView, view); 197 | [[self scrollView] sendImageView:view]; 198 | [[self scrollView] reloadContentSize]; 199 | } 200 | -(void)recieveImageView:(TiUIView *)view 201 | { 202 | ENSURE_UI_THREAD(recieveImageView, view); 203 | [[self scrollView] recieveImageView:view]; 204 | [[self scrollView] reloadContentSize]; 205 | } 206 | 207 | -(void)sendMessage:(NSString *)msg 208 | { 209 | ENSURE_UI_THREAD(sendMessage,msg); 210 | if([msg isEqualToString:@""]) 211 | return; 212 | [[self scrollView] sendMessage:msg]; 213 | [[self scrollView] reloadContentSize]; 214 | } 215 | 216 | -(void)recieveMessage:(NSString *)msg 217 | { 218 | ENSURE_UI_THREAD(recieveMessage, msg); 219 | if([msg isEqualToString:@""]) 220 | return; 221 | [[self scrollView] recieveMessage:msg]; 222 | [[self scrollView] reloadContentSize]; 223 | } 224 | 225 | -(void)addLabel:(NSString *)msg 226 | { 227 | ENSURE_UI_THREAD(addLabel,msg); 228 | if([msg isEqualToString:@""]) 229 | return; 230 | [[self scrollView] animate:NO]; 231 | [[self scrollView] addLabel:msg]; 232 | [[self scrollView] reloadContentSize]; 233 | [[self scrollView] animate:self.shouldAnimate]; 234 | } 235 | 236 | -(void)empty 237 | { 238 | [[self scrollView] empty]; 239 | } 240 | 241 | -(NSArray *)getMessages 242 | { 243 | return [[self scrollView] allMessages]; 244 | } 245 | 246 | #pragma mark Event listeners 247 | 248 | -(void)textViewCamButtonPressed:(NSString *)text 249 | { 250 | NSMutableDictionary *tiEvent = [NSMutableDictionary dictionary]; 251 | [tiEvent setObject:text forKey:@"value"]; 252 | [self.proxy fireEvent:@"camButtonClicked" withObject:tiEvent]; 253 | } 254 | 255 | -(void)textViewSendButtonPressed:(NSString *)text 256 | { 257 | NSMutableDictionary *tiEvent = [NSMutableDictionary dictionary]; 258 | [tiEvent setObject:text forKey:@"value"]; 259 | [self.proxy fireEvent:@"buttonClicked" withObject:tiEvent]; 260 | [[self textArea] emptyTextView]; 261 | [[self scrollView] reloadContentSize]; 262 | } 263 | -(void)textViewTextChange:(NSString *)text 264 | { 265 | NSMutableDictionary *tiEvent = [NSMutableDictionary dictionary]; 266 | [tiEvent setObject:text forKey:@"value"]; 267 | [self.proxy fireEvent:@"change" withObject:tiEvent]; 268 | 269 | self.value = text; 270 | } 271 | 272 | 273 | -(void)handleClick:(UITapGestureRecognizer*)recognizer 274 | { 275 | NSMutableDictionary *tiEvent = [NSMutableDictionary dictionary]; 276 | 277 | id view = recognizer.view; 278 | CGPoint loc = [recognizer locationInView:view]; 279 | id subview = [view hitTest:loc withEvent:nil]; 280 | NSString *where; 281 | if([subview isKindOfClass: [PESMSLabel class]]) 282 | { 283 | PESMSLabel * a = subview; 284 | where = @"message"; 285 | if(a.isText) 286 | [tiEvent setObject:a.textValue forKey:@"text"]; 287 | if(a.isImage) 288 | { 289 | TiBlob *blob = [[[TiBlob alloc] initWithImage:a.imageValue] autorelease]; 290 | [tiEvent setObject:blob forKey:@"image"]; 291 | 292 | } 293 | if(a.isView) 294 | [tiEvent setObject:a.prox forKey:@"view"]; 295 | [tiEvent setObject:[NSString stringWithFormat:@"%i",a.index_] forKey:@"index"]; 296 | } else { 297 | where = @"scrollView"; 298 | [tiEvent setObject:@"scrollView" forKey:@"scrollView"]; 299 | } 300 | [tiEvent setObject:where forKey:@"where"]; 301 | [self.proxy fireEvent:@"click" withObject:tiEvent]; 302 | [self.proxy fireEvent:@"messageClicked" withObject:tiEvent]; 303 | 304 | } 305 | 306 | 307 | -(void)label:(NSSet *)touches withEvent:(UIEvent *)event :(UIImage *)image :(NSString *)text :(TiProxy *)view 308 | { 309 | 310 | NSMutableDictionary *tiEvent = [NSMutableDictionary dictionary]; 311 | if(text) 312 | [tiEvent setObject:text forKey:@"text"]; 313 | if(image) 314 | { 315 | TiBlob *blob = [[[TiBlob alloc] initWithImage:image] autorelease]; 316 | [tiEvent setObject:blob forKey:@"image"]; 317 | } 318 | if(view) 319 | { 320 | [tiEvent setObject:view forKey:@"view"]; 321 | } 322 | [self.proxy fireEvent:@"messageClicked" withObject:tiEvent]; 323 | } 324 | 325 | -(void)changeHeightOfScrollView 326 | { 327 | // Empty for now, we don't need this, it is completely useless for the JS app 328 | } 329 | 330 | #pragma mark Titanium's resize/init function 331 | 332 | -(void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds 333 | { 334 | [TiUtils setView:self positionRect:self.superview.bounds]; 335 | 336 | CGRect a = self.frame; 337 | CGFloat h = CGRectGetHeight(self.frame); 338 | float meh = h - 40; 339 | a.size.height = meh; 340 | 341 | if(self.firstTime == YES) 342 | { 343 | self.firstTime = NO; 344 | [self addSubview: [self scrollView]]; 345 | [self addSubview: [self textArea]]; 346 | if(![self.proxy valueForUndefinedKey:@"backgroundColor"]) 347 | self.backgroundColor = [[TiUtils colorValue:(id)@"#dae1eb"] _color]; 348 | 349 | if(self.returnType) 350 | [[[self textArea] textView] setReturnKeyType:self.returnType]; 351 | if(self.font) 352 | [[[self textArea] textView] setFont:[self.font font]]; 353 | if(self.textColor) 354 | [[[self textArea] textView] setTextColor:[self.textColor _color]]; 355 | if(self.textAlignment) 356 | [[[self textArea] textView] setTextAlignment:self.textAlignment]; 357 | if(self.value) 358 | [[[self textArea] textView]setText:self.value]; 359 | if(self.folder) 360 | { 361 | [[self textArea] setFolder:self.folder]; 362 | [[self scrollView] setFolder:self.folder]; 363 | } 364 | if(self.buttonTitle) 365 | [[self textArea] buttonTitle:self.buttonTitle]; 366 | [[self textArea] setCamera:self.hasCam]; 367 | [[[self textArea] textView] setEditable:self.beditable]; 368 | [[[self textArea] textView] setAutocorrectionType:self.autocorrect ? UITextAutocorrectionTypeYes : UITextAutocorrectionTypeNo]; 369 | [[[self textArea] textView] setDataDetectorTypes:UIDataDetectorTypeAll]; 370 | if(self.sendDisabled) 371 | [[self textArea] disableDoneButon:self.sendDisabled]; 372 | if(self.camDisabled) 373 | [[self textArea] disableCamButon:self.camDisabled]; 374 | 375 | 376 | } 377 | [[self scrollView] setFrame:a]; 378 | [[self scrollView] reloadContentSize]; 379 | [[self textArea] resize:self.bottomOfWin]; 380 | } 381 | 382 | #pragma mark Titanium's setters 383 | 384 | -(void)setCamButton_:(id)args 385 | { 386 | self.hasCam = [TiUtils boolValue:args]; 387 | if(!self.firstTime) 388 | { 389 | [[self textArea] setCamera:self.hasCam]; 390 | [[self textArea] resize:self.bottomOfWin]; 391 | } 392 | } 393 | 394 | -(void)setSendColor_:(id)col 395 | { 396 | [[self scrollView] performSelectorOnMainThread:@selector(sendColor:) withObject:[TiUtils stringValue:col] waitUntilDone:YES]; 397 | } 398 | 399 | -(void)setRecieveColor_:(id)col 400 | { 401 | [[self scrollView] performSelectorOnMainThread:@selector(recieveColor:) withObject:[TiUtils stringValue:col] waitUntilDone:YES]; 402 | 403 | } 404 | 405 | -(void)setSelectedColor_:(id)col 406 | { 407 | [[self scrollView] performSelectorOnMainThread:@selector(selectedColor:) withObject:[TiUtils stringValue:col] waitUntilDone:YES]; 408 | } 409 | 410 | -(void)setButtonTitle_:(id)title 411 | { 412 | self.buttonTitle = [TiUtils stringValue:title]; 413 | if(!self.firstTime) 414 | { 415 | [[self textArea] buttonTitle:[TiUtils stringValue:title]]; 416 | [[self scrollView] reloadContentSize]; 417 | } 418 | } 419 | 420 | -(void)setReturnKeyType_:(id)val 421 | { 422 | self.returnType = [TiUtils intValue:val]; 423 | if(!self.firstTime) 424 | [[[self textArea] textView] setReturnKeyType:self.returnType]; 425 | } 426 | 427 | -(void)setFont_:(id)val 428 | { 429 | self.font = [TiUtils fontValue:val def:nil]; 430 | if(!self.firstTime) 431 | [[[self textArea] textView] setFont:[self.font font]]; 432 | } 433 | 434 | -(void)setTextColor_:(id)val 435 | { 436 | self.textColor = [TiUtils colorValue:val]; 437 | if(!self.firstTime) 438 | [[[self textArea] textView] setTextColor:[self.textColor _color]]; 439 | } 440 | 441 | -(void)setTextAlignment_:(id)val 442 | { 443 | self.textAlignment = [TiUtils textAlignmentValue:val]; 444 | if(!self.firstTime) 445 | [[[self textArea] textView] setTextAlignment:self.textAlignment]; 446 | } 447 | 448 | -(void)setAutocorrect_:(id)val 449 | { 450 | self.autocorrect = [TiUtils boolValue:val]; 451 | if(!self.firstTime) 452 | [[[self textArea] textView ]setAutocorrectionType:[TiUtils boolValue:val] ? UITextAutocorrectionTypeYes : UITextAutocorrectionTypeNo]; 453 | } 454 | 455 | -(void)setEditable_:(id)val 456 | { 457 | self.beditable = [TiUtils boolValue:val]; 458 | if(!self.firstTime) 459 | [[[self textArea] textView] setEditable:self.beditable]; 460 | } 461 | 462 | -(void)setValue_:(id)val 463 | { 464 | self.value = [TiUtils stringValue:val]; 465 | if(!self.firstTime) 466 | [[[self textArea] textView]setText:self.value]; 467 | } 468 | 469 | -(void)setAnimated_:(id)args 470 | { 471 | [[self scrollView] animate:[TiUtils boolValue:args]]; 472 | self.shouldAnimate = [TiUtils boolValue:args]; 473 | } 474 | 475 | -(void)setAssets_:(id)args 476 | { 477 | self.folder = [[TiUtils stringValue:args] stringByAppendingString:@"/"]; 478 | if(!self.firstTime) 479 | { 480 | [[self textArea] setFolder:args]; 481 | [[self scrollView] setFolder:args]; 482 | } 483 | } 484 | 485 | -(void)setReturnType_:(id)arg 486 | { 487 | self.returnType = [TiUtils boolValue:arg]; 488 | if(!self.firstTime) 489 | [[[self textArea] textView] setReturnKeyType:self.returnType]; 490 | } 491 | 492 | -(void)setMaxLines_:(id)arg 493 | { 494 | [[self textArea] setMaxLines:[TiUtils intValue:arg]]; 495 | } 496 | 497 | -(void)setMinLines_:(id)arg 498 | { 499 | [[self textArea] setMinLines:[TiUtils intValue:arg]]; 500 | } 501 | 502 | -(void)setSendButtonDisabled_:(id)arg 503 | { 504 | self.sendDisabled = [TiUtils boolValue:arg]; 505 | if(!self.firstTime) 506 | { 507 | [[self textArea] disableDoneButon:self.sendDisabled]; 508 | } 509 | } 510 | 511 | -(void)setHasTab_:(id)args 512 | { 513 | self.hasTabbar = [TiUtils boolValue:args]; 514 | } 515 | 516 | -(void)setCamButtonDisabled_:(id)arg 517 | { 518 | self.camDisabled = [TiUtils boolValue:arg]; 519 | if(!self.firstTime) 520 | { 521 | [[self textArea] disableCamButon:self.camDisabled]; 522 | } 523 | } 524 | 525 | @end 526 | -------------------------------------------------------------------------------- /Classes/TiSmsviewViewProxy.h: -------------------------------------------------------------------------------- 1 | // 2 | // PecTfTextFieldProxy.h 3 | // textfield 4 | // 5 | // Created by Pedro Enrique on 7/3/11. 6 | // Copyright 2011 Appcelerator. All rights reserved. 7 | // 8 | 9 | #import "TiViewProxy.h" 10 | 11 | 12 | @interface TiSmsviewViewProxy : TiViewProxy { 13 | TiSmsviewView *ourView; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Classes/TiSmsviewViewProxy.m: -------------------------------------------------------------------------------- 1 | // 2 | // PecTfTextFieldProxy.m 3 | // textfield 4 | // 5 | // Created by Pedro Enrique on 7/3/11. 6 | // Copyright 2011 Appcelerator. All rights reserved. 7 | // 8 | 9 | #import "TiSmsviewView.h" 10 | #import "TiSmsviewViewProxy.h" 11 | #import "TiUtils.h" 12 | #import "UIImage+Resize.h" 13 | 14 | @implementation TiSmsviewViewProxy 15 | 16 | -(void)_destroy 17 | { 18 | // This method is called from the dealloc method and is good place to 19 | // release any objects and memory that have been allocated for the view proxy. 20 | [super _destroy]; 21 | } 22 | 23 | -(void)dealloc 24 | { 25 | // This method is called when the view proxy is being deallocated. The superclass 26 | // method calls the _destroy method. 27 | 28 | [super dealloc]; 29 | } 30 | 31 | -(TiSmsviewView *)ourView 32 | { 33 | if(!ourView) 34 | { 35 | ourView = (TiSmsviewView *)[self view]; 36 | } 37 | return ourView; 38 | } 39 | 40 | -(void)viewDidAttach 41 | { 42 | [[NSNotificationCenter defaultCenter] addObserver:[self ourView] 43 | selector:@selector(keyboardWillShow:) 44 | name:UIKeyboardWillShowNotification 45 | object:nil]; 46 | 47 | [[NSNotificationCenter defaultCenter] addObserver:[self ourView] 48 | selector:@selector(keyboardWillHide:) 49 | name:UIKeyboardWillHideNotification 50 | object:nil]; 51 | [self retain]; 52 | [super viewDidAttach]; 53 | } 54 | 55 | -(void)viewDidDetach 56 | { 57 | [self autorelease]; 58 | [super viewDidDetach]; 59 | } 60 | 61 | -(void)blur:(id)args 62 | { 63 | ENSURE_UI_THREAD(blur, args); 64 | 65 | if([self viewAttached]) 66 | { 67 | [[self ourView] _blur]; 68 | } 69 | } 70 | 71 | -(void)focus:(id)args 72 | { 73 | ENSURE_UI_THREAD(focus, args); 74 | if([self viewAttached]) 75 | { 76 | [[self ourView] _focus]; 77 | } 78 | } 79 | 80 | 81 | -(UIImage *)returnImage:(id)arg 82 | { 83 | if([self viewAttached]) 84 | { 85 | UIImage *image = nil; 86 | if ([arg isKindOfClass:[UIImage class]]) 87 | { 88 | image = (UIImage*)arg; 89 | } 90 | else if ([arg isKindOfClass:[TiBlob class]]) 91 | { 92 | TiBlob *blob = (TiBlob*)arg; 93 | image = [blob image]; 94 | 95 | } 96 | else 97 | { 98 | NSLog(@"[WARN] The image MUST be a blob."); 99 | NSLog(@"[WARN]"); 100 | NSLog(@"[WARN] This is a workaround:"); 101 | NSLog(@"[WARN]"); 102 | NSLog(@"[WARN] var img = Ti.UI.createImageView({image:'whatever.png'}).toImage();"); 103 | NSLog(@"[WARN] xx.sendMessage(img);"); 104 | NSLog(@"[WARN] or"); 105 | NSLog(@"[WARN] xx.recieveMessage(img);"); 106 | NSLog(@"[WARN]"); 107 | } 108 | 109 | if(image != nil) 110 | { 111 | CGSize imageSize = image.size; 112 | if(imageSize.width > 270.0)//[[self ourView] superview].frame.size.width-100) 113 | { 114 | float x = 270.0;//([[self ourView] superview].frame.size.width-100); 115 | float y = ((x/imageSize.width)*imageSize.height); 116 | CGSize newSize = CGSizeMake(x, y); 117 | image = [UIImageResize resizedImage:newSize interpolationQuality:kCGInterpolationDefault image:image hires:YES]; 118 | } 119 | 120 | } 121 | return image; 122 | } 123 | return nil; 124 | } 125 | 126 | -(void)empty:(id)args 127 | { 128 | ENSURE_UI_THREAD(empty, args); 129 | if([self viewAttached]) 130 | { 131 | [ourView empty]; 132 | } 133 | } 134 | 135 | -(void)sendMessage:(id)args 136 | { 137 | ENSURE_UI_THREAD(sendMessage,args); 138 | ENSURE_TYPE(args, NSArray); 139 | if([self viewAttached]) 140 | { 141 | id arg = [args objectAtIndex:0]; 142 | if([arg isKindOfClass:[NSString class]]) 143 | [ourView sendMessage:arg]; 144 | else if ([arg isKindOfClass:[TiViewProxy class]]) 145 | { 146 | TiViewProxy *a = arg; 147 | [ourView sendImageView:a.view]; 148 | } 149 | else 150 | [ourView sendImage:[self returnImage:arg]]; 151 | } 152 | } 153 | 154 | -(void)recieveMessage:(id)args 155 | { 156 | ENSURE_UI_THREAD(recieveMessage,args); 157 | ENSURE_TYPE(args, NSArray); 158 | if([self viewAttached]) 159 | { 160 | 161 | id arg = [args objectAtIndex:0]; 162 | 163 | if([arg isKindOfClass:[NSString class]]) 164 | [ourView recieveMessage:arg]; 165 | else if ([arg isKindOfClass:[TiViewProxy class]]) 166 | { 167 | TiViewProxy *a = arg; 168 | [ourView recieveImageView:a.view]; 169 | } 170 | else 171 | [ourView recieveImage:[self returnImage:arg]]; 172 | } 173 | } 174 | 175 | -(void)addLabel:(id)args 176 | { 177 | ENSURE_UI_THREAD(addLabel,args); 178 | ENSURE_TYPE(args, NSArray); 179 | if([self viewAttached]) 180 | { 181 | id arg = [TiUtils stringValue: [args objectAtIndex:0]]; 182 | if([arg isKindOfClass:[NSString class]]) 183 | [ourView addLabel:arg]; 184 | } 185 | } 186 | 187 | -(void)loadMessages:(id)args 188 | { 189 | ENSURE_SINGLE_ARG(args,NSArray); 190 | if([self viewAttached]) 191 | { 192 | for(int i = 0; i < [args count]; i++) 193 | { 194 | id obj = [args objectAtIndex:i]; 195 | ENSURE_SINGLE_ARG(obj, NSObject); 196 | if([obj objectForKey:@"send"]) 197 | { 198 | [self sendMessage: [NSArray arrayWithObject:[obj objectForKey:@"send"]]]; 199 | } 200 | if([obj objectForKey:@"recieve"]) 201 | { 202 | [self recieveMessage: [NSArray arrayWithObject:[obj objectForKey:@"recieve"]]]; 203 | } 204 | } 205 | } 206 | } 207 | 208 | -(NSArray *)getAllMessages:(id)arg 209 | { 210 | if([self viewAttached]) 211 | { 212 | return [ourView getMessages]; 213 | } 214 | return nil; 215 | } 216 | 217 | -(id)value 218 | { 219 | if([self viewAttached]) 220 | { 221 | return [[self ourView] value]; 222 | } 223 | return nil; 224 | } 225 | @end 226 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2011 Pedro Enrique 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Most of the magic code taken from: http://www.hanspinckaers.com/multi-line-uitextview-similar-to-sms 2 | 3 | Please, for a demo, look at this: http://www.screenr.com/wVCs 4 | 5 | INSTALL THE MODULE FROM SOURCE 6 | ------------------------------- 7 | 8 | 1. Run `build.py` which creates your distribution 9 | 2. cd to `/Library/Application Support/Titanium` 10 | 3. copy this zip file into the folder of your Titanium SDK 11 | 12 | INSTALLING THE MODULE FROM THE MARKETPLACE 13 | ------------------------------------------ 14 | 15 | 1. Copy the zip file from the marketplace download and place it in the root of your project or the folder of your Titanium SDK 16 | 2. Follow the next step 17 | 18 | REGISTER THE MODULE 19 | --------------------- 20 | 21 | Register the module with your application by editing `tiapp.xml` and adding your module. 22 | Example: 23 | 24 | 25 | ti.smsview 26 | 27 | 28 | When you run your project, the compiler will know automatically compile in the module 29 | dependencies and copy appropriate image assets into the application. 30 | 31 | USING YOUR MODULE IN CODE 32 | ------------------------- 33 | 34 | To use your module in code, you will need to require it. 35 | 36 | For example, 37 | 38 | Titanium.SMSView = require('ti.smsview'); 39 | var smsView = Ti.SMSView.createView(); 40 | 41 | Take a look in the documentation folder for details 42 | 43 | -------------------------------------------------------------------------------- /TiSmsview_Prefix.pch: -------------------------------------------------------------------------------- 1 | 2 | #ifdef __OBJC__ 3 | #import 4 | #endif 5 | -------------------------------------------------------------------------------- /assets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/assets/.DS_Store -------------------------------------------------------------------------------- /assets/README: -------------------------------------------------------------------------------- 1 | Place your assets like PNG files in this directory and they will be packaged with your module. 2 | 3 | If you create a file named pec.tf.js in this directory, it will be 4 | compiled and used as your module. This allows you to run pure Javascript 5 | modules that are pre-compiled. 6 | 7 | -------------------------------------------------------------------------------- /build.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Appcelerator Titanium Module Packager 4 | # 5 | # 6 | import os, sys, glob, string 7 | import zipfile 8 | from datetime import date 9 | 10 | cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename)) 11 | os.chdir(cwd) 12 | required_module_keys = ['name','version','moduleid','description','copyright','license','copyright','platform','minsdk'] 13 | module_defaults = { 14 | 'description':'My module', 15 | 'author': 'Your Name', 16 | 'license' : 'Specify your license', 17 | 'copyright' : 'Copyright (c) %s by Your Company' % str(date.today().year), 18 | } 19 | module_license_default = "TODO: place your license here and we'll include it in the module distribution" 20 | 21 | def replace_vars(config,token): 22 | idx = token.find('$(') 23 | while idx != -1: 24 | idx2 = token.find(')',idx+2) 25 | if idx2 == -1: break 26 | key = token[idx+2:idx2] 27 | if not config.has_key(key): break 28 | token = token.replace('$(%s)' % key, config[key]) 29 | idx = token.find('$(') 30 | return token 31 | 32 | 33 | def read_ti_xcconfig(): 34 | contents = open(os.path.join(cwd,'titanium.xcconfig')).read() 35 | config = {} 36 | for line in contents.splitlines(False): 37 | line = line.strip() 38 | if line[0:2]=='//': continue 39 | idx = line.find('=') 40 | if idx > 0: 41 | key = line[0:idx].strip() 42 | value = line[idx+1:].strip() 43 | config[key] = replace_vars(config,value) 44 | return config 45 | 46 | def generate_doc(config): 47 | docdir = os.path.join(cwd,'documentation') 48 | if not os.path.exists(docdir): 49 | print "Couldn't find documentation file at: %s" % docdir 50 | return None 51 | sdk = config['TITANIUM_SDK'] 52 | support_dir = os.path.join(sdk,'module','support') 53 | sys.path.append(support_dir) 54 | import markdown 55 | documentation = [] 56 | for file in os.listdir(docdir): 57 | md = open(os.path.join(docdir,file)).read() 58 | html = markdown.markdown(md) 59 | documentation.append({file:html}); 60 | return documentation 61 | 62 | def compile_js(manifest,config): 63 | js_file = os.path.join(cwd,'assets','ti.smsview.js') 64 | if not os.path.exists(js_file): return 65 | 66 | sdk = config['TITANIUM_SDK'] 67 | iphone_dir = os.path.join(sdk,'iphone') 68 | sys.path.insert(0,iphone_dir) 69 | from compiler import Compiler 70 | 71 | path = os.path.basename(js_file) 72 | metadata = Compiler.make_function_from_file(path,js_file) 73 | method = metadata['method'] 74 | eq = path.replace('.','_') 75 | method = ' return %s;' % method 76 | 77 | f = os.path.join(cwd,'Classes','TiMsgViewModuleAssets.m') 78 | c = open(f).read() 79 | idx = c.find('return ') 80 | before = c[0:idx] 81 | after = """ 82 | } 83 | 84 | @end 85 | """ 86 | newc = before + method + after 87 | 88 | if newc!=c: 89 | x = open(f,'w') 90 | x.write(newc) 91 | x.close() 92 | 93 | def die(msg): 94 | print msg 95 | sys.exit(1) 96 | 97 | def warn(msg): 98 | print "[WARN] %s" % msg 99 | 100 | def validate_license(): 101 | c = open(os.path.join(cwd,'LICENSE')).read() 102 | if c.find(module_license_default)!=1: 103 | warn('please update the LICENSE file with your license text before distributing') 104 | 105 | def validate_manifest(): 106 | path = os.path.join(cwd,'manifest') 107 | f = open(path) 108 | if not os.path.exists(path): die("missing %s" % path) 109 | manifest = {} 110 | for line in f.readlines(): 111 | line = line.strip() 112 | if line[0:1]=='#': continue 113 | if line.find(':') < 0: continue 114 | key,value = line.split(':') 115 | manifest[key.strip()]=value.strip() 116 | for key in required_module_keys: 117 | if not manifest.has_key(key): die("missing required manifest key '%s'" % key) 118 | if module_defaults.has_key(key): 119 | defvalue = module_defaults[key] 120 | curvalue = manifest[key] 121 | if curvalue==defvalue: warn("please update the manifest key: '%s' to a non-default value" % key) 122 | return manifest,path 123 | 124 | ignoreFiles = ['.DS_Store','.gitignore','libTitanium.a','titanium.jar','README','ti.smsview.js'] 125 | ignoreDirs = ['.DS_Store','.svn','.git','CVSROOT'] 126 | 127 | def zip_dir(zf,dir,basepath,ignore=[]): 128 | for root, dirs, files in os.walk(dir): 129 | for name in ignoreDirs: 130 | if name in dirs: 131 | dirs.remove(name) # don't visit ignored directories 132 | for file in files: 133 | if file in ignoreFiles: continue 134 | e = os.path.splitext(file) 135 | if len(e)==2 and e[1]=='.pyc':continue 136 | from_ = os.path.join(root, file) 137 | to_ = from_.replace(dir, basepath, 1) 138 | zf.write(from_, to_) 139 | 140 | def glob_libfiles(): 141 | files = [] 142 | for libfile in glob.glob('build/**/*.a'): 143 | if libfile.find('Release-')!=-1: 144 | files.append(libfile) 145 | return files 146 | 147 | def build_module(manifest,config): 148 | rc = os.system("xcodebuild -sdk iphoneos -configuration Release") 149 | if rc != 0: 150 | die("xcodebuild failed") 151 | rc = os.system("xcodebuild -sdk iphonesimulator -configuration Release") 152 | if rc != 0: 153 | die("xcodebuild failed") 154 | # build the merged library using lipo 155 | moduleid = manifest['moduleid'] 156 | libpaths = '' 157 | for libfile in glob_libfiles(): 158 | libpaths+='%s ' % libfile 159 | 160 | os.system("lipo %s -create -output build/lib%s.a" %(libpaths,moduleid)) 161 | 162 | def package_module(manifest,mf,config): 163 | name = manifest['name'].lower() 164 | moduleid = manifest['moduleid'].lower() 165 | version = manifest['version'] 166 | modulezip = '%s-iphone-%s.zip' % (moduleid,version) 167 | if os.path.exists(modulezip): os.remove(modulezip) 168 | zf = zipfile.ZipFile(modulezip, 'w', zipfile.ZIP_DEFLATED) 169 | modulepath = 'modules/iphone/%s/%s' % (moduleid,version) 170 | zf.write(mf,'%s/manifest' % modulepath) 171 | libname = 'lib%s.a' % moduleid 172 | zf.write('build/%s' % libname, '%s/%s' % (modulepath,libname)) 173 | docs = generate_doc(config) 174 | if docs!=None: 175 | for doc in docs: 176 | for file, html in doc.iteritems(): 177 | filename = string.replace(file,'.md','.html') 178 | zf.writestr('%s/documentation/%s'%(modulepath,filename),html) 179 | for dn in ('assets','example','platform'): 180 | if os.path.exists(dn): 181 | zip_dir(zf,dn,'%s/%s' % (modulepath,dn),['README']) 182 | zf.write('LICENSE','%s/LICENSE' % modulepath) 183 | zf.write('module.xcconfig','%s/module.xcconfig' % modulepath) 184 | zf.close() 185 | 186 | 187 | if __name__ == '__main__': 188 | manifest,mf = validate_manifest() 189 | validate_license() 190 | config = read_ti_xcconfig() 191 | compile_js(manifest,config) 192 | build_module(manifest,config) 193 | package_module(manifest,mf,config) 194 | sys.exit(0) 195 | 196 | -------------------------------------------------------------------------------- /documentation/index.md: -------------------------------------------------------------------------------- 1 | # Pedro Module 2 | 3 | ## Description 4 | 5 | This module contains the SMS-like view for texting with the autoresizable text area and the "balloons" for the messages 6 | 7 | ## Accessing the textfield Module 8 | 9 | To access this module from JavaScript, you would do the following: 10 | 11 | Titanium.SMSView = require("ti.smsview"); 12 | 13 | ## Author 14 | 15 | Pedro Enrique, also known as @pec1985 and @pecdev 16 | With the help of Hans Pinckaers who created the HPGrowingTextView 17 | 18 | ## License 19 | 20 | Copyright 2011 Pedro Enrique 21 | 22 | Licensed under the Apache License, Version 2.0 (the "License"); 23 | you may not use this file except in compliance with the License. 24 | You may obtain a copy of the License at 25 | 26 | http://www.apache.org/licenses/LICENSE-2.0 27 | 28 | Unless required by applicable law or agreed to in writing, software 29 | distributed under the License is distributed on an "AS IS" BASIS, 30 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 31 | See the License for the specific language governing permissions and 32 | limitations under the License. 33 | -------------------------------------------------------------------------------- /documentation/smsview.md: -------------------------------------------------------------------------------- 1 | # Ti.SMSView.View 2 | 3 | ## Description 4 | 5 | Displays an SMS-like view with the text area, scrollable view, and the message "balloons" 6 | 7 | ## Requirements 8 | 9 | - Minimun Ti SDK is 1.7.2 10 | - Move the smsview.bundle found in the "example" folder and put it your Resources dir 11 | 12 | ## Methods 13 | 14 | ### sendMessage( string or blob ) 15 | 16 | displays a message on the right side of the scrollView 17 | ### recieveMessage( string or blob ) 18 | 19 | displays a message on the left side of the scrollView 20 | 21 | ### loadMessages( array ) 22 | 23 | Loads messages from an array 24 | 25 | Ex: 26 | ``` 27 | loadMessages( 28 | [ 29 | {send:'Hello'}, 30 | {recieve:'World'} 31 | ] 32 | ); 33 | ``` 34 | 35 | ### addLabel( string ) 36 | Inserts a label in the screen 37 | 38 | Ex: 39 | ``` 40 | addLabel( 'Jan 25, 2012' ); 41 | ``` 42 | 43 | ### blur() 44 | 45 | blurs the text area and brings the keyboard down 46 | 47 | ### focus() 48 | 49 | focuses the text area and brings the keyboard up 50 | 51 | ### empty() 52 | 53 | empties the view, clears all messages 54 | 55 | ## Properties 56 | 57 | ### assets 58 | 59 | String 60 | 61 | Folder where the "smsview.bundle" lives relative to the Resources directory. If nothing specified, then it must to places in the Resources itself. 62 | 63 | NOTE: Feel free to modify the contents of the smsview.bundle (it's a folder) 64 | 65 | ### backgroundImage 66 | String or blob 67 | 68 | Backround image of the scroll view 69 | 70 | ### backgroundColor 71 | String 72 | 73 | Backround color of the scroll view 74 | 75 | ### sendColor 76 | String 77 | 78 | Color of the "send" message balloon, these are the options: 79 | 80 | - 'Blue' 81 | - 'Purple' 82 | - 'Green' -- Default 83 | - 'Gray' 84 | - 'White' 85 | 86 | ### recieveColor 87 | 88 | String 89 | 90 | Color of the "recieve" message balloon, these are the options: 91 | 92 | - 'Blue' 93 | - 'Purple' 94 | - 'Green' 95 | - 'Gray' 96 | - 'White' -- Default 97 | 98 | ### selectedColor 99 | 100 | String 101 | 102 | Color of the "recieve" message balloon, these are the options: 103 | 104 | - 'Blue' -- Default 105 | - 'Purple' 106 | - 'Green' 107 | - 'Gray' 108 | - 'White' 109 | 110 | ### buttonTitle 111 | 112 | String 113 | 114 | Title of the "send" button 115 | 116 | ### font 117 | 118 | Dictionary 119 | 120 | Font of the text area, normal Ti font 121 | 122 | ### textColor 123 | 124 | String 125 | 126 | Color of the text in the text area 127 | 128 | ### textAlignment 129 | 130 | String 131 | 132 | Alignment of the text in the text area 133 | 134 | ### autocorrect 135 | 136 | Boolean 137 | 138 | Autocorrect of the text in the text area 139 | 140 | ### editable 141 | 142 | Boolean 143 | 144 | Kinda useless, it makes the text area non writable :) 145 | 146 | ### returnType 147 | 148 | Constant 149 | 150 | Return button of keyboard 151 | 152 | - Ti.SMSView.RETURNKEY_DEFAULT 153 | - Ti.SMSView.RETURNKEY_GO 154 | - Ti.SMSView.RETURNKEY_GOOGLE 155 | - Ti.SMSView.RETURNKEY_JOIN 156 | - Ti.SMSView.RETURNKEY_NEXT 157 | - Ti.SMSView.RETURNKEY_ROUTE 158 | - Ti.SMSView.RETURNKEY_SEARCH 159 | - Ti.SMSView.RETURNKEY_SEND 160 | - Ti.SMSView.RETURNKEY_YAHOO 161 | - Ti.SMSView.RETURNKEY_DONE 162 | - Ti.SMSView.RETURNKEY_EMERGENCY_CALL 163 | 164 | 165 | ### hasTab 166 | 167 | Boolean 168 | 169 | Whether the window where the SMSView is has a bottom tab or not 170 | 171 | ## Events 172 | 173 | ### click 174 | 175 | Fires when the scroll view is clicked. Returns the "image", "view", "text" or "scrollView" property where clicked. 176 | 177 | ### messageClicked 178 | 179 | Identical as above. 180 | 181 | ### buttonClicked 182 | 183 | Fires when the "send" button is clicked 184 | 185 | ### change 186 | 187 | Fires when the value of the text area changed 188 | 189 | ### camButtonClicked 190 | 191 | Fires when a the camera button has been clicked. -------------------------------------------------------------------------------- /example/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2011 Pedro Enrique 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | Titanium.SMSView = require('ti.smsview'); 18 | 19 | var buttonBar = Ti.UI.createButtonBar({ 20 | labels:['Recieve','Empty','Get All','Disable','Enable'], 21 | height:30, 22 | style:Ti.UI.iPhone.SystemButtonStyle.BAR 23 | }); 24 | 25 | var headerView = Ti.UI.createView(); 26 | 27 | headerView.add(buttonBar); 28 | 29 | var win = Ti.UI.createWindow({ 30 | titleControl:buttonBar, 31 | orientationModes:[1,2,3,4], 32 | tabBarHidden:true 33 | }); 34 | 35 | var textArea = Ti.SMSView.createView({ 36 | //maxLines:6, // <--- Defaults to 4 37 | //minLines:2, // <--- Defaults to 1 38 | backgroundColor: '#dae1eb', // <--- Defaults to #dae1eb 39 | assets: 'assets', // <--- Defauls to nothing, smsview.bundle can be placed in the Resources dir 40 | // sendColor: 'Green', // <--- Defaults to "Green" 41 | // recieveColor: 'White', // <--- Defaults to "White" 42 | // selectedColor: 'Blue', // <--- Defaults to "Blue" 43 | // editable: true, // <--- Defautls to true, do no change it 44 | // animated: false, // <--- Defaults to true 45 | // buttonTitle: 'Something', // <--- Defaults to "Send" 46 | // font: { fontSize: 12 ... }, // <--- Defaults to... can't remember 47 | // autocorrect: false, // <--- Defaults to true 48 | // textAlignment: 'left', // <--- Defaulst to left 49 | // textColor: 'blue', // <--- Defaults to "black" 50 | returnType: Ti.SMSView.RETURNKEY_DONE, // <---- Defaults to Ti.SMSView.RETURNKEY_DEFAULT 51 | camButton: true // <--- Defaults to false 52 | // hasTab:true // <--- Defaults to false 53 | 54 | }); 55 | 56 | win.add(textArea); 57 | 58 | buttonBar.addEventListener('click', function(e){ 59 | switch(e.index){ 60 | case 0: textArea.recieveMessage('Hello World!'); break; 61 | case 1: textArea.empty(); break; 62 | case 2: Ti.API.info(textArea.getAllMessages()); break; 63 | /* 64 | the camera button dissable property: 65 | case 3: textArea.camButtonDisabled = true; break; 66 | case 4: textArea.camButtonDisabled = false; break; 67 | */ 68 | case 3: textArea.sendButtonDisabled = true; break; 69 | case 4: textArea.sendButtonDisabled = false; break; 70 | } 71 | }); 72 | 73 | textArea.addEventListener('click', function(e){ 74 | if(e.scrollView){ 75 | textArea.blur(); 76 | } 77 | // fires when clicked on the scroll view 78 | Ti.API.info('Clicked on the scrollview'); 79 | }); 80 | textArea.addEventListener('buttonClicked', function(e){ 81 | // fires when clicked on the send button 82 | textArea.addLabel(new Date()+""); 83 | textArea.sendMessage(e.value); 84 | }); 85 | textArea.addEventListener('camButtonClicked', function(){ 86 | // fires when clicked on the camera button 87 | 88 | var options = Ti.UI.createOptionDialog({ 89 | options: ['Photo Gallery', 'Cancel'], 90 | cancel: 1, 91 | title: 'Send a photo' 92 | }); 93 | options.show(); 94 | options.addEventListener('click', function(e) { 95 | if(e.index == 0){ 96 | // --------------- open the photo gallery and send an image ------------------ 97 | Titanium.Media.openPhotoGallery({ 98 | success: function(event) { 99 | // uncomment to set a specific width, in this case 100 100 | // var image = Ti.UI.createImageView({image:event.media}); 101 | // image.width = 100; 102 | // image.height = (100/event.media.width)*event.media.height 103 | //textArea.sendMessage(image.toBlob()); 104 | textArea.sendMessage(event.media); 105 | }, 106 | mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO] 107 | }); 108 | // --------------------------------------------------------------------------- 109 | } 110 | }); 111 | }); 112 | 113 | textArea.addEventListener('change', function(e){ 114 | Ti.API.info(e.value); 115 | }); 116 | 117 | textArea.addEventListener('messageClicked', function(e){ 118 | // fires when clicked on a message 119 | if(e.text){ 120 | Ti.API.info('Text: '+e.text); 121 | } 122 | if(e.image){ 123 | Ti.API.info('Image: '+e.image); 124 | } 125 | Ti.API.info('Index: ' + e.index); 126 | }); 127 | 128 | var tabGroup = Ti.UI.createTabGroup(); 129 | var tab = Ti.UI.createTab({ 130 | window:win, 131 | title:'SMSView' 132 | }); 133 | tabGroup.addTab(tab); 134 | tabGroup.open(); -------------------------------------------------------------------------------- /example/assets/smsview.bundle/BlueBalloonLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/BlueBalloonLeft.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/BlueBalloonRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/BlueBalloonRight.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/GrayBalloonLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/GrayBalloonLeft.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/GrayBalloonRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/GrayBalloonRight.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/GreenBalloonLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/GreenBalloonLeft.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/GreenBalloonRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/GreenBalloonRight.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/MessageEntryBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/MessageEntryBackground.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/MessageEntryBackground@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/MessageEntryBackground@2x.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/MessageEntryInputField.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/MessageEntryInputField.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/MessageEntryInputField@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/MessageEntryInputField@2x.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/MessageEntrySendButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/MessageEntrySendButton.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/MessageEntrySendButton@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/MessageEntrySendButton@2x.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/MessageEntrySendButtonPressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/MessageEntrySendButtonPressed.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/MessageEntrySendButtonPressed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/MessageEntrySendButtonPressed@2x.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/PurpleBalloonLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/PurpleBalloonLeft.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/PurpleBalloonRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/PurpleBalloonRight.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/WhiteBalloonLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/WhiteBalloonLeft.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/WhiteBalloonRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/WhiteBalloonRight.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/cameraButtonN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/cameraButtonN.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/cameraButtonN@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/cameraButtonN@2x.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/cameraButtonP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/cameraButtonP.png -------------------------------------------------------------------------------- /example/assets/smsview.bundle/cameraButtonP@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/example/assets/smsview.bundle/cameraButtonP@2x.png -------------------------------------------------------------------------------- /hooks/README: -------------------------------------------------------------------------------- 1 | These files are not yet supported as of 1.4.0 but will be in a near future release. 2 | -------------------------------------------------------------------------------- /hooks/add.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module project add hook that will be 4 | # called when your module is added to a project 5 | # 6 | import os, sys 7 | 8 | def dequote(s): 9 | if s[0:1] == '"': 10 | return s[1:-1] 11 | return s 12 | 13 | def main(args,argc): 14 | # You will get the following command line arguments 15 | # in the following order: 16 | # 17 | # project_dir = the full path to the project root directory 18 | # project_type = the type of project (desktop, mobile, ipad) 19 | # project_name = the name of the project 20 | # 21 | project_dir = dequote(os.path.expanduser(args[1])) 22 | project_type = dequote(args[2]) 23 | project_name = dequote(args[3]) 24 | 25 | # TODO: write your add hook here (optional) 26 | 27 | 28 | # exit 29 | sys.exit(0) 30 | 31 | 32 | 33 | if __name__ == '__main__': 34 | main(sys.argv,len(sys.argv)) 35 | 36 | -------------------------------------------------------------------------------- /hooks/install.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module install hook that will be 4 | # called when your module is first installed 5 | # 6 | import os, sys 7 | 8 | def main(args,argc): 9 | 10 | # TODO: write your install hook here (optional) 11 | 12 | # exit 13 | sys.exit(0) 14 | 15 | 16 | 17 | if __name__ == '__main__': 18 | main(sys.argv,len(sys.argv)) 19 | 20 | -------------------------------------------------------------------------------- /hooks/remove.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module project remove hook that will be 4 | # called when your module is remove from a project 5 | # 6 | import os, sys 7 | 8 | def dequote(s): 9 | if s[0:1] == '"': 10 | return s[1:-1] 11 | return s 12 | 13 | def main(args,argc): 14 | # You will get the following command line arguments 15 | # in the following order: 16 | # 17 | # project_dir = the full path to the project root directory 18 | # project_type = the type of project (desktop, mobile, ipad) 19 | # project_name = the name of the project 20 | # 21 | project_dir = dequote(os.path.expanduser(args[1])) 22 | project_type = dequote(args[2]) 23 | project_name = dequote(args[3]) 24 | 25 | # TODO: write your remove hook here (optional) 26 | 27 | # exit 28 | sys.exit(0) 29 | 30 | 31 | 32 | if __name__ == '__main__': 33 | main(sys.argv,len(sys.argv)) 34 | 35 | -------------------------------------------------------------------------------- /hooks/uninstall.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module uninstall hook that will be 4 | # called when your module is uninstalled 5 | # 6 | import os, sys 7 | 8 | def main(args,argc): 9 | 10 | # TODO: write your uninstall hook here (optional) 11 | 12 | # exit 13 | sys.exit(0) 14 | 15 | 16 | if __name__ == '__main__': 17 | main(sys.argv,len(sys.argv)) 18 | 19 | -------------------------------------------------------------------------------- /manifest: -------------------------------------------------------------------------------- 1 | # 2 | # this is your module manifest and used by Titanium 3 | # during compilation, packaging, distribution, etc. 4 | # 5 | version: 1.1 6 | description: SMS-like view 7 | author: Pedro Enrique 8 | license: Apache 2 9 | copyright: Copyright (c) 2011 by pec1985 10 | 11 | 12 | # these should not be edited 13 | name: TiSMSView 14 | moduleid: ti.smsview 15 | guid: 8e4fdf7d-b3e7-4ba4-b76a-697113808c33 16 | platform: iphone 17 | minsdk: 1.7.1 18 | -------------------------------------------------------------------------------- /module.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // PLACE ANY BUILD DEFINITIONS IN THIS FILE AND THEY WILL BE 3 | // PICKED UP DURING THE APP BUILD FOR YOUR MODULE 4 | // 5 | // see the following webpage for instructions on the settings 6 | // for this file: 7 | // http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/400-Build_Configurations/build_configs.html 8 | // 9 | 10 | // 11 | // How to add a Framework (example) 12 | // 13 | // OTHER_LDFLAGS=$(inherited) -framework Foo 14 | // 15 | // Adding a framework for a specific version(s) of iPhone: 16 | // 17 | // OTHER_LDFLAGS[sdk=iphoneos4*]=$(inherited) -framework Foo 18 | // OTHER_LDFLAGS[sdk=iphonesimulator4*]=$(inherited) -framework Foo 19 | // 20 | // 21 | // How to add a compiler define: 22 | // 23 | // OTHER_CFLAGS=$(inherited) -DFOO=1 24 | // 25 | // 26 | // IMPORTANT NOTE: always use $(inherited) in your overrides 27 | // 28 | -------------------------------------------------------------------------------- /platform/README: -------------------------------------------------------------------------------- 1 | You can place platform-specific files here in sub-folders named "android" and/or "iphone", just as you can with normal Titanium Mobile SDK projects. Any folders and files you place here will be merged with the platform-specific files in a Titanium Mobile project that uses this module. 2 | 3 | When a Titanium Mobile project that uses this module is built, the files from this platform/ folder will be treated the same as files (if any) from the Titanium Mobile project's platform/ folder. 4 | -------------------------------------------------------------------------------- /screenshots/five.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/screenshots/five.png -------------------------------------------------------------------------------- /screenshots/four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/screenshots/four.png -------------------------------------------------------------------------------- /screenshots/one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/screenshots/one.png -------------------------------------------------------------------------------- /screenshots/six.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/screenshots/six.png -------------------------------------------------------------------------------- /screenshots/three.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/screenshots/three.png -------------------------------------------------------------------------------- /screenshots/two.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pec1985/TiSMSView/a7d021ddc5dab18b34c6eb76431ab9c5592c4fe1/screenshots/two.png -------------------------------------------------------------------------------- /textfield.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXAggregateTarget section */ 10 | 24416B8111C4CA220047AFDD /* Build & Test */ = { 11 | isa = PBXAggregateTarget; 12 | buildConfigurationList = 24416B8A11C4CA520047AFDD /* Build configuration list for PBXAggregateTarget "Build & Test" */; 13 | buildPhases = ( 14 | 24416B8011C4CA220047AFDD /* ShellScript */, 15 | ); 16 | dependencies = ( 17 | 24416B8511C4CA280047AFDD /* PBXTargetDependency */, 18 | ); 19 | name = "Build & Test"; 20 | productName = "Build & test"; 21 | }; 22 | /* End PBXAggregateTarget section */ 23 | 24 | /* Begin PBXBuildFile section */ 25 | 24DD6CF91134B3F500162E58 /* TiSmsviewModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 24DD6CF71134B3F500162E58 /* TiSmsviewModule.h */; }; 26 | 24DD6CFA1134B3F500162E58 /* TiSmsviewModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DD6CF81134B3F500162E58 /* TiSmsviewModule.m */; }; 27 | 24DE9E1111C5FE74003F90F6 /* TiSmsviewModuleAssets.h in Headers */ = {isa = PBXBuildFile; fileRef = 24DE9E0F11C5FE74003F90F6 /* TiSmsviewModuleAssets.h */; }; 28 | 24DE9E1211C5FE74003F90F6 /* TiSmsviewModuleAssets.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DE9E1011C5FE74003F90F6 /* TiSmsviewModuleAssets.m */; }; 29 | AA747D9F0F9514B9006C5449 /* TiSmsview_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* TiSmsview_Prefix.pch */; }; 30 | AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; 31 | B606756114592C140085E712 /* PESMSTextLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = B606755F14592C130085E712 /* PESMSTextLabel.h */; }; 32 | B606756214592C140085E712 /* PESMSTextLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = B606756014592C140085E712 /* PESMSTextLabel.m */; }; 33 | B671D17B1405C80400C5F651 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B671D17A1405C80400C5F651 /* CoreText.framework */; }; 34 | B6A5206213C3701C0016C96A /* TiSmsviewView.h in Headers */ = {isa = PBXBuildFile; fileRef = B6A5205E13C3701A0016C96A /* TiSmsviewView.h */; }; 35 | B6A5206313C3701C0016C96A /* TiSmsviewView.m in Sources */ = {isa = PBXBuildFile; fileRef = B6A5205F13C3701B0016C96A /* TiSmsviewView.m */; }; 36 | B6A5206413C3701C0016C96A /* TiSmsviewViewProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = B6A5206013C3701B0016C96A /* TiSmsviewViewProxy.h */; }; 37 | B6A5206513C3701C0016C96A /* TiSmsviewViewProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = B6A5206113C3701C0016C96A /* TiSmsviewViewProxy.m */; }; 38 | B6F6BD2E13F97C8200AD29C4 /* PESMSLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = B6F6BD2813F97C7F00AD29C4 /* PESMSLabel.h */; }; 39 | B6F6BD2F13F97C8200AD29C4 /* PESMSLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = B6F6BD2913F97C8000AD29C4 /* PESMSLabel.m */; }; 40 | B6F6BD3013F97C8200AD29C4 /* PESMSScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = B6F6BD2A13F97C8000AD29C4 /* PESMSScrollView.h */; }; 41 | B6F6BD3113F97C8200AD29C4 /* PESMSScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = B6F6BD2B13F97C8100AD29C4 /* PESMSScrollView.m */; }; 42 | B6F6BD3213F97C8200AD29C4 /* PESMSTextArea.h in Headers */ = {isa = PBXBuildFile; fileRef = B6F6BD2C13F97C8200AD29C4 /* PESMSTextArea.h */; }; 43 | B6F6BD3313F97C8200AD29C4 /* PESMSTextArea.m in Sources */ = {isa = PBXBuildFile; fileRef = B6F6BD2D13F97C8200AD29C4 /* PESMSTextArea.m */; }; 44 | B6F6BD3813F97F5500AD29C4 /* HPGrowingTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = B6F6BD3413F97F5400AD29C4 /* HPGrowingTextView.h */; }; 45 | B6F6BD3913F97F5500AD29C4 /* HPGrowingTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = B6F6BD3513F97F5400AD29C4 /* HPGrowingTextView.m */; }; 46 | B6F6BD3A13F97F5500AD29C4 /* HPTextViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = B6F6BD3613F97F5500AD29C4 /* HPTextViewInternal.h */; }; 47 | B6F6BD3B13F97F5500AD29C4 /* HPTextViewInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = B6F6BD3713F97F5500AD29C4 /* HPTextViewInternal.m */; }; 48 | /* End PBXBuildFile section */ 49 | 50 | /* Begin PBXContainerItemProxy section */ 51 | 24416B8411C4CA280047AFDD /* PBXContainerItemProxy */ = { 52 | isa = PBXContainerItemProxy; 53 | containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; 54 | proxyType = 1; 55 | remoteGlobalIDString = D2AAC07D0554694100DB518D; 56 | remoteInfo = textfield; 57 | }; 58 | /* End PBXContainerItemProxy section */ 59 | 60 | /* Begin PBXFileReference section */ 61 | 24DD6CF71134B3F500162E58 /* TiSmsviewModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiSmsviewModule.h; path = Classes/TiSmsviewModule.h; sourceTree = ""; }; 62 | 24DD6CF81134B3F500162E58 /* TiSmsviewModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TiSmsviewModule.m; path = Classes/TiSmsviewModule.m; sourceTree = ""; }; 63 | 24DD6D1B1134B66800162E58 /* titanium.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = titanium.xcconfig; sourceTree = ""; }; 64 | 24DE9E0F11C5FE74003F90F6 /* TiSmsviewModuleAssets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiSmsviewModuleAssets.h; path = Classes/TiSmsviewModuleAssets.h; sourceTree = ""; }; 65 | 24DE9E1011C5FE74003F90F6 /* TiSmsviewModuleAssets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TiSmsviewModuleAssets.m; path = Classes/TiSmsviewModuleAssets.m; sourceTree = ""; }; 66 | AA747D9E0F9514B9006C5449 /* TiSmsview_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiSmsview_Prefix.pch; sourceTree = SOURCE_ROOT; }; 67 | AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 68 | B606755F14592C130085E712 /* PESMSTextLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PESMSTextLabel.h; path = Classes/PESMSTextLabel.h; sourceTree = ""; }; 69 | B606756014592C140085E712 /* PESMSTextLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PESMSTextLabel.m; path = Classes/PESMSTextLabel.m; sourceTree = ""; }; 70 | B671D17A1405C80400C5F651 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; }; 71 | B6A51F9C13C158BA0016C96A /* app.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = app.js; sourceTree = ""; }; 72 | B6A5204C13C23C520016C96A /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; 73 | B6A5205E13C3701A0016C96A /* TiSmsviewView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiSmsviewView.h; path = Classes/TiSmsviewView.h; sourceTree = ""; }; 74 | B6A5205F13C3701B0016C96A /* TiSmsviewView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TiSmsviewView.m; path = Classes/TiSmsviewView.m; sourceTree = ""; }; 75 | B6A5206013C3701B0016C96A /* TiSmsviewViewProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiSmsviewViewProxy.h; path = Classes/TiSmsviewViewProxy.h; sourceTree = ""; }; 76 | B6A5206113C3701C0016C96A /* TiSmsviewViewProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TiSmsviewViewProxy.m; path = Classes/TiSmsviewViewProxy.m; sourceTree = ""; }; 77 | B6F6BD2813F97C7F00AD29C4 /* PESMSLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PESMSLabel.h; path = Classes/PESMSLabel.h; sourceTree = ""; }; 78 | B6F6BD2913F97C8000AD29C4 /* PESMSLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PESMSLabel.m; path = Classes/PESMSLabel.m; sourceTree = ""; }; 79 | B6F6BD2A13F97C8000AD29C4 /* PESMSScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PESMSScrollView.h; path = Classes/PESMSScrollView.h; sourceTree = ""; }; 80 | B6F6BD2B13F97C8100AD29C4 /* PESMSScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PESMSScrollView.m; path = Classes/PESMSScrollView.m; sourceTree = ""; }; 81 | B6F6BD2C13F97C8200AD29C4 /* PESMSTextArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PESMSTextArea.h; path = Classes/PESMSTextArea.h; sourceTree = ""; }; 82 | B6F6BD2D13F97C8200AD29C4 /* PESMSTextArea.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PESMSTextArea.m; path = Classes/PESMSTextArea.m; sourceTree = ""; }; 83 | B6F6BD3413F97F5400AD29C4 /* HPGrowingTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HPGrowingTextView.h; path = Classes/HPGrowingTextView.h; sourceTree = ""; }; 84 | B6F6BD3513F97F5400AD29C4 /* HPGrowingTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HPGrowingTextView.m; path = Classes/HPGrowingTextView.m; sourceTree = ""; }; 85 | B6F6BD3613F97F5500AD29C4 /* HPTextViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HPTextViewInternal.h; path = Classes/HPTextViewInternal.h; sourceTree = ""; }; 86 | B6F6BD3713F97F5500AD29C4 /* HPTextViewInternal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HPTextViewInternal.m; path = Classes/HPTextViewInternal.m; sourceTree = ""; }; 87 | D2AAC07E0554694100DB518D /* libPecTf.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPecTf.a; sourceTree = BUILT_PRODUCTS_DIR; }; 88 | /* End PBXFileReference section */ 89 | 90 | /* Begin PBXFrameworksBuildPhase section */ 91 | D2AAC07C0554694100DB518D /* Frameworks */ = { 92 | isa = PBXFrameworksBuildPhase; 93 | buildActionMask = 2147483647; 94 | files = ( 95 | B671D17B1405C80400C5F651 /* CoreText.framework in Frameworks */, 96 | AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */, 97 | ); 98 | runOnlyForDeploymentPostprocessing = 0; 99 | }; 100 | /* End PBXFrameworksBuildPhase section */ 101 | 102 | /* Begin PBXGroup section */ 103 | 034768DFFF38A50411DB9C8B /* Products */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | D2AAC07E0554694100DB518D /* libPecTf.a */, 107 | ); 108 | name = Products; 109 | sourceTree = ""; 110 | }; 111 | 0867D691FE84028FC02AAC07 /* textfield */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | B6A5204B13C23C520016C96A /* assets */, 115 | B6A51F9B13C158BA0016C96A /* example */, 116 | 08FB77AEFE84172EC02AAC07 /* Classes */, 117 | 32C88DFF0371C24200C91783 /* Other Sources */, 118 | 0867D69AFE84028FC02AAC07 /* Frameworks */, 119 | 034768DFFF38A50411DB9C8B /* Products */, 120 | ); 121 | name = textfield; 122 | sourceTree = ""; 123 | }; 124 | 0867D69AFE84028FC02AAC07 /* Frameworks */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | B671D17A1405C80400C5F651 /* CoreText.framework */, 128 | AACBBE490F95108600F1A2B1 /* Foundation.framework */, 129 | ); 130 | name = Frameworks; 131 | sourceTree = ""; 132 | }; 133 | 08FB77AEFE84172EC02AAC07 /* Classes */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | B6A51F8113C1575C0016C96A /* GrowingTextView */, 137 | 24DE9E0F11C5FE74003F90F6 /* TiSmsviewModuleAssets.h */, 138 | 24DE9E1011C5FE74003F90F6 /* TiSmsviewModuleAssets.m */, 139 | 24DD6CF71134B3F500162E58 /* TiSmsviewModule.h */, 140 | 24DD6CF81134B3F500162E58 /* TiSmsviewModule.m */, 141 | B6A5205E13C3701A0016C96A /* TiSmsviewView.h */, 142 | B6A5205F13C3701B0016C96A /* TiSmsviewView.m */, 143 | B6A5206013C3701B0016C96A /* TiSmsviewViewProxy.h */, 144 | B6A5206113C3701C0016C96A /* TiSmsviewViewProxy.m */, 145 | ); 146 | name = Classes; 147 | sourceTree = ""; 148 | }; 149 | 32C88DFF0371C24200C91783 /* Other Sources */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | AA747D9E0F9514B9006C5449 /* TiSmsview_Prefix.pch */, 153 | 24DD6D1B1134B66800162E58 /* titanium.xcconfig */, 154 | ); 155 | name = "Other Sources"; 156 | sourceTree = ""; 157 | }; 158 | B6A51F8113C1575C0016C96A /* GrowingTextView */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | B6F6BD3413F97F5400AD29C4 /* HPGrowingTextView.h */, 162 | B6F6BD3513F97F5400AD29C4 /* HPGrowingTextView.m */, 163 | B6F6BD3613F97F5500AD29C4 /* HPTextViewInternal.h */, 164 | B6F6BD3713F97F5500AD29C4 /* HPTextViewInternal.m */, 165 | B6F6BD2813F97C7F00AD29C4 /* PESMSLabel.h */, 166 | B6F6BD2913F97C8000AD29C4 /* PESMSLabel.m */, 167 | B6F6BD2A13F97C8000AD29C4 /* PESMSScrollView.h */, 168 | B6F6BD2B13F97C8100AD29C4 /* PESMSScrollView.m */, 169 | B6F6BD2C13F97C8200AD29C4 /* PESMSTextArea.h */, 170 | B6F6BD2D13F97C8200AD29C4 /* PESMSTextArea.m */, 171 | B606755F14592C130085E712 /* PESMSTextLabel.h */, 172 | B606756014592C140085E712 /* PESMSTextLabel.m */, 173 | ); 174 | name = GrowingTextView; 175 | sourceTree = ""; 176 | }; 177 | B6A51F9B13C158BA0016C96A /* example */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | B6A51F9C13C158BA0016C96A /* app.js */, 181 | ); 182 | path = example; 183 | sourceTree = ""; 184 | }; 185 | B6A5204B13C23C520016C96A /* assets */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | B6A5204C13C23C520016C96A /* README */, 189 | ); 190 | path = assets; 191 | sourceTree = ""; 192 | }; 193 | /* End PBXGroup section */ 194 | 195 | /* Begin PBXHeadersBuildPhase section */ 196 | D2AAC07A0554694100DB518D /* Headers */ = { 197 | isa = PBXHeadersBuildPhase; 198 | buildActionMask = 2147483647; 199 | files = ( 200 | AA747D9F0F9514B9006C5449 /* TiSmsview_Prefix.pch in Headers */, 201 | 24DD6CF91134B3F500162E58 /* TiSmsviewModule.h in Headers */, 202 | 24DE9E1111C5FE74003F90F6 /* TiSmsviewModuleAssets.h in Headers */, 203 | B6A5206213C3701C0016C96A /* TiSmsviewView.h in Headers */, 204 | B6A5206413C3701C0016C96A /* TiSmsviewViewProxy.h in Headers */, 205 | B6F6BD2E13F97C8200AD29C4 /* PESMSLabel.h in Headers */, 206 | B6F6BD3013F97C8200AD29C4 /* PESMSScrollView.h in Headers */, 207 | B6F6BD3213F97C8200AD29C4 /* PESMSTextArea.h in Headers */, 208 | B6F6BD3813F97F5500AD29C4 /* HPGrowingTextView.h in Headers */, 209 | B6F6BD3A13F97F5500AD29C4 /* HPTextViewInternal.h in Headers */, 210 | B606756114592C140085E712 /* PESMSTextLabel.h in Headers */, 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | }; 214 | /* End PBXHeadersBuildPhase section */ 215 | 216 | /* Begin PBXNativeTarget section */ 217 | D2AAC07D0554694100DB518D /* textfield */ = { 218 | isa = PBXNativeTarget; 219 | buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "textfield" */; 220 | buildPhases = ( 221 | D2AAC07A0554694100DB518D /* Headers */, 222 | D2AAC07B0554694100DB518D /* Sources */, 223 | D2AAC07C0554694100DB518D /* Frameworks */, 224 | ); 225 | buildRules = ( 226 | ); 227 | dependencies = ( 228 | ); 229 | name = textfield; 230 | productName = textfield; 231 | productReference = D2AAC07E0554694100DB518D /* libPecTf.a */; 232 | productType = "com.apple.product-type.library.static"; 233 | }; 234 | /* End PBXNativeTarget section */ 235 | 236 | /* Begin PBXProject section */ 237 | 0867D690FE84028FC02AAC07 /* Project object */ = { 238 | isa = PBXProject; 239 | attributes = { 240 | LastUpgradeCheck = 0410; 241 | }; 242 | buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "textfield" */; 243 | compatibilityVersion = "Xcode 3.2"; 244 | developmentRegion = English; 245 | hasScannedForEncodings = 1; 246 | knownRegions = ( 247 | English, 248 | Japanese, 249 | French, 250 | German, 251 | ); 252 | mainGroup = 0867D691FE84028FC02AAC07 /* textfield */; 253 | productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; 254 | projectDirPath = ""; 255 | projectRoot = ""; 256 | targets = ( 257 | D2AAC07D0554694100DB518D /* textfield */, 258 | 24416B8111C4CA220047AFDD /* Build & Test */, 259 | ); 260 | }; 261 | /* End PBXProject section */ 262 | 263 | /* Begin PBXShellScriptBuildPhase section */ 264 | 24416B8011C4CA220047AFDD /* ShellScript */ = { 265 | isa = PBXShellScriptBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | ); 269 | inputPaths = ( 270 | ); 271 | outputPaths = ( 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | shellPath = /bin/sh; 275 | shellScript = "# shell script goes here\n\npython \"${TITANIUM_SDK}/titanium.py\" run --dir=\"${PROJECT_DIR}\"\nexit $?\n"; 276 | }; 277 | /* End PBXShellScriptBuildPhase section */ 278 | 279 | /* Begin PBXSourcesBuildPhase section */ 280 | D2AAC07B0554694100DB518D /* Sources */ = { 281 | isa = PBXSourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | 24DD6CFA1134B3F500162E58 /* TiSmsviewModule.m in Sources */, 285 | 24DE9E1211C5FE74003F90F6 /* TiSmsviewModuleAssets.m in Sources */, 286 | B6A5206313C3701C0016C96A /* TiSmsviewView.m in Sources */, 287 | B6A5206513C3701C0016C96A /* TiSmsviewViewProxy.m in Sources */, 288 | B6F6BD2F13F97C8200AD29C4 /* PESMSLabel.m in Sources */, 289 | B6F6BD3113F97C8200AD29C4 /* PESMSScrollView.m in Sources */, 290 | B6F6BD3313F97C8200AD29C4 /* PESMSTextArea.m in Sources */, 291 | B6F6BD3913F97F5500AD29C4 /* HPGrowingTextView.m in Sources */, 292 | B6F6BD3B13F97F5500AD29C4 /* HPTextViewInternal.m in Sources */, 293 | B606756214592C140085E712 /* PESMSTextLabel.m in Sources */, 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | /* End PBXSourcesBuildPhase section */ 298 | 299 | /* Begin PBXTargetDependency section */ 300 | 24416B8511C4CA280047AFDD /* PBXTargetDependency */ = { 301 | isa = PBXTargetDependency; 302 | target = D2AAC07D0554694100DB518D /* textfield */; 303 | targetProxy = 24416B8411C4CA280047AFDD /* PBXContainerItemProxy */; 304 | }; 305 | /* End PBXTargetDependency section */ 306 | 307 | /* Begin XCBuildConfiguration section */ 308 | 1DEB921F08733DC00010E9CD /* Debug */ = { 309 | isa = XCBuildConfiguration; 310 | baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; 311 | buildSettings = { 312 | ALWAYS_SEARCH_USER_PATHS = NO; 313 | ARCHS = ( 314 | armv6, 315 | armv7, 316 | ); 317 | "ARCHS[sdk=iphoneos*]" = ( 318 | armv6, 319 | armv7, 320 | ); 321 | "ARCHS[sdk=iphonesimulator*]" = i386; 322 | COPY_PHASE_STRIP = NO; 323 | DSTROOT = /tmp/PecTf.dst; 324 | GCC_DYNAMIC_NO_PIC = NO; 325 | GCC_MODEL_TUNING = G5; 326 | GCC_OPTIMIZATION_LEVEL = 0; 327 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 328 | GCC_PREFIX_HEADER = TiSmsview_Prefix.pch; 329 | GCC_VERSION = ""; 330 | INSTALL_PATH = /usr/local/lib; 331 | PRODUCT_NAME = PecTf; 332 | SDKROOT = iphoneos; 333 | }; 334 | name = Debug; 335 | }; 336 | 1DEB922008733DC00010E9CD /* Release */ = { 337 | isa = XCBuildConfiguration; 338 | baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | ARCHS = ( 342 | armv6, 343 | armv7, 344 | ); 345 | "ARCHS[sdk=iphoneos*]" = ( 346 | armv6, 347 | armv7, 348 | ); 349 | "ARCHS[sdk=iphonesimulator*]" = i386; 350 | DSTROOT = /tmp/PecTf.dst; 351 | GCC_MODEL_TUNING = G5; 352 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 353 | GCC_PREFIX_HEADER = TiSmsview_Prefix.pch; 354 | GCC_VERSION = ""; 355 | INSTALL_PATH = /usr/local/lib; 356 | PRODUCT_NAME = PecTf; 357 | SDKROOT = iphoneos; 358 | }; 359 | name = Release; 360 | }; 361 | 1DEB922308733DC00010E9CD /* Debug */ = { 362 | isa = XCBuildConfiguration; 363 | baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; 364 | buildSettings = { 365 | ARCHS = ( 366 | armv6, 367 | armv7, 368 | ); 369 | "ARCHS[sdk=iphoneos*]" = ( 370 | armv6, 371 | armv7, 372 | ); 373 | "ARCHS[sdk=iphonesimulator*]" = i386; 374 | GCC_C_LANGUAGE_STANDARD = c99; 375 | GCC_OPTIMIZATION_LEVEL = 0; 376 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 377 | GCC_WARN_UNUSED_VARIABLE = YES; 378 | OTHER_LDFLAGS = ""; 379 | SDKROOT = iphoneos; 380 | }; 381 | name = Debug; 382 | }; 383 | 1DEB922408733DC00010E9CD /* Release */ = { 384 | isa = XCBuildConfiguration; 385 | baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; 386 | buildSettings = { 387 | ARCHS = ( 388 | armv6, 389 | armv7, 390 | ); 391 | "ARCHS[sdk=iphoneos*]" = ( 392 | armv6, 393 | armv7, 394 | ); 395 | "ARCHS[sdk=iphonesimulator*]" = i386; 396 | GCC_C_LANGUAGE_STANDARD = c99; 397 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 398 | GCC_WARN_UNUSED_VARIABLE = YES; 399 | OTHER_LDFLAGS = ""; 400 | SDKROOT = iphoneos; 401 | }; 402 | name = Release; 403 | }; 404 | 24416B8211C4CA220047AFDD /* Debug */ = { 405 | isa = XCBuildConfiguration; 406 | baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; 407 | buildSettings = { 408 | COPY_PHASE_STRIP = NO; 409 | GCC_DYNAMIC_NO_PIC = NO; 410 | GCC_OPTIMIZATION_LEVEL = 0; 411 | GCC_VERSION = com.apple.compilers.llvmgcc42; 412 | PRODUCT_NAME = "Build & test"; 413 | }; 414 | name = Debug; 415 | }; 416 | 24416B8311C4CA220047AFDD /* Release */ = { 417 | isa = XCBuildConfiguration; 418 | baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; 419 | buildSettings = { 420 | COPY_PHASE_STRIP = YES; 421 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 422 | GCC_VERSION = com.apple.compilers.llvmgcc42; 423 | PRODUCT_NAME = "Build & test"; 424 | ZERO_LINK = NO; 425 | }; 426 | name = Release; 427 | }; 428 | /* End XCBuildConfiguration section */ 429 | 430 | /* Begin XCConfigurationList section */ 431 | 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "textfield" */ = { 432 | isa = XCConfigurationList; 433 | buildConfigurations = ( 434 | 1DEB921F08733DC00010E9CD /* Debug */, 435 | 1DEB922008733DC00010E9CD /* Release */, 436 | ); 437 | defaultConfigurationIsVisible = 0; 438 | defaultConfigurationName = Release; 439 | }; 440 | 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "textfield" */ = { 441 | isa = XCConfigurationList; 442 | buildConfigurations = ( 443 | 1DEB922308733DC00010E9CD /* Debug */, 444 | 1DEB922408733DC00010E9CD /* Release */, 445 | ); 446 | defaultConfigurationIsVisible = 0; 447 | defaultConfigurationName = Release; 448 | }; 449 | 24416B8A11C4CA520047AFDD /* Build configuration list for PBXAggregateTarget "Build & Test" */ = { 450 | isa = XCConfigurationList; 451 | buildConfigurations = ( 452 | 24416B8211C4CA220047AFDD /* Debug */, 453 | 24416B8311C4CA220047AFDD /* Release */, 454 | ); 455 | defaultConfigurationIsVisible = 0; 456 | defaultConfigurationName = Release; 457 | }; 458 | /* End XCConfigurationList section */ 459 | }; 460 | rootObject = 0867D690FE84028FC02AAC07 /* Project object */; 461 | } 462 | -------------------------------------------------------------------------------- /textfield.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /textfield.xcodeproj/project.xcworkspace/xcuserdata/penrique.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceUserSettings_HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | IDEWorkspaceUserSettings_SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /textfield.xcodeproj/xcuserdata/penrique.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 19 | 20 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /textfield.xcodeproj/xcuserdata/penrique.xcuserdatad/xcschemes/Build & Test.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 42 | 43 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /textfield.xcodeproj/xcuserdata/penrique.xcuserdatad/xcschemes/textfield.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 42 | 43 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /textfield.xcodeproj/xcuserdata/penrique.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Build & Test.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | textfield.xcscheme 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 24416B8111C4CA220047AFDD 21 | 22 | primary 23 | 24 | 25 | D2AAC07D0554694100DB518D 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /timodule.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /titanium.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // CHANGE THESE VALUES TO REFLECT THE VERSION (AND LOCATION IF DIFFERENT) 4 | // OF YOUR TITANIUM SDK YOU'RE BUILDING FOR 5 | // 6 | // 7 | TITANIUM_SDK_VERSION = 1.7.2 8 | 9 | 10 | // 11 | // THESE SHOULD BE OK GENERALLY AS-IS 12 | // 13 | TITANIUM_SDK = /Library/Application Support/Titanium/mobilesdk/osx/$(TITANIUM_SDK_VERSION) 14 | TITANIUM_BASE_SDK = "$(TITANIUM_SDK)/iphone/include" 15 | TITANIUM_BASE_SDK2 = "$(TITANIUM_SDK)/iphone/include/TiCore" 16 | HEADER_SEARCH_PATHS= $(TITANIUM_BASE_SDK) $(TITANIUM_BASE_SDK2) 17 | 18 | 19 | 20 | --------------------------------------------------------------------------------