How to implement a UITextView screen for massive text input - ios

I need to implement a screen where the user is able to write an Application Letter for a job position.
The main idea is to have a UITextView where the user writes what he wants, with a character limit, and the current writing area is visible.
I want the all view to scroll up under the top bar, not just to scroll inside the UITexView.
Like this:
I also want to implement a Markdown parser for the final text and a keyboard shortcut for Markdown, any ideas on how to implement that?

In order to implement keyboard shortcut - you have to write your own keyboard in this case, because normally you cannot influence on the keyboards appearance, except of change it to black color.
About markup - you are here on your own again, as you have to look for already made solutions to parse it properly.
As for the UITextView - no problems here, just stick it up to the edge of the screen in interface builder with constraints and then it will be just as you would like it to be when you have UINavigationBar on top.

Related

How to move my chat input bar up on top with keyboard in Xcode?

I create a chat program. I've created my chat sequence using TableView. Now I have a view on the bottom of the page, contains one TextField and a send button. Now if I press on the TextField, the keyboard appears. I need to:
reduce the height of the tableView so that I still can see the most recent chat message, and return it to its former height if the keyboard is hidden.
move the view up to sit on top of the keyboard, and return it to its former position if the keyboard is hidden.
do both of things above with animation.
I'm still newbie in this keyboard + animation area. I only know I will need to implement textFieldDidBeginEditing and textFieldDidEndEditing to do this. But I don't know what code I should implement inside it. This answer provided some, but not the exact answer to my problem (it only moves the floating TextField in the scrollable view of TableView to be within the visible area, not moving a view not related with TableView). Any help or even article will be appreciated. Thanks!

UIViewController with UITableView and TextField storyboard placement

This might be a simple question but using storyboard I can't seem to position my table, a message field and a button correctly. In the picture below, if it's positioned that way, only then do I get to see the text field and button at the bottom of the screen and the table view takes up the rest of the screen. If I drag the text field and button to the bottom and resize the table, the text field and button disappear and the table is cut off. Why is that? Is there a solution to this without doing it programmatically?
Easy solution is to remove all constraints then position them where you want them.
You'll find you get different effect when try to reposition items depending where you drag from for example double tap an item and nudge it with arrow keys or grab the middle to move it resizing via the corners.
But in my opinion it's easier remove all constraints from the view and then set them as you go.
Also you might want to consider using a container view for the table view and have a separate UItableViewController that way you can easily separate out that the tableview logic from the other ViewController. It will help stop things getting a little messy later on as project grows.

How do I have padding at the bottom of my UITextView like in Mail.app so the text isn't scrunched?

In Mail.app, if I go to create a new message and type all the way so the text is at the last line of the UITextView there is still a decent amount of space between the last line of text and the keyboard if you scroll down. But you can't type here. It's just nice padding so you can read it without it being scrunched against the keyboard, and if you select the text, the selection handles don't extend under the keyboard.
My question is, how do I mimic this with a traditional UITextView?
I think you can do this by setting the contentInset property of your UITextView:
myTextView.contentInset = UIEdgeInsetsMake(-4,-8,0,0);
btw... the values above are not specific to your situation. You will want to adjust these to get the inset you are looking for.

Clickable links in UITableViewCell

I'm trying to add clickable text in a UITableViewCell, I tried some different approaches:
I've tried using 3rd party label such as fancyLabel etc, but the problem with those is that they don't support right to left languages (they always start the text from left to right)
I've tried using UIWebView as the text view but when I add a UIWebView to a UITableViewCell and scroll the table fast the text inside the webView is empty and when the scrolling decelerate the text reappears again, so it doesn't look good
I can't use UITextView because it doesn't support custom UIDataDetectionTypes and I need to detect # and # for tweeter links
Any idea on how to approach the issue???
Create a borderless UIButton and style it so it looks like a link (buttons support left / right aligned text as well), and when clicked just launch a web view with the link contents.

UIPopOver, UITextView and automatic resizing

I've got an app where I allow the user to add events to a list. The method I use to do this is via a form that I show the user in a UIPopOver.
The form has the following components (in this order, top to bottom):
Event Description Label (UILabel)
Event Description (UITextField)
Event Details Label (UILabel)
Event Details (UITextView)
Event Time Label (UILabel)
Event Time (UIDatePicker)
Save Event (Custom Button)
Cancel (Custom Button)
I'd prefer not to show a screen shot since it's a sensitive app. :-)
So........
All is well when I first show the UIPopOver. Everything appears as I wish. The overall layout is about 650 pixels tall, which is just tall enough to take up pretty much the whole screen (vertically) when in landscape mode.
When the user tries to interact with the `UIDatePicker`, everything goes swimmingly (well).
When the user taps into the Event Description (`UITextField`) field, the keyboard appears and the `UIPopOver` shrinks so that basically the `UIDatePicker` and buttons are hidden. I consider this OK, since they re-appear when the keyboard is dismissed.
The problem I am having is when the user tries to interact with the `UITextView`:
When the view of the `UIPopOver` has its `backgroundColor` property set to `[UIColor whiteColor]`, the `UITextView` initially appears with a thin black border. I like this.
When the user taps in the `UITextView` to begin editing, the `UIPopOver` resizes to accommodate the keyboard and, during the transition, the black border "shrinks up" and disappears. This is in spite of my shocks and struts being set so that all dimensions/directions are fixed and it is "glued" to the top-left.
Following this, when the user dismisses the keyboard, the border sort of restores itself to its previous position, but it now adds a thick black border on the bottom that completely obscures the label placed between the `UITextView` and the `UIDatePicker`.
When I change the background of the view of the `UIPopOver` to "`ScrollView` Textured Background Color", the border "disappearing trick" is at least less noticeable, but the black border at the bottom (following keyboard dismissal) is still present.
Questions
Has anyone encountered something like this before?
Does anyone think it's just an IB error and that I need to re-build my XIB?
Anybody got any other ideas? Googling for this issue came up fairly empty for me. If you think of better terms and find something, please let me know (gently).
Boy, I'm a stupid stupid!!! It turns out I had forgotten that I placed the UITextView inside of a UIView (inset 1 pixel on all sides) and set the background of the UIView to be black so that I could get a border effect on the UITextView. Once I remembered that, setting the shocks/struts of THAT UIView turned out to be the solution.
Sorry for wasting your time!

Resources