Implement auto-completion on iPad - ios

Scenario: I have a list of medication (stored somewhere, let's say an NSArray).
There is a UITextField where a user can enter a medication to get more information about it (or whatever).
I want to suggest word completions while he is typing (but that is rather easy).
Where is the best place to show these suggestions? Since it's on the iPad i want it kinda like when you google and you get your suggestions right below the search bar. Is that possible on the iPad? A table that lays over the rest of the screen, placed below the text field? Like a pop up or something? I have never really used an iPad in my life before, therefore I don't know what the iOS way would be..
Edit: Something like this but connected to a textfield and not a button or whatever that thing is:
Edit: Or even better: Something like this but for iPad and not Android:

In my app I used a UITableView for displaying the suggestion.
I added the tableView above my UITextField. When there is no auto complete word found, I hide the tableView.
Please check my autocomplete implemetation.

Check out my control, MLPAutoCompleteTextField for iOS. It is a subclass of UITextField that does autocomplete.
The implementation is similar to what you are looking for in the second screenshot, and very customizable.

Related

Alt Button On Custom Keyboard in xCode

It's the first time I'm creating a keyboard for iOS. I've created the first page with all the buttons but I don't understand how to add the second page.
For example: first page QWERTY, second page 123.
Is here anyone that can explain all the passages and functions/classes that I have to add on my codes and where precisely?
Thanks a lot
Well I haven't built a custom keyboard personally but I would make seperate views for the "pages" of keyboards and just hide away and unhide the view of the keyboard you want to show when the user presses the "alt" button. You could have as many keyboards as you like with this method and have it pre-built in the backround so that it would function very quickly to swap between them. Or animate them as you like really as views are easy to slide around. Actually sounds like a lot of fun as I have often thought about building a keyboard that has alpha-numeric values all in one, which would make filling in details on a login screen much quicker/more convenient.

Putting a UIPopvercontroller in a storyboard uicontainer view

I am writing a small iPad app using Storyboards. On the first screen the user will be presented with about 7 pieces of information to enter.
Several pieces of information are of the form "How important is X to you" with 5 or 6 possible answers, like "Extremely Important" and "Very Important" and so on.
I think the correct design pattern is to have a Button on the storyboard with the value on the button, and the user can change the value by tapping the button, and then I will present a list of values in a UIPopover in a ContainerView.
First, is this the best design pattern.
Second, can someone point me in the right direction for accomplishing this? I just can't seem to get the pieces to work.
I am thinking that maybe I do not need the Container View, just the UIPopover.
Any help would be greatly appreciated!
Bryan
I suggest using a UITableViewController in a popover. The table contains all the valid options in the appropriate order. When the user taps (selects) a row in the table, invoke a delegate method that passes the selected option, sets the button text, and dismisses the popover.

iphone/ipad how to handle lots of input fields?

I'm writing a app that contains quite a bit of input fields for collecting data.
and im wondering what are some good methods to display these kind of input fields, if there are too many to fit on a screen? so something like the add contact screen... where u can scroll down and there are fields there
my initial idea is to put them in a scroll view and then i can scroll through them, is there a tutorial to do this? it seems like the scroll view is more for dynamically displaying data like a text view, and not for static forms like i was describing.
if anyone has any different methods for doing this please post.
UITableview will match perfectly for what you need.
My friend wrote this which is a container view that automatically helps with moving fields out of the way of the keyboard - It will certainly save you some time if you don't want to use a UITableView:
https://github.com/mackross/GTKeyboardHelper
The other way as H2CO3 suggested is to use a UITableView. If it is a UITableViewController, then you get the moving out of the keyboards way automatically. You could build custom table view cells that are styled to have a prompt and a UITextField for input. You can also set the selectionStyle to UITableViewCellSelectionStyleNone to prevent these cells from highlighting when selected.
I think the third way is to do this with a UINavigationController (or a UIPageControl) and build a kind of wizard, where you go through various pages of related data. This might be the neatest way depending on how many fields you have and if you can group data into common sets (e.g. personal information, work information etc)
I had the same problem and found GTKeyboardHelper to be an easy way out.
After drag and drop the framework in your project, include the header file.
Download and open the example project, then drag the "Keyboard Helper" object from the objects section in the xib to the objects section in your project's interface builder.
Drag and drop all your views to be children of the "Keyboard Helper".

UIPickerView alternative for iphone something like combo box?

Are there any alternative controls instead of UIPickerView in XCode. If yes, how do they work? Can anyone suggest an alternative for UIPickerView?
You can see one in action if you download the free One Stop Plus app (women's clothes), drill down on the products until you get a view with Color, Size, etc. Tapping those buttons animates a table out of the button, with choices. Selecting one causes the table to animate back into the button. If you like that post a comment to this answer and I can tell you how to do it.
With iPhone interface, it is not feasible to enable a Combo box like a website. (I believe even Apple Guidelines would say not to do it). What you need to do is the use the UITableView to enable users to pick one option.
One thing you can do is decide whether you want to have the choice in a view shared with other controls. OR if your list if too long you can chose to push in a new view with only the choices on them and when a user selects one, the view will pop back one level.
Here is a screen shot of what i mean (maybe not the best example out there):

TextField used in iOS message app

I want a text field similar to the stock messaging app in the iPhone. Text field should have the same look and should be expandable to allow multi-line editing. Could you please suggest a method to get this in my app?
Thanks.
Use a UITextField.
To get the height of the text field use -sizeWithFont:constrainedToSize:lineBreakMode:.
To have the look of the Apple's text field put an image behind the text field that looks like Apple's text field. See -resizableImageWithCapInsets: to get the image to stretch properly.
Have a look at this :
UIBubbleTableView
EDIT :
The previous link was for the "bubble styled" tableview. If you want the view where you actually type the message, this is the one :
HPGrowingTextView
For other people who are searching for libraries but the ones mentioned here are with many bugs
Here is a library:
SlackTextViewController
A drop-in UIViewController subclass with a growing text input view and other useful messaging features. Meant to be a replacement for UITableViewController & UICollectionViewController.

Resources