Formating Text within a UITextView using Swift - ios

I want to add an "About" View into my (swift) iOS App. Currently I have centered a UiTextView into this ViewController. Now I am wondering if it's possible to format text in this TextView like I can for instance in a html website?
Or is it better to use some other component for this?
Thanks

Since it's not supposed to be editable (it's an about page), why not go with a UILabel?
You can use NSAttributedString to get access to more customization options than what you get with NSString.

Related

How to add links in label of default UITableViewCell

I am using default UItableViewCell to display text. Now lable of that cell is set to multiline as
defaultCell.textLabel?.numberOfLines = 0
And I have multiple cells containting multiline text. And I want to add links in that text something like below
This is multiLine Text which will lead you to the StackOverFlow. And you will find something there.
I searched and found solutions like using UITextView instead if UILable etc.
But I want to do it with a UILable. Thanks for your help.
You should use UITextView and set Detection for Links:
textView.dataDetectorTypes = UIDataDetectorTypes.Link
Or if you need labels, then you can use some 3rd party solution like this: https://github.com/TTTAttributedLabel/TTTAttributedLabel
https://github.com/null09264/FRHyperLabel
I think that what you really want in terms of UX is a link being represented by the entire cell. You should simply implement tableView(_:didSelectRowAt:) and send the user to the destination there.

Custom keyboard with emoji (like kimoji)?

I was wondering how the KIMOJI works?
I read everywhere that you can only create custom keyboards which insert text, not custom emoji.
Any ideas?
I actually had been wondering how to create a custom keyboard extension inspired by KIMOJI for stickers and just finished writing a response here: Add Stickers in Custom KeyBoard Extension
The only modification I would suggest is that instead of using UIViews to hold a few buttons, you may want to try holding many stickers in a UICollectionView. The KIMOJI app allows you to scroll horizontally through the stickers/emoji and a UICollectionView would allow you that functionality.
I hope this helps.

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.

Search UITextView for a specific word in iOS app

I have added UITextView to an app and the list is kind of long. What is the easy way of searching a word in this list. I can add a button and textfield to enter and search for a word. I was was wondering maybe there is already built feature for UITextView.
Thanks very much
[TextView.text rangeOfString:]; or something like this.
It sounds like you're asking if there's a search UI built-in for UITextView (like the way the system libraries manage some aspects of the searchDisplayController property on UIViewController). There is not a built-in feature for this.
One convenient option you might consider is creating a 44 pixel tall view with your search text field and button(s) and then set this view as the "inputAccessoryView" on the UITextView object. The system will then manage animating its display above the keyboard, and scrolling the UITextView so the user is not typing underneath this view.

Scrollability without Editability inside a UITextField

I want to use UITextFields for inputting relatively small amounts of text. The text can be longer than the size of the text field, and I want the user to be able to touch/scroll inside the text field in order to be able to read all of it.
This type of semi-scroll-like behavior is available in edit mode, but I don't want the user to be able to edit, just scroll. The keyboard shouldn't come up in other words. (I do allow the user to do editing, but that's in another section of the app.)
I'm suspecting that UITextField wasn't built to do what I'm trying to do and that I should go explore the capabilities of UITextView instead. Since I've already made a fair investment in providing the infrastructure to support UITextField editing (when it's needed, just not in the current circumstances), I'm a bit reluctant to abandon UITextFields altogether.
Does anyone see a way of doing what I want to be able to do?
Howard
y dont u use UITextView instead of textfield with small size
Use a scroll view with the UILabel as the subview of the scroll view?
Alternatively, use a UITextView and set its editable property to NO. If you are worried about the styling of the textview, use the plain style and customized with other UI elements.

Resources