UITextview Images is a Category on textview that enables functionality of selecting images in textview.
Download this project and run it to see how easy it is to do that.
platform :ios, '7.0'
pod 'TextviewImages', :git => 'git@github.com:ibhupi/TextviewImages.git'
To add image select option menu in text view just writing these two lines of code is enough. Add following in your View Controller or Class which has outlet or refresh to UITextView.
#import "UITextView+Helper.h"
[self.textView addSelectImageMenuText:@"🌅 📷"];
/**
* Add menu item option to select image.
* When user will tap on this it will ask user to select image source as camera roll or camera.
* @param selectImageMenuText, NSString menu text to show option to select image
*/
- (void)addSelectImageMenuText:(NSString *)selectImageMenuText;
Screen with Long tap to select images
<
Alert to select image source type when there is only one option in menu to select images
Screen when showing images to select
Screen after image is selected and added in text view. And ready to select more images
Sample code to be used in main project to add functionality in text view that can provide option to select images either from Camera Roll & Album or Camera or Both .
- (void)viewDidLoad
{
[super viewDidLoad];
[self.textView addSelectImageMenuText:@"🌅 📷"]; // Yes you can add emojis if you want.
}