Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add attachmentView to float #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MLPAutoCompleteTextField/MLPAutoCompleteTextField.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

+ (NSString *) accessibilityLabelForIndexPath:(NSIndexPath *)indexPath;

@property (nonatomic, strong) UIView* attachmentView;

@property (strong, readonly) UITableView *autoCompleteTableView;

// all delegates and datasources should be weak referenced
Expand Down
15 changes: 12 additions & 3 deletions MLPAutoCompleteTextField/MLPAutoCompleteTextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,13 @@ - (void)expandDropDownAutoCompleteTableForNumberOfRows:(NSInteger)numberOfRows
[rootView insertSubview:self.autoCompleteTableView
belowSubview:self];
#else
[self.superview insertSubview:self.autoCompleteTableView
belowSubview:self];
if (self.attachmentView) {
[self.attachmentView addSubview:self.autoCompleteTableView];
[self.attachmentView bringSubviewToFront:self.autoCompleteTableView];
} else {
[self.superview insertSubview:self.autoCompleteTableView
belowSubview:self];
}
#endif
[self.autoCompleteTableView setUserInteractionEnabled:YES];
if(self.showTextFieldDropShadowWhenAutoCompleteTableIsOpen){
Expand Down Expand Up @@ -843,7 +848,11 @@ - (CGRect)autoCompleteTableViewFrameForTextField:(MLPAutoCompleteTextField *)tex
if (CGRectGetWidth(self.autoCompleteTableFrame) > 0){
frame = self.autoCompleteTableFrame;
} else {
frame = textField.frame;
if (self.attachmentView) {
frame = [self.attachmentView convertRect:textField.bounds fromView:textField];
} else {
frame = textField.frame;
}
frame.origin.y += textField.frame.size.height;
}

Expand Down