This question is locked. New answers and comments are not allowed.
Hello, I have a weird issue where the suggestion view is not underneath the UITextField for TKAutoCompleteTextView but rather on top of my telerik SideDrawer for some reason. If I type text inside the UITextField I correctly get all of the suggestions but I can only see them when I open up the telerik Side Drawer navigation. Also my view controller inherits from TKAutoCompleteController and my view controller is inside storyboards with nothing on it, I just instantiate the view controller with the storyboard ID though. Here is the code for how I am displaying the TKAutoCompleteTextView:
-(void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidShow:)
name:UIKeyboardDidShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidHide:)
name:UIKeyboardDidHideNotification
object:nil];
self.autocomplete = [[TKAutoCompleteTextView alloc] initWithFrame:CGRectMake(10, 70/*self.view.bounds.origin.y + 25*/, self.view.bounds.size.width - 20, 44)];
self.autocomplete.autoresizingMask =UIViewAutoresizingFlexibleWidth; //| UIViewAutoresizingFlexibleHeight; //UIViewAutoresizingFlexibleWidth;
self.view.backgroundColor = [UIColor colorWithRed:0.937 green:0.937 blue:0.957 alpha:1.00];
self.automaticallyAdjustsScrollViewInsets = NO;
;
self.autocomplete.suggestMode = TKAutoCompleteSuggestModeSuggestAppend;
//self.autocomplete.suggestMode = TKAutoCompleteSuggestModeSuggest;
self.autocomplete.textField.placeholder = @"Enter number";
self.autocomplete.noResultsLabel.text = @"No numbers found";
[self.autocomplete.closeButton setImage:[UIImage imageNamed:@"clear"] forState:UIControlStateNormal];
self.autocomplete.imageView.image = [UIImage imageNamed:@"search"];
self.autocomplete.minimumCharactersToSearch = 1;
self.autocomplete.suggestionViewHeight = self.view.bounds.size.height - self.view.bounds.origin.y + 45;
self.autocomplete.dataSource = self;
//self.autocomplete.center = self.view.center;
[self.autocomplete becomeFirstResponder];
[self.view addSubview:self.autocomplete];
self.view.backgroundColor = [UIColor redColor];
self.autocomplete.backgroundColor = [UIColor greenColor];
self.autocomplete.suggestionView.backgroundColor = [UIColor yellowColor];
//[self.autocomplete addSubview:self.autocomplete.suggestionView];
}
- (void)keyboardDidShow:(NSNotification *) notification
{
CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
int height = MIN(keyboardSize.height,keyboardSize.width);
self.autocomplete.suggestionViewHeight = self.view.bounds.size.height - height - 80;
}
- (void)keyboardDidHide:(NSNotification *) notification
{
self.autocomplete.suggestionViewHeight = self.view.bounds.size.height - 100;
}