Skip to content

Commit

Permalink
add / remove contacts is now done with directly passing the uiview ob…
Browse files Browse the repository at this point in the history
…jects
  • Loading branch information
Luke47 committed Aug 24, 2015
1 parent 1894b47 commit 30e1a3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Classes/THContactPickerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
@property (nonatomic, assign) NSInteger maxNumberOfLines; // maximum number of lines the view will display before scrolling
@property (nonatomic, strong) UIFont *font;

- (void)addContact:(id)contact withName:(NSString *)name;
- (UIView *)addContact:(id)contact withName:(NSString *)name;
- (void)removeContact:(id)contact;
- (void)removeContactView:(THContactView *)contactView;
- (void)removeAllContacts;
- (BOOL)resignFirstResponder;

Expand Down
8 changes: 6 additions & 2 deletions Classes/THContactPickerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ - (void)setBackgroundColor:(UIColor *)backgroundColor{
[super setBackgroundColor:backgroundColor];
}

- (void)addContact:(id)contact withName:(NSString *)name {
- (UIView *)addContact:(id)contact withName:(NSString *)name {
id contactKey = [NSValue valueWithNonretainedObject:contact];
if ([self.contactKeys containsObject:contactKey]){
NSLog(@"Cannot add the same object twice to ContactPickerView");
return;
return nil;
}

if (self.contactKeys.count == 1 && self.limitToOne){
Expand Down Expand Up @@ -189,6 +189,9 @@ - (void)addContact:(id)contact withName:(NSString *)name {
[self scrollToBottomWithAnimation:YES];
// after scroll animation [self selectTextView] will be called
}];

// Return the bubble
return contactView;
}

- (void)selectTextView {
Expand Down Expand Up @@ -285,6 +288,7 @@ - (void)scrollToBottomWithAnimation:(BOOL)animated {
}
}

// This will be public!
- (void)removeContactView:(THContactView *)contactView {
id contact = [self contactForContactView:contactView];

Expand Down

0 comments on commit 30e1a3f

Please sign in to comment.