This is a migrated thread and some comments may be shown as answers.

TKAutoCompleteTextView with storyboards

7 Answers 50 Views
AutoCompleteTextView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ryan
Top achievements
Rank 1
Ryan asked on 30 Jun 2016, 04:52 PM

Hello,

I am trying to use storyboards with TKAutoCompleteTextView. I dragged a UIView into my view controller and set the custom class to TKAutoCompleteTextView and connected it to my header file as an IBOutlet but I cannot get the control to show on the screen. How can I accomplish this?

Here is the code that I have:

-(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.autoresizingMask =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.textField.placeholder = @"Enter number";
    self.autocomplete.noResultsLabel.text = @"No numbers found";
    [self.autocomplete.closeButton setImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal];
    self.autocomplete.imageView.image = [UIImage imageNamed:@"search.png"];
    self.autocomplete.minimumCharactersToSearch = 1;
    self.autocomplete.suggestionViewHeight = self.view.bounds.size.height - self.view.bounds.origin.y + 45;
    self.autocomplete.dataSource = self;
    self.autocomplete.delegate = self;
     
    [self.autocomplete becomeFirstResponder];
     
    [self.view addSubview:self.autocomplete];
    [self.view 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;
}

 

7 Answers, 1 is accepted

Sort by
0
Sophi
Telerik team
answered on 04 Jul 2016, 10:53 AM
Hi Ryan,

May I suggest a bit simpler way to show the TKAutoCompleteTextView - why don't you try adding the view programmatically?
In case there is no particular reason to use storyboards you can just create a new TKAutoCompleteTextView, set the relevant to you settings and add it to the root view. This way you do not need to use storyboards.
-(void)viewDidLoad
{
    [super viewDidLoad];  
    this.autocomplete = [[TKAutoCompleteTextView alloc] initWithFrame:CGRectMake(10, self.view.bounds.origin.y,          self.view.bounds.size.width - 20, 44)];
    /// setup autocomplete
 
    [this.view addSubview:this.autocomplete];
}

If this suggestion does not work for you, write us back any time.

Regards,
Sophi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ryan
Top achievements
Rank 1
answered on 02 Aug 2016, 09:15 PM
I would like the layout to be with storyboards. Developing layout programmatically takes a lot of time when your design may change rapidly and at any instant. Changing it in the storyboard allows for rapid layout changes.
0
Sophi
Telerik team
answered on 04 Aug 2016, 04:07 PM
Hello Ryan,

Our controls are working with C based functions directly for layout. They are not using AutoLayout. Since storyboards are using AutoLayout in the common case you may experience difficulties with storyboard layouts. 

Unfortunately at this moment the TKAutoCompleteTextView needs more polishing to get smoothly usable with Storyboards. I will recommend using it programmatically, you can still make your layouts dynamic by setting frames depending on parent view's frame or other known dimensions. 

Regards,
Sophi
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ryan
Top achievements
Rank 1
answered on 23 Aug 2016, 05:00 PM
Is storyboard support for telerik iOS controls in development?
0
Sophi
Telerik team
answered on 29 Aug 2016, 08:26 AM
Hi Ryan,

The primary use of our controls is intended to be purely with code meaning you can have a storyboard application but our controls should be added programmatically.
We do not have Object Library integration, due to this you cannot drag and drop our controls which makes it more convenient to add them in the view hierarchy through the code.

Regards,
Sophi
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Morgan
Top achievements
Rank 1
answered on 11 Feb 2017, 12:16 AM

Does TKAutoComplete use jQuery? Trying to figure something out, THANKS! 

Mark 

0
Deyan
Telerik team
answered on 13 Feb 2017, 07:34 AM
Hi,

TKAutoCompleteTextViewdoes not use jQuery. In what scenario would you like to use jQuery with TKAutoCompleteTextView?

Regards,
Deyan
Telerik by Progress
Want to build beautiful Android apps as well? Check out UI for Android which enables the same set of scenarios, allowing you to create the same great app experience on both iOS and Android.
Tags
AutoCompleteTextView
Asked by
Ryan
Top achievements
Rank 1
Answers by
Sophi
Telerik team
Ryan
Top achievements
Rank 1
Morgan
Top achievements
Rank 1
Deyan
Telerik team
Share this question
or