I have a UITextField and i want it be able to enter multiple email addresses. I want the functionality as line in MailComposer.
what I actually want is when user clicks a button i want to show address picker to select emails
Is there any predefined pickerView for that?
How can I do that?
One way might be to define a UITextField that is transparent on top of a UIView that can have other views as subviews. When you start typing an address you get textField:shouldChangeCharactersInRange:replacementString: in the UITextFieldDelegate. If the partial string matches then you can create a new UIView for each matching address and dynamically present them as options to be clicked/tapped to accept. You would probably use resizableImageWithCapInsets to create the bubble that the name sits on to allow for variable lengths. This list might change with every character.
If a choice is accepted then you would move the UIView containing the accepted address into the right position in the address line, to the left if there are no previous addresses, or after the last one if there are. Any other addresses shown would be dismissed at that time. Animation might look nice here. Then the frame of the UITextField would be altered so that text entry would take place after the UIView showing accepted addresses. It all looks like a UITextField, but it's not.
Other things to do would be to add a X button to each address allowing them to be removed. You could even parse the text as it is entered, if you have a good email address parser, turning text into bubbles and moving them up to the left with accepted addresses.
Related
I am developing one message application in ios for iPhone .
i have one textview in which i have to write name of persons and on input space in uitextview i have to show the previously entered content in different text with different background .let me explain with image!
can anyone help me how can i achieve this kind of thing in my text view with CROSS MARK and on click of Cross Mark I want to delete that bubble?
so when user inputs the space after write some string in textview then it will convert with following view in green background with cross button..
You want to use some type of token field. Search github. Something like this.
The tableview I am implementing is a kind of phonebook, where I have an entry(name) and below that I am displaying his/her phone numbers. These data make my cell.
An entry(name) can have multiple phone numbers(each phone number displayed in different lines). Against each phone number(in the same line) I have an option to set some status message. How can I implement this.
The way I have gone forward is:
I have created a 2 labels inside a cell. One for displaying the name and the other for displaying the numbers. These numbers are displayed in a multiline way. The problem I am facing is, adding the status message against each phone number(in the same row of each number). For that I may have to add the status as text in between the phone numbers(displayed in a multiline way) in the same label or I have to add another label inside this label. I am a bit confused regarding, how to go about this. Need help.
For multiple UILable in a cell, you can use custom cell.
What you are trying to implement is something like this or this. check it out.
Personnaly, I would add the "To" view as a subview of your UILabel and then set the toView.frame.origin.y to index * label.font.lineHeight.
in my viewDidLoad, there is too much data,
so what should I do so that I can use all of them,
some sort of scroll, but how to code it ?
Picture (you cannot go to the next step if you do not input a picture. Existing or snap a new one)
Name
Age
Gender
Profession
Hobby
Things I like
Things I dislike
Business Address/Home Address (you choose one first and then you can type in the field)
Email Address
Other (this field does not have to match to others for a connection to be made)
Phone number (Automatically it will show the persons phone number)
There are fields, and I can make them, but there is not more space for me :-(
Use a UIScrollView. But you already know that I guess. Read this up Learning the basics of UIScrollView
Alternatively, you may also explore UITableView if your data represents a logical group or set which can be presented as cells/rows on a TableView.
I want to create my own number pad to appear after user focus the textfield, so I have two question about it?
1.I use "Interface Builder to add a textfield in my view and select the "Number Pad" as the default pad for user to input number, so when I click the textfield, the number pad appear automaticlly, how can I stop it appear the number pad? because I want to show my number pad.
2.If I custom a view with number button inside it, how can I detect the event when I click the textfield? and whether after I detect the event I add a subview to show my custom number pad or not?
thanks
If you are creating a custom number pad (I assume this means a view with a grid of buttons), don't bother using a UITextField; there is no easy way to hide the native keyboard and, for all that trouble, there is nothing useful that the text field gives you.
I recommend creating a custom UIControl subclass. You can detect a touch inside the view and show your custom keypad that way. The documentation explains this pretty well.
I have a partial answer but not an ideal one, and I haven't tried this myself. Take a look at the documentation for the UITextFieldDelegate protocol.
You could have your controller set textField.delegate = self, then have it implement textFieldShouldBeginEditing to show your specialized keyboard somehow and then return NO so that it doesn't go into edit mode. When you tell your special keyboard to show itself, pass it a reference to the text field so it knows where to insert characters. The problem is that this probably won't show a cursor and won't let the user move the cursor to insert characters, etc.
So really this a bit ugly, but it may be sufficient. AFAIK there is no good way to do this :(
I am making a table which has a row that looks like the "To:" line in the Apple Mail app. When you add new people to Mail from your address book, their name shows up in a rounded button.
I can create the button and use sizeToFit to make it fit snugly around the text - no problem.
However, once I do that, I can't figure out how wide the button has become. Is there an easy way to just stick a bunch of buttons in a cell and have it wrap as necessary automatically, or do I have to manually calculate the width and if it goes beyond the end of the screen, move to the next row?
Also, how do you get the width of a sizeToFit'ted button? button.frame returns null. Most perplexing.
You might want to take a look at Joe Hewitt's three20 project, a collection of custom UI elements for the iPhone that were used in the development of the Facebook app.
The two classes you would be particularly interested are TTMessageController and TTPickerTextField.
From the project site:
TTMessageController emulates the
message composer in Apple's Mail app.
You can customize it to send any kind
of message you want. Include your own
set of message fields, or use the
standard "To:" and "Subject:".
Recipient names can be autocompleted
from a data source that you provide.
TTPickerTextField is a type-ahead
UITextField. As you type it searches a
data source, and it adds bubbles into
the flow of text when you choose a
type-ahead option. I use this in
TTMessageController for selecting the
names of message recipients.