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.
Related
The iOS13 Voice Control feature has a command 'Scroll Down'. This command works for UITableViews but does not seem to work for UIScrollViews with scrollable content.
Is this intended?
Intended or not, is there a way to enable this command to work on a UIScrollView?
Example: a UILabel with a lot of text inside a UIScrollView (constraints are correct - it scrolls and is acknowledged by Voice Over saying 'Page 1 of 3' when active)
This command works for UITableViews but does not seem to work for UIScrollViews with scrollable content.
... only if this content is a huge UILabel content that must be scrollable: add many other elements (sliders, buttons...) and you'll notice that scrolling is enabled.
About that, in the TextKit Best Practices (2018 WWDC video), it's highly recommended to use a UITextView for this purpose:
Is there a way to enable this command to work on a UIScrollView?
Switch the label and your scroll view for a text view instead to make the Voice Control feature work with your specific use case.
Otherwise, it works with many other elements different from UILabel: the scroll view knows its content size and when it has to scroll down/up but the Voice Control feature doesn't recognize the label content as an element to directly interact with inside a scroll view.
I tested with a button and a huge UILabel as you did:
Scroll down that worked to reach the end of my label.
Scroll up that never works.
The label seems to be a kind of empty box that Voice Control ignores in a scroll view: to enable this command in a scroll view, just replace your label by a text view.
Now, if your use case is a single UILabel in a UIScrollView, remove them to display a UITextView instead.
EDIT
Here's the Xcode screenshot to make the UITextView scrolling work with the VoiceControl feature:
... with the results hereunder:
As you can notice, this is just a blank project with a simple text view: iOS recognizes this single element and acts as desired when Scroll down and Scroll up are vocalized.
I currently face a problem when using UIButton. I have the background image designed by others like this:
background image
and I need to place the title for the button right after the white vertical bar in the background image. I tried to set left edge for the content but since I used auto layout, the frame will be different with different screen size(3.5", 4.7"...).
Is there a way to put text in the position related to background I want with auto layout.
Thanks
I personally would split the left side of the background image from the right side. This way you can have two UIButtons next to each other with horizontal space constraint of 0. The right side of the button will have to be placed inside a UIImageView so you can set the image as a property of the view rather that the button's background. You don't have to do this of course, but I prefer this solution as it is easier to manage across different screen sizes.
Here is a visual representation of what I explained above:
Separated Views for Single UIButton
You will then need to route the touch events of both buttons to run the same method or function, just so that both the right side and the left are clickable.
Note: I'm not sure exactly what you had in mind for the highlighting of the button, but this will have to be tested and adapted to get the desired effect.
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.
There are plenty of good grid-of-button controls out there (such as GMGridView) and tutorials around UICollectionView (here).
However, they all seem to focus on imitating the look and feel of the Springboard of Photos app.
I'm looking for something that is more like the main menu you might see in a game. Where if I had one button, I want it to fill my view and be centered. Two buttons I would expect to share the space. Five buttons would have either a button on top (or below) a box of four buttons centered.
Is this sort of dynamic sizing of buttons to fill its parent container and centered of controls into columns easily accomplished with UICollectionView or would it be better to head down the path of something custom where I have a fixed layout support for, say, 1 - 5 button configurations.
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.