├── TextInputLimit ├── Assets │ └── .gitkeep ├── Classes │ ├── .gitkeep │ ├── .DS_Store │ ├── LimitInput.h │ └── LimitInput.m └── .DS_Store ├── .DS_Store ├── Podfile ├── TextInputLimitTest ├── en.lproj │ └── InfoPlist.strings ├── AppDelegate.h ├── main.m ├── ViewController.h ├── TextInputLimitTest-Prefix.pch ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── ViewController.m ├── TextInputLimitTest-Info.plist ├── AppDelegate.m └── Base.lproj │ └── Main.storyboard ├── TextInputLimitTestTests ├── en.lproj │ └── InfoPlist.strings ├── TextInputLimitTestTests-Info.plist └── TextInputLimitTestTests.m ├── TextInputLimitTest.xcodeproj ├── xcuserdata │ ├── aqua.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── TextInputLimitTest.xcscheme │ └── hongjingjun.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── TextInputLimitTest.xcscheme ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcuserdata │ │ ├── aqua.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ └── hongjingjun.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcshareddata │ │ └── TextInputLimitTest.xccheckout └── project.pbxproj ├── LICENSE ├── TextInputLimit.podspec └── README.md /TextInputLimit/Assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /TextInputLimit/Classes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuwening/textInputLimit/HEAD/.DS_Store -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | 2 | target 'TextInputLimitTest' do 3 | 4 | pod "TextInputLimit" 5 | 6 | end -------------------------------------------------------------------------------- /TextInputLimitTest/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /TextInputLimitTestTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /TextInputLimit/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuwening/textInputLimit/HEAD/TextInputLimit/.DS_Store -------------------------------------------------------------------------------- /TextInputLimit/Classes/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuwening/textInputLimit/HEAD/TextInputLimit/Classes/.DS_Store -------------------------------------------------------------------------------- /TextInputLimitTest.xcodeproj/xcuserdata/aqua.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /TextInputLimitTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TextInputLimitTest.xcodeproj/project.xcworkspace/xcuserdata/aqua.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuwening/textInputLimit/HEAD/TextInputLimitTest.xcodeproj/project.xcworkspace/xcuserdata/aqua.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /TextInputLimitTest.xcodeproj/project.xcworkspace/xcuserdata/hongjingjun.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuwening/textInputLimit/HEAD/TextInputLimitTest.xcodeproj/project.xcworkspace/xcuserdata/hongjingjun.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /TextInputLimitTest/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // TextInputLimitTest 4 | // 5 | // Created by aqua on 14-9-2. 6 | // Copyright (c) 2014年 aqua. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /TextInputLimitTest/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TextInputLimitTest 4 | // 5 | // Created by aqua on 14-9-2. 6 | // Copyright (c) 2014年 aqua. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TextInputLimitTest/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // TextInputLimitTest 4 | // 5 | // Created by aqua on 14-9-2. 6 | // Copyright (c) 2014年 aqua. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @property (weak, nonatomic) IBOutlet UITextField *textfield; 15 | @property (weak, nonatomic) IBOutlet UITextView *textview; 16 | 17 | 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /TextInputLimitTest/TextInputLimitTest-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /TextInputLimitTest/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /TextInputLimitTest/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /TextInputLimit/Classes/LimitInput.h: -------------------------------------------------------------------------------- 1 | // 2 | // LimitInput.h 3 | // singleview 4 | // 5 | // Created by aqua on 14-8-30. 6 | // Copyright (c) 2014年 aqua. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | #define PROPERTY_NAME @"limit" 14 | 15 | #define DECLARE_PROPERTY(className) \ 16 | @interface className (Limit) @end 17 | 18 | DECLARE_PROPERTY(UITextField) 19 | DECLARE_PROPERTY(UITextView) 20 | 21 | @interface LimitInput : NSObject 22 | 23 | @property(nonatomic, assign) BOOL enableLimitCount; 24 | 25 | +(LimitInput *) sharedInstance; 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /TextInputLimitTest.xcodeproj/xcuserdata/aqua.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | TextInputLimitTest.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 5211B3F619B56CFC00CF13DD 16 | 17 | primary 18 | 19 | 20 | 5211B41719B56CFD00CF13DD 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /TextInputLimitTest.xcodeproj/xcuserdata/hongjingjun.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | TextInputLimitTest.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 5211B3F619B56CFC00CF13DD 16 | 17 | primary 18 | 19 | 20 | 5211B41719B56CFD00CF13DD 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /TextInputLimitTestTests/TextInputLimitTestTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.freedom.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /TextInputLimitTestTests/TextInputLimitTestTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // TextInputLimitTestTests.m 3 | // TextInputLimitTestTests 4 | // 5 | // Created by aqua on 14-9-2. 6 | // Copyright (c) 2014年 aqua. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TextInputLimitTestTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation TextInputLimitTestTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 xuwening 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /TextInputLimitTest/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // TextInputLimitTest 4 | // 5 | // Created by aqua on 14-9-2. 6 | // Copyright (c) 2014年 aqua. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad 18 | { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | 22 | [self.textfield setValue:@4 forKey:@"limit"]; 23 | [self.textview setValue:@6 forKey:@"limit"]; 24 | 25 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textLimitLenght:) name:@"acceptLimitLength" object:nil]; 26 | } 27 | 28 | -(void) textLimitLenght: (NSNotification *) notification { 29 | 30 | NSObject *object = notification.object; 31 | 32 | if ([object isEqual: self.textview]) { 33 | //收到来自textview的输入限制 34 | } 35 | 36 | if ([object isEqual: self.textfield]) { 37 | //收到来自textfield的输入限制 38 | } 39 | //提示 40 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"您输入的长度过长,自动被截断。" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; 41 | [alert show]; 42 | } 43 | 44 | - (void)didReceiveMemoryWarning 45 | { 46 | [super didReceiveMemoryWarning]; 47 | // Dispose of any resources that can be recreated. 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /TextInputLimitTest/TextInputLimitTest-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.freedom.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | Main 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /TextInputLimitTest.xcodeproj/project.xcworkspace/xcshareddata/TextInputLimitTest.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | EB4A66A2-0494-4834-B6F6-28CCD12FEE34 9 | IDESourceControlProjectName 10 | TextInputLimitTest 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 0C4896CC89004874390E1DC4B3DD681DDA0D136F 14 | github.com:xuwening/textInputLimit.git 15 | 16 | IDESourceControlProjectPath 17 | TextInputLimitTest.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 0C4896CC89004874390E1DC4B3DD681DDA0D136F 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | github.com:xuwening/textInputLimit.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 0C4896CC89004874390E1DC4B3DD681DDA0D136F 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 0C4896CC89004874390E1DC4B3DD681DDA0D136F 36 | IDESourceControlWCCName 37 | textInputLimit 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /TextInputLimit.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint TextInputLimit.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'TextInputLimit' 11 | s.version = '1.0.2' 12 | s.summary = 'set a limit input to UITextField and UITextView.' 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | 20 | s.description = <<-DESC 21 | set a limit input to UITextField and UITextView. 22 | DESC 23 | 24 | s.homepage = 'https://github.com/xuwening/textInputLimit' 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 26 | s.license = { :type => 'MIT', :file => 'LICENSE' } 27 | s.author = { 'xuwening' => 'xuwening@126.com' } 28 | s.source = { :git => 'https://github.com/xuwening/textInputLimit.git', :tag => s.version.to_s } 29 | # s.social_media_url = 'https://twitter.com/' 30 | 31 | s.ios.deployment_target = '6.0' 32 | 33 | s.source_files = 'TextInputLimit/Classes/**/*' 34 | 35 | # s.resource_bundles = { 36 | # 'TextInputLimit' => ['TextInputLimit/Assets/*.png'] 37 | # } 38 | 39 | # s.public_header_files = 'Pod/Classes/**/*.h' 40 | # s.frameworks = 'UIKit', 'MapKit' 41 | # s.dependency 'AFNetworking', '~> 2.3' 42 | end 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TextInputLimit 2 | ============== 3 | TextInputLimit是ios下的一个文本框输入文字长度限制的库,使用起来十分简单方便。 4 | 5 | 1、支持系统版本 6 | 7 | `spec文件`设置最低版本为iOS 6.0,实际可以支撑更低,如果有需求可以手动集成。 8 | 9 | 1、cocoapods自动集成 10 | ----------- 11 | 12 | `pod 'TextInputLimit', '~> 1.0.2'` 13 | 14 | 15 | 2、手工方式集成 16 | ----------- 17 | 18 | 将TextInputLimit文件夹直接拖入工程中即可。 19 | 20 | 使用方式 21 | --------- 22 | 23 | 在调用需要做输入长度限制的textField或textView ***对象*** 方法: 24 | 25 | `[textObj setValue:@4 forKey:@"limit"];` 26 | 27 | > 长度限制只影响设置limit属性的对象,没有设置limit属性的对象不受影响。 28 | 29 | 30 | ***使用过程中不需要对UITextField和UITextView或Xib文件做任何修改,也不需要引用头文件。*** 31 | 32 | 扩展(可选项) 33 | ----------- 34 | 35 | 如果需要在输入限制的同时,做些额外处理,如:提示用户输入文字过多,或做些动画特效等,可以注册`acceptLimitLength`通知。 36 | 37 | ```objective-c 38 | [[NSNotificationCenter defaultCenter] addObserver:self 39 | selector:@selector(textLimitLenght:) 40 | name:@"acceptLimitLength" 41 | object:nil]; 42 | 43 | 44 | -(void) textLimitLenght: (NSNotification *) notification { 45 | 46 | NSObject *object = notification.object; 47 | 48 | if ([object isEqual: self.textview]) { 49 | //收到来自textview的输入限制 50 | } 51 | 52 | if ([object isEqual: self.textfield]) { 53 | //收到来自textfield的输入限制 54 | } 55 | //提示 56 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" 57 | message:@"您输入的长度过长,自动被截断。" 58 | delegate:self 59 | cancelButtonTitle:@"确定" 60 | otherButtonTitles:nil, nil]; 61 | [alert show]; 62 | } 63 | ``` 64 | 65 | 66 | 运行demo 67 | -------- 68 | 69 | `git clone https://github.com/xuwening/textInputLimit.git` 70 | 71 | `cd textInputLimit && pod install` 72 | 73 | 打开`TextInputLimitTest.xcworkspace`运行。 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /TextInputLimitTest/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // TextInputLimitTest 4 | // 5 | // Created by aqua on 14-9-2. 6 | // Copyright (c) 2014年 aqua. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /TextInputLimit/Classes/LimitInput.m: -------------------------------------------------------------------------------- 1 | // 2 | // LimitInput.m 3 | // singleview 4 | // 5 | // Created by aqua on 14-8-30. 6 | // Copyright (c) 2014年 aqua. All rights reserved. 7 | // 8 | 9 | #import "LimitInput.h" 10 | #import 11 | 12 | 13 | #define RUNTIME_ADD_PROPERTY(propertyName) \ 14 | -(id)valueForUndefinedKey:(NSString *)key { \ 15 | if ([key isEqualToString:propertyName]) { \ 16 | return objc_getAssociatedObject(self, key.UTF8String); \ 17 | } \ 18 | return nil; \ 19 | } \ 20 | -(void)setValue:(id)value forUndefinedKey:(NSString *)key { \ 21 | if ([key isEqualToString:propertyName]) { \ 22 | objc_setAssociatedObject(self, key.UTF8String, value, OBJC_ASSOCIATION_RETAIN); \ 23 | } \ 24 | } 25 | 26 | #define IMPLEMENT_PROPERTY(className) \ 27 | @implementation className (Limit) RUNTIME_ADD_PROPERTY(PROPERTY_NAME) @end 28 | 29 | IMPLEMENT_PROPERTY(UITextField) 30 | IMPLEMENT_PROPERTY(UITextView) 31 | 32 | @implementation LimitInput 33 | 34 | 35 | +(void) load { 36 | [super load]; 37 | [LimitInput sharedInstance]; 38 | } 39 | 40 | 41 | +(LimitInput *) sharedInstance { 42 | static LimitInput *g_limitInput; 43 | static dispatch_once_t onceToken; 44 | dispatch_once(&onceToken, ^{ 45 | 46 | g_limitInput = [[LimitInput alloc] init]; 47 | g_limitInput.enableLimitCount = YES; 48 | }); 49 | 50 | return g_limitInput; 51 | } 52 | 53 | -(id) init { 54 | self = [super init]; 55 | if (self) { 56 | 57 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldViewDidChange:) name:UITextFieldTextDidChangeNotification object: nil]; 58 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textViewDidChange:) name:UITextViewTextDidChangeNotification object: nil]; 59 | } 60 | 61 | return self; 62 | } 63 | 64 | 65 | -(void)textFieldViewDidChange:(NSNotification*)notification { 66 | if (!self.enableLimitCount) return; 67 | UITextField *textField = (UITextField *)notification.object; 68 | 69 | NSNumber *number = [textField valueForKey:PROPERTY_NAME]; 70 | if (number && textField.text.length > [number integerValue] && textField.markedTextRange == nil) { 71 | textField.text = [textField.text substringWithRange: NSMakeRange(0, [number integerValue])]; 72 | [[NSNotificationCenter defaultCenter] postNotificationName:@"acceptLimitLength" object: textField]; 73 | } 74 | } 75 | 76 | 77 | -(void) textViewDidChange: (NSNotification *) notificaiton { 78 | if (!self.enableLimitCount) return; 79 | UITextView *textView = (UITextView *)notificaiton.object; 80 | 81 | NSNumber *number = [textView valueForKey:PROPERTY_NAME]; 82 | if (number && textView.text.length > [number integerValue] && textView.markedTextRange == nil) { 83 | textView.text = [textView.text substringWithRange: NSMakeRange(0, [number integerValue])]; 84 | [[NSNotificationCenter defaultCenter] postNotificationName:@"acceptLimitLength" object: textView]; 85 | } 86 | } 87 | 88 | 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /TextInputLimitTest.xcodeproj/xcuserdata/aqua.xcuserdatad/xcschemes/TextInputLimitTest.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /TextInputLimitTest.xcodeproj/xcuserdata/hongjingjun.xcuserdatad/xcschemes/TextInputLimitTest.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /TextInputLimitTest/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /TextInputLimitTest.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5211B3FB19B56CFD00CF13DD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5211B3FA19B56CFD00CF13DD /* Foundation.framework */; }; 11 | 5211B3FD19B56CFD00CF13DD /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5211B3FC19B56CFD00CF13DD /* CoreGraphics.framework */; }; 12 | 5211B3FF19B56CFD00CF13DD /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5211B3FE19B56CFD00CF13DD /* UIKit.framework */; }; 13 | 5211B40519B56CFD00CF13DD /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5211B40319B56CFD00CF13DD /* InfoPlist.strings */; }; 14 | 5211B40719B56CFD00CF13DD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5211B40619B56CFD00CF13DD /* main.m */; }; 15 | 5211B40B19B56CFD00CF13DD /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5211B40A19B56CFD00CF13DD /* AppDelegate.m */; }; 16 | 5211B40E19B56CFD00CF13DD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5211B40C19B56CFD00CF13DD /* Main.storyboard */; }; 17 | 5211B41119B56CFD00CF13DD /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5211B41019B56CFD00CF13DD /* ViewController.m */; }; 18 | 5211B41319B56CFD00CF13DD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5211B41219B56CFD00CF13DD /* Images.xcassets */; }; 19 | 5211B41A19B56CFD00CF13DD /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5211B41919B56CFD00CF13DD /* XCTest.framework */; }; 20 | 5211B41B19B56CFD00CF13DD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5211B3FA19B56CFD00CF13DD /* Foundation.framework */; }; 21 | 5211B41C19B56CFD00CF13DD /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5211B3FE19B56CFD00CF13DD /* UIKit.framework */; }; 22 | 5211B42419B56CFD00CF13DD /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5211B42219B56CFD00CF13DD /* InfoPlist.strings */; }; 23 | 5211B42619B56CFD00CF13DD /* TextInputLimitTestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5211B42519B56CFD00CF13DD /* TextInputLimitTestTests.m */; }; 24 | 99B10C1C24DAE209A42F313B /* libPods-TextInputLimitTest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A58988B709FAF31B7E997E15 /* libPods-TextInputLimitTest.a */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | 5211B41D19B56CFD00CF13DD /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 5211B3EF19B56CFC00CF13DD /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 5211B3F619B56CFC00CF13DD; 33 | remoteInfo = TextInputLimitTest; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 3978E523BB811BE4A3C41A97 /* Pods-TextInputLimitTest.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TextInputLimitTest.release.xcconfig"; path = "Pods/Target Support Files/Pods-TextInputLimitTest/Pods-TextInputLimitTest.release.xcconfig"; sourceTree = ""; }; 39 | 5211B3F719B56CFC00CF13DD /* TextInputLimitTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TextInputLimitTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 5211B3FA19B56CFD00CF13DD /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 41 | 5211B3FC19B56CFD00CF13DD /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 42 | 5211B3FE19B56CFD00CF13DD /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 43 | 5211B40219B56CFD00CF13DD /* TextInputLimitTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TextInputLimitTest-Info.plist"; sourceTree = ""; }; 44 | 5211B40419B56CFD00CF13DD /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 45 | 5211B40619B56CFD00CF13DD /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 46 | 5211B40819B56CFD00CF13DD /* TextInputLimitTest-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TextInputLimitTest-Prefix.pch"; sourceTree = ""; }; 47 | 5211B40919B56CFD00CF13DD /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | 5211B40A19B56CFD00CF13DD /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | 5211B40D19B56CFD00CF13DD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 5211B40F19B56CFD00CF13DD /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 51 | 5211B41019B56CFD00CF13DD /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 52 | 5211B41219B56CFD00CF13DD /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 53 | 5211B41819B56CFD00CF13DD /* TextInputLimitTestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TextInputLimitTestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 5211B41919B56CFD00CF13DD /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 55 | 5211B42119B56CFD00CF13DD /* TextInputLimitTestTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TextInputLimitTestTests-Info.plist"; sourceTree = ""; }; 56 | 5211B42319B56CFD00CF13DD /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 57 | 5211B42519B56CFD00CF13DD /* TextInputLimitTestTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TextInputLimitTestTests.m; sourceTree = ""; }; 58 | A58988B709FAF31B7E997E15 /* libPods-TextInputLimitTest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-TextInputLimitTest.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | BC5627E7852EFB48ED77C39E /* Pods-TextInputLimitTest.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TextInputLimitTest.debug.xcconfig"; path = "Pods/Target Support Files/Pods-TextInputLimitTest/Pods-TextInputLimitTest.debug.xcconfig"; sourceTree = ""; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | 5211B3F419B56CFC00CF13DD /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | 5211B3FD19B56CFD00CF13DD /* CoreGraphics.framework in Frameworks */, 68 | 5211B3FF19B56CFD00CF13DD /* UIKit.framework in Frameworks */, 69 | 5211B3FB19B56CFD00CF13DD /* Foundation.framework in Frameworks */, 70 | 99B10C1C24DAE209A42F313B /* libPods-TextInputLimitTest.a in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 5211B41519B56CFD00CF13DD /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | 5211B41A19B56CFD00CF13DD /* XCTest.framework in Frameworks */, 79 | 5211B41C19B56CFD00CF13DD /* UIKit.framework in Frameworks */, 80 | 5211B41B19B56CFD00CF13DD /* Foundation.framework in Frameworks */, 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | 5211B3EE19B56CFC00CF13DD = { 88 | isa = PBXGroup; 89 | children = ( 90 | 5211B40019B56CFD00CF13DD /* TextInputLimitTest */, 91 | 5211B41F19B56CFD00CF13DD /* TextInputLimitTestTests */, 92 | 5211B3F919B56CFC00CF13DD /* Frameworks */, 93 | 5211B3F819B56CFC00CF13DD /* Products */, 94 | 87E8CA8208D3AA06C924C50E /* Pods */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 5211B3F819B56CFC00CF13DD /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 5211B3F719B56CFC00CF13DD /* TextInputLimitTest.app */, 102 | 5211B41819B56CFD00CF13DD /* TextInputLimitTestTests.xctest */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | 5211B3F919B56CFC00CF13DD /* Frameworks */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 5211B3FA19B56CFD00CF13DD /* Foundation.framework */, 111 | 5211B3FC19B56CFD00CF13DD /* CoreGraphics.framework */, 112 | 5211B3FE19B56CFD00CF13DD /* UIKit.framework */, 113 | 5211B41919B56CFD00CF13DD /* XCTest.framework */, 114 | A58988B709FAF31B7E997E15 /* libPods-TextInputLimitTest.a */, 115 | ); 116 | name = Frameworks; 117 | sourceTree = ""; 118 | }; 119 | 5211B40019B56CFD00CF13DD /* TextInputLimitTest */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 5211B40919B56CFD00CF13DD /* AppDelegate.h */, 123 | 5211B40A19B56CFD00CF13DD /* AppDelegate.m */, 124 | 5211B40C19B56CFD00CF13DD /* Main.storyboard */, 125 | 5211B40F19B56CFD00CF13DD /* ViewController.h */, 126 | 5211B41019B56CFD00CF13DD /* ViewController.m */, 127 | 5211B41219B56CFD00CF13DD /* Images.xcassets */, 128 | 5211B40119B56CFD00CF13DD /* Supporting Files */, 129 | ); 130 | path = TextInputLimitTest; 131 | sourceTree = ""; 132 | }; 133 | 5211B40119B56CFD00CF13DD /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 5211B40219B56CFD00CF13DD /* TextInputLimitTest-Info.plist */, 137 | 5211B40319B56CFD00CF13DD /* InfoPlist.strings */, 138 | 5211B40619B56CFD00CF13DD /* main.m */, 139 | 5211B40819B56CFD00CF13DD /* TextInputLimitTest-Prefix.pch */, 140 | ); 141 | name = "Supporting Files"; 142 | sourceTree = ""; 143 | }; 144 | 5211B41F19B56CFD00CF13DD /* TextInputLimitTestTests */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 5211B42519B56CFD00CF13DD /* TextInputLimitTestTests.m */, 148 | 5211B42019B56CFD00CF13DD /* Supporting Files */, 149 | ); 150 | path = TextInputLimitTestTests; 151 | sourceTree = ""; 152 | }; 153 | 5211B42019B56CFD00CF13DD /* Supporting Files */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 5211B42119B56CFD00CF13DD /* TextInputLimitTestTests-Info.plist */, 157 | 5211B42219B56CFD00CF13DD /* InfoPlist.strings */, 158 | ); 159 | name = "Supporting Files"; 160 | sourceTree = ""; 161 | }; 162 | 87E8CA8208D3AA06C924C50E /* Pods */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | BC5627E7852EFB48ED77C39E /* Pods-TextInputLimitTest.debug.xcconfig */, 166 | 3978E523BB811BE4A3C41A97 /* Pods-TextInputLimitTest.release.xcconfig */, 167 | ); 168 | name = Pods; 169 | sourceTree = ""; 170 | }; 171 | /* End PBXGroup section */ 172 | 173 | /* Begin PBXNativeTarget section */ 174 | 5211B3F619B56CFC00CF13DD /* TextInputLimitTest */ = { 175 | isa = PBXNativeTarget; 176 | buildConfigurationList = 5211B42919B56CFD00CF13DD /* Build configuration list for PBXNativeTarget "TextInputLimitTest" */; 177 | buildPhases = ( 178 | 1691EA9FE7CBC76B0BF13107 /* [CP] Check Pods Manifest.lock */, 179 | 5211B3F319B56CFC00CF13DD /* Sources */, 180 | 5211B3F419B56CFC00CF13DD /* Frameworks */, 181 | 5211B3F519B56CFC00CF13DD /* Resources */, 182 | 1F921C7C9AA15C59588D1693 /* [CP] Embed Pods Frameworks */, 183 | 64AE93AB1936DBA3D731D2C4 /* [CP] Copy Pods Resources */, 184 | ); 185 | buildRules = ( 186 | ); 187 | dependencies = ( 188 | ); 189 | name = TextInputLimitTest; 190 | productName = TextInputLimitTest; 191 | productReference = 5211B3F719B56CFC00CF13DD /* TextInputLimitTest.app */; 192 | productType = "com.apple.product-type.application"; 193 | }; 194 | 5211B41719B56CFD00CF13DD /* TextInputLimitTestTests */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = 5211B42C19B56CFD00CF13DD /* Build configuration list for PBXNativeTarget "TextInputLimitTestTests" */; 197 | buildPhases = ( 198 | 5211B41419B56CFD00CF13DD /* Sources */, 199 | 5211B41519B56CFD00CF13DD /* Frameworks */, 200 | 5211B41619B56CFD00CF13DD /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | 5211B41E19B56CFD00CF13DD /* PBXTargetDependency */, 206 | ); 207 | name = TextInputLimitTestTests; 208 | productName = TextInputLimitTestTests; 209 | productReference = 5211B41819B56CFD00CF13DD /* TextInputLimitTestTests.xctest */; 210 | productType = "com.apple.product-type.bundle.unit-test"; 211 | }; 212 | /* End PBXNativeTarget section */ 213 | 214 | /* Begin PBXProject section */ 215 | 5211B3EF19B56CFC00CF13DD /* Project object */ = { 216 | isa = PBXProject; 217 | attributes = { 218 | LastUpgradeCheck = 0510; 219 | ORGANIZATIONNAME = aqua; 220 | TargetAttributes = { 221 | 5211B41719B56CFD00CF13DD = { 222 | TestTargetID = 5211B3F619B56CFC00CF13DD; 223 | }; 224 | }; 225 | }; 226 | buildConfigurationList = 5211B3F219B56CFC00CF13DD /* Build configuration list for PBXProject "TextInputLimitTest" */; 227 | compatibilityVersion = "Xcode 3.2"; 228 | developmentRegion = English; 229 | hasScannedForEncodings = 0; 230 | knownRegions = ( 231 | en, 232 | Base, 233 | ); 234 | mainGroup = 5211B3EE19B56CFC00CF13DD; 235 | productRefGroup = 5211B3F819B56CFC00CF13DD /* Products */; 236 | projectDirPath = ""; 237 | projectRoot = ""; 238 | targets = ( 239 | 5211B3F619B56CFC00CF13DD /* TextInputLimitTest */, 240 | 5211B41719B56CFD00CF13DD /* TextInputLimitTestTests */, 241 | ); 242 | }; 243 | /* End PBXProject section */ 244 | 245 | /* Begin PBXResourcesBuildPhase section */ 246 | 5211B3F519B56CFC00CF13DD /* Resources */ = { 247 | isa = PBXResourcesBuildPhase; 248 | buildActionMask = 2147483647; 249 | files = ( 250 | 5211B41319B56CFD00CF13DD /* Images.xcassets in Resources */, 251 | 5211B40519B56CFD00CF13DD /* InfoPlist.strings in Resources */, 252 | 5211B40E19B56CFD00CF13DD /* Main.storyboard in Resources */, 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | }; 256 | 5211B41619B56CFD00CF13DD /* Resources */ = { 257 | isa = PBXResourcesBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | 5211B42419B56CFD00CF13DD /* InfoPlist.strings in Resources */, 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | /* End PBXResourcesBuildPhase section */ 265 | 266 | /* Begin PBXShellScriptBuildPhase section */ 267 | 1691EA9FE7CBC76B0BF13107 /* [CP] Check Pods Manifest.lock */ = { 268 | isa = PBXShellScriptBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | ); 272 | inputPaths = ( 273 | ); 274 | name = "[CP] Check Pods Manifest.lock"; 275 | outputPaths = ( 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | shellPath = /bin/sh; 279 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 280 | showEnvVarsInLog = 0; 281 | }; 282 | 1F921C7C9AA15C59588D1693 /* [CP] Embed Pods Frameworks */ = { 283 | isa = PBXShellScriptBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | ); 287 | inputPaths = ( 288 | ); 289 | name = "[CP] Embed Pods Frameworks"; 290 | outputPaths = ( 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | shellPath = /bin/sh; 294 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-TextInputLimitTest/Pods-TextInputLimitTest-frameworks.sh\"\n"; 295 | showEnvVarsInLog = 0; 296 | }; 297 | 64AE93AB1936DBA3D731D2C4 /* [CP] Copy Pods Resources */ = { 298 | isa = PBXShellScriptBuildPhase; 299 | buildActionMask = 2147483647; 300 | files = ( 301 | ); 302 | inputPaths = ( 303 | ); 304 | name = "[CP] Copy Pods Resources"; 305 | outputPaths = ( 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | shellPath = /bin/sh; 309 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-TextInputLimitTest/Pods-TextInputLimitTest-resources.sh\"\n"; 310 | showEnvVarsInLog = 0; 311 | }; 312 | /* End PBXShellScriptBuildPhase section */ 313 | 314 | /* Begin PBXSourcesBuildPhase section */ 315 | 5211B3F319B56CFC00CF13DD /* Sources */ = { 316 | isa = PBXSourcesBuildPhase; 317 | buildActionMask = 2147483647; 318 | files = ( 319 | 5211B41119B56CFD00CF13DD /* ViewController.m in Sources */, 320 | 5211B40B19B56CFD00CF13DD /* AppDelegate.m in Sources */, 321 | 5211B40719B56CFD00CF13DD /* main.m in Sources */, 322 | ); 323 | runOnlyForDeploymentPostprocessing = 0; 324 | }; 325 | 5211B41419B56CFD00CF13DD /* Sources */ = { 326 | isa = PBXSourcesBuildPhase; 327 | buildActionMask = 2147483647; 328 | files = ( 329 | 5211B42619B56CFD00CF13DD /* TextInputLimitTestTests.m in Sources */, 330 | ); 331 | runOnlyForDeploymentPostprocessing = 0; 332 | }; 333 | /* End PBXSourcesBuildPhase section */ 334 | 335 | /* Begin PBXTargetDependency section */ 336 | 5211B41E19B56CFD00CF13DD /* PBXTargetDependency */ = { 337 | isa = PBXTargetDependency; 338 | target = 5211B3F619B56CFC00CF13DD /* TextInputLimitTest */; 339 | targetProxy = 5211B41D19B56CFD00CF13DD /* PBXContainerItemProxy */; 340 | }; 341 | /* End PBXTargetDependency section */ 342 | 343 | /* Begin PBXVariantGroup section */ 344 | 5211B40319B56CFD00CF13DD /* InfoPlist.strings */ = { 345 | isa = PBXVariantGroup; 346 | children = ( 347 | 5211B40419B56CFD00CF13DD /* en */, 348 | ); 349 | name = InfoPlist.strings; 350 | sourceTree = ""; 351 | }; 352 | 5211B40C19B56CFD00CF13DD /* Main.storyboard */ = { 353 | isa = PBXVariantGroup; 354 | children = ( 355 | 5211B40D19B56CFD00CF13DD /* Base */, 356 | ); 357 | name = Main.storyboard; 358 | sourceTree = ""; 359 | }; 360 | 5211B42219B56CFD00CF13DD /* InfoPlist.strings */ = { 361 | isa = PBXVariantGroup; 362 | children = ( 363 | 5211B42319B56CFD00CF13DD /* en */, 364 | ); 365 | name = InfoPlist.strings; 366 | sourceTree = ""; 367 | }; 368 | /* End PBXVariantGroup section */ 369 | 370 | /* Begin XCBuildConfiguration section */ 371 | 5211B42719B56CFD00CF13DD /* Debug */ = { 372 | isa = XCBuildConfiguration; 373 | buildSettings = { 374 | ALWAYS_SEARCH_USER_PATHS = NO; 375 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 376 | CLANG_CXX_LIBRARY = "libc++"; 377 | CLANG_ENABLE_MODULES = YES; 378 | CLANG_ENABLE_OBJC_ARC = YES; 379 | CLANG_WARN_BOOL_CONVERSION = YES; 380 | CLANG_WARN_CONSTANT_CONVERSION = YES; 381 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 382 | CLANG_WARN_EMPTY_BODY = YES; 383 | CLANG_WARN_ENUM_CONVERSION = YES; 384 | CLANG_WARN_INT_CONVERSION = YES; 385 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 386 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 387 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 388 | COPY_PHASE_STRIP = NO; 389 | GCC_C_LANGUAGE_STANDARD = gnu99; 390 | GCC_DYNAMIC_NO_PIC = NO; 391 | GCC_OPTIMIZATION_LEVEL = 0; 392 | GCC_PREPROCESSOR_DEFINITIONS = ( 393 | "DEBUG=1", 394 | "$(inherited)", 395 | ); 396 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 397 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 398 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 399 | GCC_WARN_UNDECLARED_SELECTOR = YES; 400 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 401 | GCC_WARN_UNUSED_FUNCTION = YES; 402 | GCC_WARN_UNUSED_VARIABLE = YES; 403 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 404 | ONLY_ACTIVE_ARCH = YES; 405 | SDKROOT = iphoneos; 406 | }; 407 | name = Debug; 408 | }; 409 | 5211B42819B56CFD00CF13DD /* Release */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | ALWAYS_SEARCH_USER_PATHS = NO; 413 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 414 | CLANG_CXX_LIBRARY = "libc++"; 415 | CLANG_ENABLE_MODULES = YES; 416 | CLANG_ENABLE_OBJC_ARC = YES; 417 | CLANG_WARN_BOOL_CONVERSION = YES; 418 | CLANG_WARN_CONSTANT_CONVERSION = YES; 419 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 420 | CLANG_WARN_EMPTY_BODY = YES; 421 | CLANG_WARN_ENUM_CONVERSION = YES; 422 | CLANG_WARN_INT_CONVERSION = YES; 423 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 424 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 425 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 426 | COPY_PHASE_STRIP = YES; 427 | ENABLE_NS_ASSERTIONS = NO; 428 | GCC_C_LANGUAGE_STANDARD = gnu99; 429 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 430 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 431 | GCC_WARN_UNDECLARED_SELECTOR = YES; 432 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 433 | GCC_WARN_UNUSED_FUNCTION = YES; 434 | GCC_WARN_UNUSED_VARIABLE = YES; 435 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 436 | SDKROOT = iphoneos; 437 | VALIDATE_PRODUCT = YES; 438 | }; 439 | name = Release; 440 | }; 441 | 5211B42A19B56CFD00CF13DD /* Debug */ = { 442 | isa = XCBuildConfiguration; 443 | baseConfigurationReference = BC5627E7852EFB48ED77C39E /* Pods-TextInputLimitTest.debug.xcconfig */; 444 | buildSettings = { 445 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 446 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 447 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 448 | GCC_PREFIX_HEADER = "TextInputLimitTest/TextInputLimitTest-Prefix.pch"; 449 | INFOPLIST_FILE = "TextInputLimitTest/TextInputLimitTest-Info.plist"; 450 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | WRAPPER_EXTENSION = app; 453 | }; 454 | name = Debug; 455 | }; 456 | 5211B42B19B56CFD00CF13DD /* Release */ = { 457 | isa = XCBuildConfiguration; 458 | baseConfigurationReference = 3978E523BB811BE4A3C41A97 /* Pods-TextInputLimitTest.release.xcconfig */; 459 | buildSettings = { 460 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 461 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 462 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 463 | GCC_PREFIX_HEADER = "TextInputLimitTest/TextInputLimitTest-Prefix.pch"; 464 | INFOPLIST_FILE = "TextInputLimitTest/TextInputLimitTest-Info.plist"; 465 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 466 | PRODUCT_NAME = "$(TARGET_NAME)"; 467 | WRAPPER_EXTENSION = app; 468 | }; 469 | name = Release; 470 | }; 471 | 5211B42D19B56CFD00CF13DD /* Debug */ = { 472 | isa = XCBuildConfiguration; 473 | buildSettings = { 474 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TextInputLimitTest.app/TextInputLimitTest"; 475 | FRAMEWORK_SEARCH_PATHS = ( 476 | "$(SDKROOT)/Developer/Library/Frameworks", 477 | "$(inherited)", 478 | "$(DEVELOPER_FRAMEWORKS_DIR)", 479 | ); 480 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 481 | GCC_PREFIX_HEADER = "TextInputLimitTest/TextInputLimitTest-Prefix.pch"; 482 | GCC_PREPROCESSOR_DEFINITIONS = ( 483 | "DEBUG=1", 484 | "$(inherited)", 485 | ); 486 | INFOPLIST_FILE = "TextInputLimitTestTests/TextInputLimitTestTests-Info.plist"; 487 | PRODUCT_NAME = "$(TARGET_NAME)"; 488 | TEST_HOST = "$(BUNDLE_LOADER)"; 489 | WRAPPER_EXTENSION = xctest; 490 | }; 491 | name = Debug; 492 | }; 493 | 5211B42E19B56CFD00CF13DD /* Release */ = { 494 | isa = XCBuildConfiguration; 495 | buildSettings = { 496 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TextInputLimitTest.app/TextInputLimitTest"; 497 | FRAMEWORK_SEARCH_PATHS = ( 498 | "$(SDKROOT)/Developer/Library/Frameworks", 499 | "$(inherited)", 500 | "$(DEVELOPER_FRAMEWORKS_DIR)", 501 | ); 502 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 503 | GCC_PREFIX_HEADER = "TextInputLimitTest/TextInputLimitTest-Prefix.pch"; 504 | INFOPLIST_FILE = "TextInputLimitTestTests/TextInputLimitTestTests-Info.plist"; 505 | PRODUCT_NAME = "$(TARGET_NAME)"; 506 | TEST_HOST = "$(BUNDLE_LOADER)"; 507 | WRAPPER_EXTENSION = xctest; 508 | }; 509 | name = Release; 510 | }; 511 | /* End XCBuildConfiguration section */ 512 | 513 | /* Begin XCConfigurationList section */ 514 | 5211B3F219B56CFC00CF13DD /* Build configuration list for PBXProject "TextInputLimitTest" */ = { 515 | isa = XCConfigurationList; 516 | buildConfigurations = ( 517 | 5211B42719B56CFD00CF13DD /* Debug */, 518 | 5211B42819B56CFD00CF13DD /* Release */, 519 | ); 520 | defaultConfigurationIsVisible = 0; 521 | defaultConfigurationName = Release; 522 | }; 523 | 5211B42919B56CFD00CF13DD /* Build configuration list for PBXNativeTarget "TextInputLimitTest" */ = { 524 | isa = XCConfigurationList; 525 | buildConfigurations = ( 526 | 5211B42A19B56CFD00CF13DD /* Debug */, 527 | 5211B42B19B56CFD00CF13DD /* Release */, 528 | ); 529 | defaultConfigurationIsVisible = 0; 530 | defaultConfigurationName = Release; 531 | }; 532 | 5211B42C19B56CFD00CF13DD /* Build configuration list for PBXNativeTarget "TextInputLimitTestTests" */ = { 533 | isa = XCConfigurationList; 534 | buildConfigurations = ( 535 | 5211B42D19B56CFD00CF13DD /* Debug */, 536 | 5211B42E19B56CFD00CF13DD /* Release */, 537 | ); 538 | defaultConfigurationIsVisible = 0; 539 | defaultConfigurationName = Release; 540 | }; 541 | /* End XCConfigurationList section */ 542 | }; 543 | rootObject = 5211B3EF19B56CFC00CF13DD /* Project object */; 544 | } 545 | --------------------------------------------------------------------------------