Add TagList in UITextField similar to native IOS Message App - iphone

In Native IOS Message App, In Adding contact from Address Book, there is one UITextField (might be) which will show added contacts as TagList. How can we create this? i mean, How to add Taglists in UITextField? A screenshot below may give an idea abou my question.

Here is a couple of ready solutions on cocoa controls
token fields

You can create a custom UIView class and bind delegate ,methods to add a Tag and remove a Tag. Inside this view, each tag can be a UILabel or UIButton, and the UITextField is always pushed to the right, next to the last tag.
The important thing is, there's only 1 text field which will move along (the cursor blinking).
Hope it helps!

Related

Issue using UITextField with long string

So currntly I have multiple UITextFields whose data is automatically inputted for the user when the app launches, mainly gets the location of the user and inputs them into the textfields.
Now, the issue is, when the textfields are filled, the textfields expand in width with respect to how much text is in the body of the UITextFields.
Heres a few pics of what really is going on, I'm also using nib files to create the layout, the left pic is of the application not getting an address inputted into the UITextfield from CLGeocoder coordinates, whereas the right view shows the UITextfield getting address string from the CLGeocoder.
I also notice that when I finish typing in a field, the fields EXPAND after I press return and the keyboard is dismissed.
I'm sure there is probably a setting in the nib file I uncheck or maybe I have to do this programatically? By instantiating the UITextfields programatically i mean.
As Rocky has already said, the problem is with auto-layout option of iOS 6.0. I also ran into this painful thing a while back. Turn off Auto-layout but now you will have to maintain two storyboards, one for iPhone 5 and there other for iPhone 4 and lower. Fun isn't it?
If you still decide to use auto-layout, make sure there are no User Constraints on the UITextFields where the Width is set to "Greater Than or Equal". This will allow the control to expand based on the content. If there are, just delete them.

Why won't UITableView 'Auto-scroll' when editing UITextField (in UITableViewCell)? (iPhone)

I have created a UITableView that is of type UITableViewStyleGrouped. I have then created several different sections with a few rows in each. Within each of these rows I have created a custom UITableViewCell that contains a UITextField. I also have one UITableViewCell that contains a UITextView.
I have also implemented a UIToolbar that appears on top of the UIKeyboard that allows the user to move through the UITextField's by pressing previous or next.
The issue I'm having is two-fold:
I need the UITableView to scroll so that when the next UITextField (or UITextView) becomes the first responder it is visible (even with the keyboard being displayed).
When a UITextField (or UITextView) is selected (without using the previous and next buttons) is should adjust so that the field is visible above the keyboard.
I have looked around at lots of different tutorials however none of them have resolved my issue. Any help you could offer would be hugely appreciated.
ADDITIONAL INFO:
I'm 100% certain that my app used to do all of the above automatically, however I seems to have stopped doing it now and I don't understand why. Is there a reason why this may of happened? Is there some function or something that I may have changed that would destroy this behaviour?
Probably no use to original poster now, but those having an issue like this where it once did work and then stopped...
check you don't have a:
- (void)viewWillAppear:(BOOL)animated
in your UITableViewController subclass!!!
using viewWillAppear in a UITableViewController breaks the "automagic tableView scrolling up when keyboard appears" behaviour.
I only found this by comparing laboriously an old version of a project where it did work with my latest source where it had stopped working.
Check out TaggedLocations sample code from apple. It does the same thing without any extra manipulation.
The key is that your viewcontrollers are following the standard. i.e you are NOT having container viewcontrollers such as UINavigationController within UIViewController.
You have to update tableview Frame yourself programatically...
and i am 100% sure that if you are 100% certain that your app used to do all of the above automatically ...than it is not your app.
Check the docs..here is the link
https://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/ManageTextFieldTextViews/ManageTextFieldTextViews.html#//apple_ref/doc/uid/TP40009542-CH10-SW1
You will have to register for keyboard notifications..and then update your tableview frame.
And for next and previous.. you have to programmatically check which textfield became active..and then set the frame accordingly.

How do I make an editable detail view on the iPhone with a grouped UITableView?

I want to make a grouped TableView similar to the Apple iPhone contacts application.
I need a lot of standard fields which can be edited, but I would only like them editable once the edit button in the navbar is clicked.
This has been bothering me forever that I could not find a good tutorial.
Thanks in advance.
This is not easy. I just built the same thing because there is nothing available from Apple. I ended up creating a single table cell with a UILabel and a UIView on it. The UILabel is for when the cell is in read mode, and the UIView is for editing. The UIView contains a number of UITextFields. These are the individual fields. I also had to implement drawing code to draw the lines between the fields. Then I had to come up with the code to pass in an address object, load it into the fields, format the text for the label, switch in and out of editing mode (with animation), and finally handling saving of changes and canceling. As yet it doesn't handle tapping the address type to select that from a popup list, but I have most of the code in place for the rest.
This could have been done using individual table view cells for each field. But then you can't select the whole thing the way it does in contacts and adding and deleting addresses becomes trickier.

Focus and zoom in on a UITextField when touched?

How in the world does one get the iPhone view to zoom in on a focused UITextField? I need to tap on a text field that I want to edit, and my view should zoom in to the tapped text field and pull up the keyboard (which it already does), similar to how many Internet text fields gain focus on the iPhone. Is this some type of overlay?
I've been looking everywhere for this solution but maybe I've just got the wrong terminology. Thank you in advance.
Could be a duplicate of this StackOverflow question.
In essence, there are a number of ways, but you have to program this effect manually. A textfield is already an overlay. You can either move it, or scroll the containing view.
Please follow the following steps.
Implement the delegate method for all textfield.connect the outlet of textfield in interface builder basically it's setting the delegate property.then in delegate property you can defined the method whatever you want to implement or wanted to do functionality.
Thanks

How can I implement an autoselection textbox like the one for e-mail addresses on the iPhone?

On the iPhone's mail app, you can type in multiple mail addresses...and then to delete one you just tap it, and click Del. How can I implement something similar in my app? I tried to handle the tap on a UITextView, but it looks like the touchesBegan and related delegate methods are not fired for this class and its subclasses :(
Any idea?
I have implemented a view that is identical to what is found in the mail.app. I used a composite view comprised of a custom UIView which houses a couple of other types of views. I used a UITextField for the text entry. As the user completes an address I take the text and place it in a button with a custom background image (to get the bubble around the text look) and move the UITextField to the right (or to the next line as the case may be). When the user taps one of the address "bubbles" it is selected. If they hit the delete key I remove that bubble from the view and re-layout everything. This is a non-trivial view to build with lots of fun edge cases.
Check out Joe Hewitt three20 project, it includes "Better text fields" which can do such thing.
This could be helpful: Link
TITokenFieldView
A control which mimics the To: field in Mail and Messages. Kinda like an NSTokenField.