diff --git a/README.md b/README.md deleted file mode 100644 index ca281ca..0000000 --- a/README.md +++ /dev/null @@ -1,59 +0,0 @@ -HPGrowingTextView -================= - -Multi-line/Autoresizing UITextView similar as in the SMS-app. The example project mimicks the look of Apple's SMS-app. - -![Screenshot](http://f.cl.ly/items/270f2F3q3d3q142m140A/ss.png) - -Properties ----------- - -```objective-c -int maxNumberOfLines; // Stops growing at this amount of lines. -int minNumberOfLines; // Starts growing at this amount of lines. -int maxHeight; // Specify the maximum height in points instead of lines. -int minHeight; // Specify the minimum height in points instead of lines. -BOOL animateHeightChange; // Animate the growing -NSTimeInterval animationDuration; // Adjust the duration of the growth animation. -``` - -UITextView borrowed properties ----------------- - -```objective-c -NSString *text; -UIFont *font; -UIColor *textColor; -NSTextAlignment textAlignment; -NSRange selectedRange; -BOOL editable; -UIDataDetectorTypes dataDetectorTypes; -UIReturnKeyType returnKeyType; -``` - -If you want to set other UITextView properties, use .internalTextView - -Delegate methods ---------------- - -```objective-c --(BOOL)growingTextViewShouldBeginEditing:(HPGrowingTextView *)growingTextView; --(BOOL)growingTextViewShouldEndEditing:(HPGrowingTextView *)growingTextView; - --(void)growingTextViewDidBeginEditing:(HPGrowingTextView *)growingTextView; --(void)growingTextViewDidEndEditing:(HPGrowingTextView *)growingTextView; - --(BOOL)growingTextView:(HPGrowingTextView *)growingTextView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; --(void)growingTextViewDidChange:(HPGrowingTextView *)growingTextView; - -// Called WITHIN animation block! --(void)growingTextView:(HPGrowingTextView *)growingTextView willChangeHeight:(float)height; - -// Called after animation --(void)growingTextView:(HPGrowingTextView *)growingTextView didChangeHeight:(float)height; - --(void)growingTextViewDidChangeSelection:(HPGrowingTextView *)growingTextView; --(BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView; -``` - -For more info, see blogpost: http://www.hanspinckaers.com/multi-line-uitextview-similar-to-sms diff --git a/class/HPGrowingTextView.m b/class/HPGrowingTextView.m index 9871c6f..b8d3db3 100644 --- a/class/HPGrowingTextView.m +++ b/class/HPGrowingTextView.m @@ -41,7 +41,7 @@ @implementation HPGrowingTextView @synthesize minHeight; @synthesize font; @synthesize textColor; -@synthesize textAlignment; +@synthesize textAlignment; @synthesize selectedRange; @synthesize editable; @synthesize dataDetectorTypes; @@ -88,15 +88,17 @@ -(void)commonInitialiser CGRect r = self.frame; r.origin.y = 0; r.origin.x = 0; -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 - internalTextView = [[HPTextViewInternal alloc] initWithFrame:r textContainer:textContainer]; -#else - internalTextView = [[HPTextViewInternal alloc] initWithFrame:r]; -#endif + + if ([internalTextView respondsToSelector:@selector(initWithFrame:textContainer:)]){ + internalTextView = [[HPTextViewInternal alloc] initWithFrame:r textContainer:textContainer]; + }else{ + internalTextView = [[HPTextViewInternal alloc] initWithFrame:r]; + } + internalTextView.delegate = self; internalTextView.scrollEnabled = NO; - internalTextView.font = [UIFont fontWithName:@"Helvetica" size:13]; - internalTextView.contentInset = UIEdgeInsetsZero; + internalTextView.font = [UIFont fontWithName:@"Helvetica" size:13]; + internalTextView.contentInset = UIEdgeInsetsZero; internalTextView.showsHorizontalScrollIndicator = NO; internalTextView.text = @"-"; internalTextView.contentMode = UIViewContentModeRedraw; @@ -111,7 +113,7 @@ -(void)commonInitialiser internalTextView.text = @""; [self setMaxNumberOfLines:3]; - + [self setPlaceholderColor:[UIColor lightGrayColor]]; internalTextView.displayPlaceHolder = YES; } @@ -196,7 +198,7 @@ - (void)setMaxHeight:(int)height -(void)setMinNumberOfLines:(int)m { if(m == 0 && minHeight > 0) return; // the user specified a minHeight themselves. - + // Use internalTextView for height calculations, thanks to Gwynne NSString *saveText = internalTextView.text, *newText = @"-"; @@ -246,7 +248,7 @@ - (UIColor *)placeholderColor return internalTextView.placeholderColor; } -- (void)setPlaceholderColor:(UIColor *)placeholderColor +- (void)setPlaceholderColor:(UIColor *)placeholderColor { [internalTextView setPlaceholderColor:placeholderColor]; } @@ -291,13 +293,13 @@ - (void)refreshHeight if ([UIView resolveClassMethod:@selector(animateWithDuration:animations:)]) { #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 40000 - [UIView animateWithDuration:animationDuration - delay:0 + [UIView animateWithDuration:animationDuration + delay:0 options:(UIViewAnimationOptionAllowUserInteraction| - UIViewAnimationOptionBeginFromCurrentState) + UIViewAnimationOptionBeginFromCurrentState) animations:^(void) { [self resizeTextView:newSizeH]; - } + } completion:^(BOOL finished) { if ([delegate respondsToSelector:@selector(growingTextView:didChangeHeight:)]) { [delegate growingTextView:self didChangeHeight:newSizeH]; @@ -314,13 +316,13 @@ - (void)refreshHeight [UIView commitAnimations]; } } else { - [self resizeTextView:newSizeH]; + [self resizeTextView:newSizeH]; // [fixed] The growingTextView:didChangeHeight: delegate method was not called at all when not animating height changes. // thanks to Gwynne if ([delegate respondsToSelector:@selector(growingTextView:didChangeHeight:)]) { [delegate growingTextView:self didChangeHeight:newSizeH]; - } + } } } } @@ -333,13 +335,6 @@ - (void)refreshHeight [internalTextView setNeedsDisplay]; } - - // scroll to caret (needed on iOS7) - if ([self respondsToSelector:@selector(snapshotViewAfterScreenUpdates:)]) - { - [self performSelector:@selector(resetScrollPositionForIOS7) withObject:nil afterDelay:0.1f]; - } - // Tell the delegate that the text view changed if ([delegate respondsToSelector:@selector(growingTextViewDidChange:)]) { [delegate growingTextViewDidChange:self]; @@ -349,23 +344,24 @@ - (void)refreshHeight // Code from apple developer forum - @Steve Krulewitz, @Mark Marszal, @Eric Silverberg - (CGFloat)measureHeight { - if ([self respondsToSelector:@selector(snapshotViewAfterScreenUpdates:)]) + + if (sizeof(void*) == 4) { - return ceilf([self.internalTextView sizeThatFits:self.internalTextView.frame.size].height); + // Executing in a 32-bit environment + return [self.internalTextView sizeThatFits:CGSizeMake(self.internalTextView.frame.size.width, CGFLOAT_MAX)].height-(self.internalTextView.contentInset.top+self.internalTextView.contentInset.bottom); } else { - return self.internalTextView.contentSize.height; + //64-bit 7.1 later + if([[UIDevice currentDevice].systemVersion floatValue] >= 7.1){ + return ceilf([self.internalTextView sizeThatFits:self.internalTextView.frame.size].height); + } + else{ + //64-bit 7.0 + return [self.internalTextView sizeThatFits:CGSizeMake(self.internalTextView.frame.size.width, CGFLOAT_MAX)].height-(self.internalTextView.contentInset.top+self.internalTextView.contentInset.bottom); + } } } -- (void)resetScrollPositionForIOS7 -{ - CGRect r = [internalTextView caretRectForPosition:internalTextView.selectedTextRange.end]; - CGFloat caretY = MAX(r.origin.y - internalTextView.frame.size.height + r.size.height + 8, 0); - if (internalTextView.contentOffset.y < caretY && r.origin.y != INFINITY) - internalTextView.contentOffset = CGPointMake(0, caretY); -} - -(void)resizeTextView:(NSInteger)newSizeH { if ([delegate respondsToSelector:@selector(growingTextView:willChangeHeight:)]) { @@ -384,12 +380,6 @@ -(void)resizeTextView:(NSInteger)newSizeH - (void)growDidStop { - // scroll to caret (needed on iOS7) - if ([self respondsToSelector:@selector(snapshotViewAfterScreenUpdates:)]) - { - [self resetScrollPositionForIOS7]; - } - if ([delegate respondsToSelector:@selector(growingTextView:didChangeHeight:)]) { [delegate growingTextView:self didChangeHeight:self.frame.size.height]; } @@ -414,7 +404,7 @@ -(BOOL)resignFirstResponder -(BOOL)isFirstResponder { - return [self.internalTextView isFirstResponder]; + return [self.internalTextView isFirstResponder]; } @@ -450,7 +440,7 @@ -(void)setFont:(UIFont *)afont -(UIFont *)font { return internalTextView.font; -} +} /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -467,13 +457,13 @@ -(UIColor*)textColor{ -(void)setBackgroundColor:(UIColor *)backgroundColor { - [super setBackgroundColor:backgroundColor]; + [super setBackgroundColor:backgroundColor]; internalTextView.backgroundColor = backgroundColor; } -(UIColor*)backgroundColor { - return internalTextView.backgroundColor; + return internalTextView.backgroundColor; } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -552,12 +542,12 @@ - (UIKeyboardType)keyboardType - (void)setEnablesReturnKeyAutomatically:(BOOL)enablesReturnKeyAutomatically { - internalTextView.enablesReturnKeyAutomatically = enablesReturnKeyAutomatically; + internalTextView.enablesReturnKeyAutomatically = enablesReturnKeyAutomatically; } - (BOOL)enablesReturnKeyAutomatically { - return internalTextView.enablesReturnKeyAutomatically; + return internalTextView.enablesReturnKeyAutomatically; } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -620,7 +610,7 @@ - (void)textViewDidBeginEditing:(UITextView *)textView { /////////////////////////////////////////////////////////////////////////////////////////////////// -- (void)textViewDidEndEditing:(UITextView *)textView { +- (void)textViewDidEndEditing:(UITextView *)textView { if ([delegate respondsToSelector:@selector(growingTextViewDidEndEditing:)]) { [delegate growingTextViewDidEndEditing:self]; } @@ -635,8 +625,8 @@ - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range if(![textView hasText] && [atext isEqualToString:@""]) return NO; //Added by bretdabaker: sometimes we want to handle this ourselves - if ([delegate respondsToSelector:@selector(growingTextView:shouldChangeTextInRange:replacementText:)]) - return [delegate growingTextView:self shouldChangeTextInRange:range replacementText:atext]; + if ([delegate respondsToSelector:@selector(growingTextView:shouldChangeTextInRange:replacementText:)]) + return [delegate growingTextView:self shouldChangeTextInRange:range replacementText:atext]; if ([atext isEqualToString:@"\n"]) { if ([delegate respondsToSelector:@selector(growingTextViewShouldReturn:)]) { diff --git a/class/HPTextViewInternal.m b/class/HPTextViewInternal.m index f3a6a1d..6c3fe6e 100644 --- a/class/HPTextViewInternal.m +++ b/class/HPTextViewInternal.m @@ -61,13 +61,14 @@ -(void)setContentOffset:(CGPoint)s float bottomOffset = (self.contentSize.height - self.frame.size.height + self.contentInset.bottom); if(s.y < bottomOffset && self.scrollEnabled){ UIEdgeInsets insets = self.contentInset; - insets.bottom = 8; + insets.bottom = 0; insets.top = 0; self.contentInset = insets; } } // Fix "overscrolling" bug + if (s.y > self.contentSize.height - self.frame.size.height && !self.decelerating && !self.tracking && !self.dragging) s = CGPointMake(s.x, self.contentSize.height - self.frame.size.height); @@ -111,7 +112,7 @@ - (void)drawRect:(CGRect)rect } else { [self.placeholderColor set]; - [self.placeholder drawInRect:CGRectMake(8.0f, 8.0f, self.frame.size.width - 16.0f, self.frame.size.height - 16.0f) withFont:self.font]; + [self.placeholder drawInRect:CGRectMake(8.0f, 8.0f, self.frame.size.width - 16.0f, self.frame.size.height - 16.0f) withAttributes:@{NSFontAttributeName:self.font}]; } } } @@ -122,5 +123,4 @@ -(void)setPlaceholder:(NSString *)placeholder [self setNeedsDisplay]; } - @end diff --git a/example/Classes/GrowingTextViewExampleAppDelegate.h b/example/Classes/GrowingTextViewExampleAppDelegate.h deleted file mode 100644 index fc649c3..0000000 --- a/example/Classes/GrowingTextViewExampleAppDelegate.h +++ /dev/null @@ -1,41 +0,0 @@ -// -// GrowingTextViewExampleAppDelegate.h -// -// Created by Hans Pinckaers on 29-06-10. -// -// MIT License -// -// Copyright (c) 2011 Hans Pinckaers -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import - -@class GrowingTextViewExampleViewController; - -@interface GrowingTextViewExampleAppDelegate : NSObject { - UIWindow *window; - GrowingTextViewExampleViewController *viewController; -} - -@property (nonatomic, strong) IBOutlet UIWindow *window; -@property (nonatomic, strong) GrowingTextViewExampleViewController *viewController; - -@end - diff --git a/example/Classes/GrowingTextViewExampleAppDelegate.m b/example/Classes/GrowingTextViewExampleAppDelegate.m deleted file mode 100644 index 9cf8920..0000000 --- a/example/Classes/GrowingTextViewExampleAppDelegate.m +++ /dev/null @@ -1,104 +0,0 @@ -// -// GrowingTextViewExampleAppDelegate.m -// -// Created by Hans Pinckaers on 29-06-10. -// -// MIT License -// -// Copyright (c) 2011 Hans Pinckaers -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "GrowingTextViewExampleAppDelegate.h" -#import "GrowingTextViewExampleViewController.h" - -@implementation GrowingTextViewExampleAppDelegate - -@synthesize window; -@synthesize viewController; - - -#pragma mark - -#pragma mark Application lifecycle - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - - // Override point for customization after application launch. - - viewController = [[GrowingTextViewExampleViewController alloc] init]; - - // Add the view controller's view to the window and display. - [window addSubview:viewController.view]; - [window makeKeyAndVisible]; - - return YES; -} - - -- (void)applicationWillResignActive:(UIApplication *)application { - /* - Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. - */ -} - - -- (void)applicationDidEnterBackground:(UIApplication *)application { - /* - Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - If your application supports background execution, called instead of applicationWillTerminate: when the user quits. - */ -} - - -- (void)applicationWillEnterForeground:(UIApplication *)application { - /* - Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. - */ -} - - -- (void)applicationDidBecomeActive:(UIApplication *)application { - /* - Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - */ -} - - -- (void)applicationWillTerminate:(UIApplication *)application { - /* - Called when the application is about to terminate. - See also applicationDidEnterBackground:. - */ -} - - -#pragma mark - -#pragma mark Memory management - -- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { - /* - Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later. - */ -} - - - - -@end diff --git a/example/Classes/GrowingTextViewExampleViewController.h b/example/Classes/GrowingTextViewExampleViewController.h deleted file mode 100644 index 260417b..0000000 --- a/example/Classes/GrowingTextViewExampleViewController.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// GrowingTextViewExampleViewController.h -// -// Created by Hans Pinckaers on 29-06-10. -// -// MIT License -// -// Copyright (c) 2011 Hans Pinckaers -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import -#import "HPGrowingTextView.h" - -@interface GrowingTextViewExampleViewController : UIViewController { - UIView *containerView; - HPGrowingTextView *textView; -} - --(void)resignTextView; - -@end - diff --git a/example/Classes/GrowingTextViewExampleViewController.m b/example/Classes/GrowingTextViewExampleViewController.m deleted file mode 100644 index 6a80fd3..0000000 --- a/example/Classes/GrowingTextViewExampleViewController.m +++ /dev/null @@ -1,202 +0,0 @@ -// -// GrowingTextViewExampleViewController.m -// -// Created by Hans Pinckaers on 29-06-10. -// -// MIT License -// -// Copyright (c) 2011 Hans Pinckaers -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "GrowingTextViewExampleViewController.h" - -@implementation GrowingTextViewExampleViewController - - --(id)init -{ - self = [super init]; - if(self){ - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(keyboardWillShow:) - name:UIKeyboardWillShowNotification - object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(keyboardWillHide:) - name:UIKeyboardWillHideNotification - object:nil]; - } - - return self; -} - - - -// Implement loadView to create a view hierarchy programmatically, without using a nib. -- (void)loadView { - self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; - self.view.backgroundColor = [UIColor colorWithRed:219.0f/255.0f green:226.0f/255.0f blue:237.0f/255.0f alpha:1]; - - containerView = [[UIView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 40, 320, 40)]; - - textView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(6, 3, 240, 40)]; - textView.isScrollable = NO; - textView.contentInset = UIEdgeInsetsMake(0, 5, 0, 5); - - textView.minNumberOfLines = 1; - textView.maxNumberOfLines = 6; - // you can also set the maximum height in points with maxHeight - // textView.maxHeight = 200.0f; - textView.returnKeyType = UIReturnKeyGo; //just as an example - textView.font = [UIFont systemFontOfSize:15.0f]; - textView.delegate = self; - textView.internalTextView.scrollIndicatorInsets = UIEdgeInsetsMake(5, 0, 5, 0); - textView.backgroundColor = [UIColor whiteColor]; - textView.placeholder = @"Type to see the textView grow!"; - - // textView.text = @"test\n\ntest"; - // textView.animateHeightChange = NO; //turns off animation - - [self.view addSubview:containerView]; - - UIImage *rawEntryBackground = [UIImage imageNamed:@"MessageEntryInputField.png"]; - UIImage *entryBackground = [rawEntryBackground stretchableImageWithLeftCapWidth:13 topCapHeight:22]; - UIImageView *entryImageView = [[UIImageView alloc] initWithImage:entryBackground]; - entryImageView.frame = CGRectMake(5, 0, 248, 40); - entryImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; - - UIImage *rawBackground = [UIImage imageNamed:@"MessageEntryBackground.png"]; - UIImage *background = [rawBackground stretchableImageWithLeftCapWidth:13 topCapHeight:22]; - UIImageView *imageView = [[UIImageView alloc] initWithImage:background]; - imageView.frame = CGRectMake(0, 0, containerView.frame.size.width, containerView.frame.size.height); - imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; - - textView.autoresizingMask = UIViewAutoresizingFlexibleWidth; - - // view hierachy - [containerView addSubview:imageView]; - [containerView addSubview:textView]; - [containerView addSubview:entryImageView]; - - UIImage *sendBtnBackground = [[UIImage imageNamed:@"MessageEntrySendButton.png"] stretchableImageWithLeftCapWidth:13 topCapHeight:0]; - UIImage *selectedSendBtnBackground = [[UIImage imageNamed:@"MessageEntrySendButton.png"] stretchableImageWithLeftCapWidth:13 topCapHeight:0]; - - UIButton *doneBtn = [UIButton buttonWithType:UIButtonTypeCustom]; - doneBtn.frame = CGRectMake(containerView.frame.size.width - 69, 8, 63, 27); - doneBtn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin; - [doneBtn setTitle:@"Done" forState:UIControlStateNormal]; - - [doneBtn setTitleShadowColor:[UIColor colorWithWhite:0 alpha:0.4] forState:UIControlStateNormal]; - doneBtn.titleLabel.shadowOffset = CGSizeMake (0.0, -1.0); - doneBtn.titleLabel.font = [UIFont boldSystemFontOfSize:18.0f]; - - [doneBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - [doneBtn addTarget:self action:@selector(resignTextView) forControlEvents:UIControlEventTouchUpInside]; - [doneBtn setBackgroundImage:sendBtnBackground forState:UIControlStateNormal]; - [doneBtn setBackgroundImage:selectedSendBtnBackground forState:UIControlStateSelected]; - [containerView addSubview:doneBtn]; - containerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; -} - --(void)resignTextView -{ - [textView resignFirstResponder]; -} - -//Code from Brett Schumann --(void) keyboardWillShow:(NSNotification *)note{ - // get keyboard size and loctaion - CGRect keyboardBounds; - [[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue: &keyboardBounds]; - NSNumber *duration = [note.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey]; - NSNumber *curve = [note.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey]; - - // Need to translate the bounds to account for rotation. - keyboardBounds = [self.view convertRect:keyboardBounds toView:nil]; - - // get a rect for the textView frame - CGRect containerFrame = containerView.frame; - containerFrame.origin.y = self.view.bounds.size.height - (keyboardBounds.size.height + containerFrame.size.height); - // animations settings - [UIView beginAnimations:nil context:NULL]; - [UIView setAnimationBeginsFromCurrentState:YES]; - [UIView setAnimationDuration:[duration doubleValue]]; - [UIView setAnimationCurve:[curve intValue]]; - - // set views with new info - containerView.frame = containerFrame; - - - // commit animations - [UIView commitAnimations]; -} - --(void) keyboardWillHide:(NSNotification *)note{ - NSNumber *duration = [note.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey]; - NSNumber *curve = [note.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey]; - - // get a rect for the textView frame - CGRect containerFrame = containerView.frame; - containerFrame.origin.y = self.view.bounds.size.height - containerFrame.size.height; - - // animations settings - [UIView beginAnimations:nil context:NULL]; - [UIView setAnimationBeginsFromCurrentState:YES]; - [UIView setAnimationDuration:[duration doubleValue]]; - [UIView setAnimationCurve:[curve intValue]]; - - // set views with new info - containerView.frame = containerFrame; - - // commit animations - [UIView commitAnimations]; -} - -- (void)growingTextView:(HPGrowingTextView *)growingTextView willChangeHeight:(float)height -{ - float diff = (growingTextView.frame.size.height - height); - - CGRect r = containerView.frame; - r.size.height -= diff; - r.origin.y += diff; - containerView.frame = r; -} - --(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation -{ - return YES; -} - -- (void)didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - - // Release any cached data, images, etc that aren't in use. -} - -- (void)viewDidUnload { - // Release any retained subviews of the main view. - // e.g. self.myOutlet = nil; -} - - - -@end diff --git a/example/Default-568h@2x.png b/example/Default-568h@2x.png deleted file mode 100644 index 0891b7a..0000000 Binary files a/example/Default-568h@2x.png and /dev/null differ diff --git a/example/GrowingTextViewExample-Info.plist b/example/GrowingTextViewExample-Info.plist deleted file mode 100644 index 3289444..0000000 --- a/example/GrowingTextViewExample-Info.plist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDisplayName - ${PRODUCT_NAME} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - NSMainNibFile - MainWindow - - diff --git a/example/GrowingTextViewExample.xcodeproj/project.pbxproj b/example/GrowingTextViewExample.xcodeproj/project.pbxproj deleted file mode 100755 index 53f47ed..0000000 --- a/example/GrowingTextViewExample.xcodeproj/project.pbxproj +++ /dev/null @@ -1,320 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1D3623260D0F684500981E51 /* GrowingTextViewExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* GrowingTextViewExampleAppDelegate.m */; }; - 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; - 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; - 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; - 28D7ACF80DDB3853001CB0EB /* GrowingTextViewExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* GrowingTextViewExampleViewController.m */; }; - 3A5B30CE13EC633200DB7A65 /* HPGrowingTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A5B30CB13EC633200DB7A65 /* HPGrowingTextView.m */; }; - 3A5B30CF13EC633200DB7A65 /* HPTextViewInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A5B30CD13EC633200DB7A65 /* HPTextViewInternal.m */; }; - 3A6144DE17719E8500311E3E /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3A6144DD17719E8500311E3E /* Default-568h@2x.png */; }; - 3AC80F9613EC953D00712F9A /* MessageEntryBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = 3AC80F9213EC953D00712F9A /* MessageEntryBackground.png */; }; - 3AC80F9713EC953D00712F9A /* MessageEntryBackground@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3AC80F9313EC953D00712F9A /* MessageEntryBackground@2x.png */; }; - 3AC80F9813EC953D00712F9A /* MessageEntryInputField.png in Resources */ = {isa = PBXBuildFile; fileRef = 3AC80F9413EC953D00712F9A /* MessageEntryInputField.png */; }; - 3AC80F9913EC953D00712F9A /* MessageEntryInputField@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3AC80F9513EC953D00712F9A /* MessageEntryInputField@2x.png */; }; - 3ADB373513EE98D60006E262 /* MessageEntrySendButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 3ADB373113EE98D60006E262 /* MessageEntrySendButton.png */; }; - 3ADB373613EE98D60006E262 /* MessageEntrySendButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3ADB373213EE98D60006E262 /* MessageEntrySendButton@2x.png */; }; - 3ADB373713EE98D60006E262 /* MessageEntrySendButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 3ADB373313EE98D60006E262 /* MessageEntrySendButtonPressed.png */; }; - 3ADB373813EE98D60006E262 /* MessageEntrySendButtonPressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3ADB373413EE98D60006E262 /* MessageEntrySendButtonPressed@2x.png */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1D3623240D0F684500981E51 /* GrowingTextViewExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrowingTextViewExampleAppDelegate.h; sourceTree = ""; }; - 1D3623250D0F684500981E51 /* GrowingTextViewExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GrowingTextViewExampleAppDelegate.m; sourceTree = ""; }; - 1D6058910D05DD3D006BFB54 /* GrowingTextViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GrowingTextViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; - 28D7ACF60DDB3853001CB0EB /* GrowingTextViewExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrowingTextViewExampleViewController.h; sourceTree = ""; }; - 28D7ACF70DDB3853001CB0EB /* GrowingTextViewExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GrowingTextViewExampleViewController.m; sourceTree = ""; }; - 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 32CA4F630368D1EE00C91783 /* GrowingTextViewExample_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrowingTextViewExample_Prefix.pch; sourceTree = ""; }; - 3A5B30CA13EC633200DB7A65 /* HPGrowingTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HPGrowingTextView.h; sourceTree = ""; }; - 3A5B30CB13EC633200DB7A65 /* HPGrowingTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HPGrowingTextView.m; sourceTree = ""; }; - 3A5B30CC13EC633200DB7A65 /* HPTextViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HPTextViewInternal.h; sourceTree = ""; }; - 3A5B30CD13EC633200DB7A65 /* HPTextViewInternal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HPTextViewInternal.m; sourceTree = ""; }; - 3A6144DD17719E8500311E3E /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; - 3AC80F9213EC953D00712F9A /* MessageEntryBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MessageEntryBackground.png; sourceTree = ""; }; - 3AC80F9313EC953D00712F9A /* MessageEntryBackground@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "MessageEntryBackground@2x.png"; sourceTree = ""; }; - 3AC80F9413EC953D00712F9A /* MessageEntryInputField.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MessageEntryInputField.png; sourceTree = ""; }; - 3AC80F9513EC953D00712F9A /* MessageEntryInputField@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "MessageEntryInputField@2x.png"; sourceTree = ""; }; - 3ADB373113EE98D60006E262 /* MessageEntrySendButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MessageEntrySendButton.png; sourceTree = ""; }; - 3ADB373213EE98D60006E262 /* MessageEntrySendButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "MessageEntrySendButton@2x.png"; sourceTree = ""; }; - 3ADB373313EE98D60006E262 /* MessageEntrySendButtonPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MessageEntrySendButtonPressed.png; sourceTree = ""; }; - 3ADB373413EE98D60006E262 /* MessageEntrySendButtonPressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "MessageEntrySendButtonPressed@2x.png"; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* GrowingTextViewExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GrowingTextViewExample-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, - 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 080E96DDFE201D6D7F000001 /* Classes */ = { - isa = PBXGroup; - children = ( - 3A5B30C913EC633200DB7A65 /* HPGrowingTextView */, - 1D3623240D0F684500981E51 /* GrowingTextViewExampleAppDelegate.h */, - 1D3623250D0F684500981E51 /* GrowingTextViewExampleAppDelegate.m */, - 28D7ACF60DDB3853001CB0EB /* GrowingTextViewExampleViewController.h */, - 28D7ACF70DDB3853001CB0EB /* GrowingTextViewExampleViewController.m */, - ); - path = Classes; - sourceTree = ""; - }; - 19C28FACFE9D520D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 1D6058910D05DD3D006BFB54 /* GrowingTextViewExample.app */, - ); - name = Products; - sourceTree = ""; - }; - 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { - isa = PBXGroup; - children = ( - 080E96DDFE201D6D7F000001 /* Classes */, - 29B97315FDCFA39411CA2CEA /* Other Sources */, - 29B97317FDCFA39411CA2CEA /* Resources */, - 29B97323FDCFA39411CA2CEA /* Frameworks */, - 19C28FACFE9D520D11CA2CBB /* Products */, - ); - name = CustomTemplate; - sourceTree = ""; - }; - 29B97315FDCFA39411CA2CEA /* Other Sources */ = { - isa = PBXGroup; - children = ( - 3A6144DD17719E8500311E3E /* Default-568h@2x.png */, - 32CA4F630368D1EE00C91783 /* GrowingTextViewExample_Prefix.pch */, - 29B97316FDCFA39411CA2CEA /* main.m */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 29B97317FDCFA39411CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - 3ADB373113EE98D60006E262 /* MessageEntrySendButton.png */, - 3ADB373213EE98D60006E262 /* MessageEntrySendButton@2x.png */, - 3ADB373313EE98D60006E262 /* MessageEntrySendButtonPressed.png */, - 3ADB373413EE98D60006E262 /* MessageEntrySendButtonPressed@2x.png */, - 3AC80F9213EC953D00712F9A /* MessageEntryBackground.png */, - 3AC80F9313EC953D00712F9A /* MessageEntryBackground@2x.png */, - 3AC80F9413EC953D00712F9A /* MessageEntryInputField.png */, - 3AC80F9513EC953D00712F9A /* MessageEntryInputField@2x.png */, - 28AD733E0D9D9553002E5188 /* MainWindow.xib */, - 8D1107310486CEB800E47090 /* GrowingTextViewExample-Info.plist */, - ); - name = Resources; - sourceTree = ""; - }; - 29B97323FDCFA39411CA2CEA /* Frameworks */ = { - isa = PBXGroup; - children = ( - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, - 1D30AB110D05D00D00671497 /* Foundation.framework */, - 288765A40DF7441C002DB57D /* CoreGraphics.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 3A5B30C913EC633200DB7A65 /* HPGrowingTextView */ = { - isa = PBXGroup; - children = ( - 3A5B30CA13EC633200DB7A65 /* HPGrowingTextView.h */, - 3A5B30CB13EC633200DB7A65 /* HPGrowingTextView.m */, - 3A5B30CC13EC633200DB7A65 /* HPTextViewInternal.h */, - 3A5B30CD13EC633200DB7A65 /* HPTextViewInternal.m */, - ); - name = HPGrowingTextView; - path = ../../class; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 1D6058900D05DD3D006BFB54 /* GrowingTextViewExample */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "GrowingTextViewExample" */; - buildPhases = ( - 1D60588D0D05DD3D006BFB54 /* Resources */, - 1D60588E0D05DD3D006BFB54 /* Sources */, - 1D60588F0D05DD3D006BFB54 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = GrowingTextViewExample; - productName = GrowingTextViewExample; - productReference = 1D6058910D05DD3D006BFB54 /* GrowingTextViewExample.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0460; - }; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GrowingTextViewExample" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 1D6058900D05DD3D006BFB54 /* GrowingTextViewExample */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 1D60588D0D05DD3D006BFB54 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, - 3AC80F9613EC953D00712F9A /* MessageEntryBackground.png in Resources */, - 3AC80F9713EC953D00712F9A /* MessageEntryBackground@2x.png in Resources */, - 3AC80F9813EC953D00712F9A /* MessageEntryInputField.png in Resources */, - 3AC80F9913EC953D00712F9A /* MessageEntryInputField@2x.png in Resources */, - 3ADB373513EE98D60006E262 /* MessageEntrySendButton.png in Resources */, - 3ADB373613EE98D60006E262 /* MessageEntrySendButton@2x.png in Resources */, - 3ADB373713EE98D60006E262 /* MessageEntrySendButtonPressed.png in Resources */, - 3ADB373813EE98D60006E262 /* MessageEntrySendButtonPressed@2x.png in Resources */, - 3A6144DE17719E8500311E3E /* Default-568h@2x.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 1D60588E0D05DD3D006BFB54 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D60589B0D05DD56006BFB54 /* main.m in Sources */, - 1D3623260D0F684500981E51 /* GrowingTextViewExampleAppDelegate.m in Sources */, - 28D7ACF80DDB3853001CB0EB /* GrowingTextViewExampleViewController.m in Sources */, - 3A5B30CE13EC633200DB7A65 /* HPGrowingTextView.m in Sources */, - 3A5B30CF13EC633200DB7A65 /* HPTextViewInternal.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1D6058940D05DD3E006BFB54 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ENABLE_OBJC_ARC = YES; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = GrowingTextViewExample_Prefix.pch; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - INFOPLIST_FILE = "GrowingTextViewExample-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; - PRODUCT_NAME = GrowingTextViewExample; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 1D6058950D05DD3E006BFB54 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ENABLE_OBJC_ARC = YES; - COPY_PHASE_STRIP = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = GrowingTextViewExample_Prefix.pch; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - INFOPLIST_FILE = "GrowingTextViewExample-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; - PRODUCT_NAME = GrowingTextViewExample; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - C01FCF4F08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - C01FCF5008A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; - SDKROOT = iphoneos; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "GrowingTextViewExample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1D6058940D05DD3E006BFB54 /* Debug */, - 1D6058950D05DD3E006BFB54 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GrowingTextViewExample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4F08A954540054247B /* Debug */, - C01FCF5008A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; -} diff --git a/example/GrowingTextViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/GrowingTextViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 3ec2204..0000000 --- a/example/GrowingTextViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/example/GrowingTextViewExample.xcodeproj/project.xcworkspace/xcshareddata/GrowingTextViewExample.xccheckout b/example/GrowingTextViewExample.xcodeproj/project.xcworkspace/xcshareddata/GrowingTextViewExample.xccheckout deleted file mode 100644 index 67ae5e2..0000000 --- a/example/GrowingTextViewExample.xcodeproj/project.xcworkspace/xcshareddata/GrowingTextViewExample.xccheckout +++ /dev/null @@ -1,39 +0,0 @@ - - - - - IDESourceControlProjectIdentifier - CE238A39-5956-41F7-AD07-B1520BDD9DD1 - IDESourceControlProjectName - GrowingTextViewExample - IDESourceControlProjectOriginsDictionary - - 833FB93F-BB7B-4266-AA8D-9FF985F70642 - https://github.com/HansPinckaers/GrowingTextView.git - - IDESourceControlProjectPath - example/GrowingTextViewExample.xcodeproj/project.xcworkspace - IDESourceControlProjectRelativeInstallPathDictionary - - 833FB93F-BB7B-4266-AA8D-9FF985F70642 - ../../.. - - IDESourceControlProjectURL - https://github.com/HansPinckaers/GrowingTextView.git - IDESourceControlProjectVersion - 110 - IDESourceControlProjectWCCIdentifier - 833FB93F-BB7B-4266-AA8D-9FF985F70642 - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - 833FB93F-BB7B-4266-AA8D-9FF985F70642 - IDESourceControlWCCName - GrowingTextView - - - - diff --git a/example/GrowingTextViewExample.xcodeproj/xcuserdata/Hans.xcuserdatad/xcschemes/GrowingTextViewExample.xcscheme b/example/GrowingTextViewExample.xcodeproj/xcuserdata/Hans.xcuserdatad/xcschemes/GrowingTextViewExample.xcscheme deleted file mode 100644 index 6402da6..0000000 --- a/example/GrowingTextViewExample.xcodeproj/xcuserdata/Hans.xcuserdatad/xcschemes/GrowingTextViewExample.xcscheme +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/GrowingTextViewExample.xcodeproj/xcuserdata/Hans.xcuserdatad/xcschemes/xcschememanagement.plist b/example/GrowingTextViewExample.xcodeproj/xcuserdata/Hans.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index e46a121..0000000 --- a/example/GrowingTextViewExample.xcodeproj/xcuserdata/Hans.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - GrowingTextViewExample.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 1D6058900D05DD3D006BFB54 - - primary - - - - - diff --git a/example/GrowingTextViewExample_Prefix.pch b/example/GrowingTextViewExample_Prefix.pch deleted file mode 100644 index 277fdfb..0000000 --- a/example/GrowingTextViewExample_Prefix.pch +++ /dev/null @@ -1,8 +0,0 @@ -// -// Prefix header for all source files of the 'GrowingTextViewExample' target in the 'GrowingTextViewExample' project -// - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/example/MainWindow.xib b/example/MainWindow.xib deleted file mode 100644 index edaefc1..0000000 --- a/example/MainWindow.xib +++ /dev/null @@ -1,417 +0,0 @@ - - - - 1024 - 10F569 - 788 - 1038.29 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 117 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - IBCocoaTouchFramework - - - - 292 - {320, 480} - - - 1 - MSAxIDEAA - - NO - NO - - IBCocoaTouchFramework - YES - - - - - YES - - - delegate - - - - 4 - - - - window - - - - 14 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - 3 - - - GrowingTextViewExample App Delegate - - - -2 - - - - - 12 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 12.IBEditorWindowLastContentRect - 12.IBPluginDependency - 3.CustomClassName - 3.IBPluginDependency - - - YES - UIApplication - UIResponder - {{525, 276}, {320, 480}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - GrowingTextViewExampleAppDelegate - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 15 - - - - YES - - GrowingTextViewExampleAppDelegate - NSObject - - YES - - YES - viewController - window - - - YES - GrowingTextViewExampleViewController - UIWindow - - - - YES - - YES - viewController - window - - - YES - - viewController - GrowingTextViewExampleViewController - - - window - UIWindow - - - - - IBProjectSource - Classes/GrowingTextViewExampleAppDelegate.h - - - - GrowingTextViewExampleAppDelegate - NSObject - - IBUserSource - - - - - GrowingTextViewExampleViewController - UIViewController - - IBProjectSource - Classes/GrowingTextViewExampleViewController.h - - - - UIWindow - UIView - - IBUserSource - - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIApplication - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIApplication.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - UIWindow - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIWindow.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - GrowingTextViewExample.xcodeproj - 3 - 117 - - diff --git a/example/MessageEntryBackground.png b/example/MessageEntryBackground.png deleted file mode 100644 index 1db2bce..0000000 Binary files a/example/MessageEntryBackground.png and /dev/null differ diff --git a/example/MessageEntryBackground@2x.png b/example/MessageEntryBackground@2x.png deleted file mode 100644 index 53d805a..0000000 Binary files a/example/MessageEntryBackground@2x.png and /dev/null differ diff --git a/example/MessageEntryInputField.png b/example/MessageEntryInputField.png deleted file mode 100644 index f784561..0000000 Binary files a/example/MessageEntryInputField.png and /dev/null differ diff --git a/example/MessageEntryInputField@2x.png b/example/MessageEntryInputField@2x.png deleted file mode 100644 index 6841607..0000000 Binary files a/example/MessageEntryInputField@2x.png and /dev/null differ diff --git a/example/MessageEntrySendButton.png b/example/MessageEntrySendButton.png deleted file mode 100644 index 1c7d1d8..0000000 Binary files a/example/MessageEntrySendButton.png and /dev/null differ diff --git a/example/MessageEntrySendButton@2x.png b/example/MessageEntrySendButton@2x.png deleted file mode 100644 index 086083d..0000000 Binary files a/example/MessageEntrySendButton@2x.png and /dev/null differ diff --git a/example/MessageEntrySendButtonPressed.png b/example/MessageEntrySendButtonPressed.png deleted file mode 100644 index f7397d1..0000000 Binary files a/example/MessageEntrySendButtonPressed.png and /dev/null differ diff --git a/example/MessageEntrySendButtonPressed@2x.png b/example/MessageEntrySendButtonPressed@2x.png deleted file mode 100644 index c9a662c..0000000 Binary files a/example/MessageEntrySendButtonPressed@2x.png and /dev/null differ diff --git a/example/main.m b/example/main.m deleted file mode 100644 index 524f817..0000000 --- a/example/main.m +++ /dev/null @@ -1,36 +0,0 @@ -// -// main.m -// -// Created by Hans Pinckaers on 29-06-10. -// -// MIT License -// -// Copyright (c) 2011 Hans Pinckaers -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import - -int main(int argc, char *argv[]) { - - @autoreleasepool { - int retVal = UIApplicationMain(argc, argv, nil, nil); - return retVal; - } -}