Skip to content

UITextViews with name highlight(mention) like Facebook for iOS App

Notifications You must be signed in to change notification settings

soleaf/MintAnnotationView

Repository files navigation

MintAnnotationView

UITextViews with name highlight tag like Facebook

Introduction

Do you want to make UITextView like Facebook reply input? It implements annoate(tag) user and show tag rect. Additional, I maked UITextView for reply list that just show tag rects from annotation tag.

  • Appear tagged user from annotationList(NSArray)
  • Managed annotationList(It able to use write form)
  • Easy customize.

MintAnnotationMemoView

MintAnnotationChatView

(MintAnnotationChatView)

MintAnnotationMemoView

(MintAnnotationChatView)

How to use

Clone or Download and show projct. It's very simple.

MintAnnotationChatView

  1. If you use xib, Put UITextView on view and set class 'MintAnnotationChatView' else make 'MintAnnotationChatView' object and addSubView.
  2. SetDelegate
- (void)textViewDidChange:(UITextView *)textView
{
    // Checking User trying to remove MintAnnotationView's annoatation
    [self.annotationView checkTagDeleting];
    
}

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
    // Checking User trying to edit MintAnnotationView's annoatation
    return [self.annotationView checkingEditingTag:textView andRange:range];
    
}
  1. Add Event anywhere(Ex. UserNameButtons) Make info dictionary include annotation info. And annotation:
NSMutableDictionary *info = [[NSMutableDictionary alloc] init];
[info setObject:@"0" forKey:MintAnnotationInfoID];
[info setObject:@"Mary" forKey:MintAnnotationInfoName];
[info setObject:@"Other user Information" forKey:@"others"];
[self.annotationView annotation:info];
  1. Getting annotation User List. Use it to post server.
self.annotationView.annotationList;
  1. Or Get Annoation tagged string.
[self.annotationView makeStringWithTag];

result

 hello<u id=12>mary</u>!!

MintAnnotationMemoView

  1. If you use xib, Put UITextView on view and set class 'MintAnnotationMemoView' else make 'MintAnnotationMemoView' object and addSubView.
  2. Call setAnnotationWithMemo:
NSString *firstMemo = @"<u uid=0>Mary</u> hi mary!!. I'm <u uid=1>Cloud</u>.";
[self.memo annotationWithMemo:firstMemo];

About

UITextViews with name highlight(mention) like Facebook for iOS App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages