Formated text/labels in UITextView/UITextField - ios

Hello Im developing chat application. When I'm creating new group conversation, user is selecting in the tableview and I want to display selected contacts in textview above the tableview, exactly like in the Viber app.
But I dont know how to display text with background color in textview, also if u press backspace on the keyboard you don't delete just one letter but whole word. Can anybody please tell me how to do this?
Thank you.

Have a look at RMSTokenView, GCTagList or DWTagList. Seems to be exactly what you are looking for!
They both let you use custom fonts and gradients.

Related

Multiple Keywords in textfield or textView in Swift

I have to show keywords having a cross button in a textfield or textView. I am trying to get data from server that is keyword names that i want to show in a single line horizontally with a cross button on each keyword and can be disappear as soon as we hit on cross button. Any Help would be greatly appreciated. Thanks
What you need is an equivalent of the Cocoa NSTokenField (https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTokenField_Class/).
You should have a look to Cocoa Controls to find one that can suits you (https://www.cocoacontrols.com/search?q=tokenfield).

How to click on a word and have a pop-up window come up in iOS

First off, thank you very much for taking some time to help me out.
I am rather new to iOS development and need some assistance on how to be able to enter text into a UITextField and then be able to tap a word and then have a pop-up screen come up. I am going to have the pop-up screen designate what highlight color the text is and I know how to go about doing that using
#property(nonatomic, retain) UIColor *highlightedTextColor
I am not sure how to make each word register individually and then be able to tap it and have the pop-up come up. Thank you all for any help that you can aid me with.
Have a great day! :)
This is a tough problem, but I think I have a solution that would accomplish what you need functionally, but I don't fully know your design constraints so your mileage may vary.
Create a UICollectionView with a layout that will flow across lines but always align items to the left. You can get a UICollectionViewFlowLayout subclass to do this with not much work. This should be able to be styled to approximate the look of a UITextField to a degree.
Create a hidden UITextField.
When the user goes to enter input, make the hidden textField the first responder. This is just a container for their input.
As the user types, parse the text in the UITextField into word components by splitting the string on the ' ' character. Each word will be represented in the UICollectionView as one cell.
Implement the UICollectionViewDelegate method for cell selection. When the cell is selected, display your color picker pop up, set some color information to recreate the cell with the same color later on.
With this approach you won't have the typical editing tools like tapping words, moving your cursor, etc. You will have deletion, however.

How set up editing in iOS application like contacts app

My designer is giving me something that looks similar to the iPad contacts app. This doesn't seem to be standard, though. I would have thought I would have found more info on this but my searches haven't brought up much, so I apologize if I've missed it. Basically we want to have a green "+" button to add an item, expanding the cell to enter data for that item when tapped (see "add new address" cell in 1st attached image below), then in 2nd image that cell expanded with address fields.
The final question relates to what seems like standard table editing behavior, but I'm not sure how to fit into this context. For the delete icon, getting it to rotate when tapped and the "delete" button to show up in the cell. As I asked earlier, how do I get the delete icon to show up to the side of the cell rather than within it and how do I get it to show up for just certain cells and not all of them? See final screenshot below.
Any help greatly appreciated. Thanks!
Sounds complicated. Why not leverage Apple's ABPersonViewController to display and edit an Address Book contact?

Implement auto-completion on iPad

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.

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