Latest 0.1.0
Homepage https://github.com/andrewsardone/UITextView-UIControl
License MIT
Platforms ios
Authors

A UIControl-like API addition to UITextView.

Build Status

Target-Action

UITextField is a UIControl, so it exposes a target-action interface for various events. UITextView+APSUIControlTargetAction.h adds the same interface, allowing arbitrary target-actions to subscribe to the following events:

  • UIControlEventEditingDidBegin
  • UIControlEventEditingChanged
  • UIControlEventEditingDidEnd

For example:

#import "ExampleViewController.h"
#import <UITextView+UIControl/UITextView+APSUIControlTargetAction.h>

@interface ExampleViewController ()

@property (nonatomic, strong) UITextView *textView;

@end

@implementation ExampleViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self.textView addTarget:self action:@selector(textViewDidChange:) forControlEvents:UIControlEventEditingChanged];
}

- (void)textViewDidChange:(UITextView *)sender
{
    NSLog(@"%s, text view text: %@", __PRETTY_FUNCTION__, sender.text);
}

@end

UITextView target-action screencast

Installation

Use CocoaPods and add UITextView+UIControl to your Podfile:

pod 'UITextView+UIControl', '~> 0.1.0'

Or install manually by copying everying from Classes/ into your Xcode project.

Attribution

A big chunk of the work was done during the Back on the Map Objective-c Hackathon.

Latest podspec

{
    "name": "UITextView+UIControl",
    "summary": "A UIControl-like API addition to UITextView.",
    "homepage": "https://github.com/andrewsardone/UITextView-UIControl",
    "source": {
        "git": "https://github.com/andrewsardone/UITextView-UIControl.git",
        "tag": "0.1.0"
    },
    "version": "0.1.0",
    "authors": {
        "Andrew Sardone": "[email protected]"
    },
    "license": "MIT",
    "source_files": "Classes",
    "platforms": {
        "ios": null
    },
    "requires_arc": false
}

Pin It on Pinterest

Share This