UserInteractive Substring in text Label - ios

i am generating a label in a view with label text retrieving from a JSON file.
now there are certain texts(values) retrieved from the JSON file that are user interactive texts (URL/some action) and some are not.
Now i am retrieving the data which are user interactive, setting them as text of a UILabel (which i created dynamically) and setting it in the view (PS. my view controller only has a 2 views inside,one that is default and another in which i am generating the label).
The problem that is arising is that the interactive strings(labels) are set in one line and the ones that are not interactive are set in the next line(as i am creating individial labels for them) even if its a single word.
I want to set the labels (with the texts - interactive/noninteractive) side by side untill there is no space.
Cant wrap my head around it because its a logical problem.
Any help is appreciated

Related

Slack Block Kit Plain-Text input element update text value

Im currently writing a small Slack App in Python using Bolt. Im creating a Modal in response to a slash command which consists of a few Plain-Text input fields and two date pickers.
On one of the text input fields i set dispatch_action to True and define on_character_entered as trigger action as suggested by the API reference.
This way i can handle the event issued when the user enters text into the field.
This does work great and i push a new modal view when a specific keyword is entered. I store the initial's modal view id and hash to access it again when the newly pushed modal view is submitted in order to call views_update() on it (api). The idea is to change parts of the text based on the input of the second modal view.
This seems to work, but does not quite do what i want. The Plain-Text input does not have a field for its value, only for initial_value (which is the only thing i change in the views_update()).
When i return to the first modal view which contains the text input it still displays the original text without reflecting the changes, but from the response of the views_update() call i can see that the initial_value was changed correctly.
I guess that the initial_value only sets the text when the view is created for the first time, but does this mean there is no way to update a text input's text value without recreating the whole view?
Okay i just found the solution here. Basically you need to force slack to rebuild the ui element (in this case the text input field) by giving it a new block id when calling views_update().
Then the initial value gets used to fill the text input thus solving my issue.

Split text if its content exceeds numbers line limit in Swift

Conditions:
UITextView that can contains X lines as maximum:disable scroll. (For example; max lines = 8)
A huge text content. (For example; 25 lines)
Language is English. (Word-wrap is compulsory)
How can I split text if its content exceeds numbers line limit?
I want to split text into array. Following the condition, the text should be split to 4 elements.
Update:
Actually what I want to achieve is like when I have a long text and I have the fix text container size (eg. UITextView) which cannot display all content, then there is a next button to reset container and display the left content. I thought that split string would help but it seems a wrong choice. I am trying what Matt's suggestion and hope the problem will be solved.
Your goal is not a good one. Instead of splitting the text into four arrays of text, it would be better to take advantage of Text Kit and let the layout manager split the text into four text containers (one NSLayoutManager, four NSTextContainers).
This could even be combined with your current use of a text view for display purposes: the four text containers could belong to four text views, and now you have four noneditable nonscrollable text views that automatically distribute the text between them, and you can just switch among those text views.
Here's an example with just two text views:
That's two UITextView objects governed by one NSLayoutManager, so that as the text becomes too long for the first text view it automatically flows into the second text view.
If you really wanted to, I suppose you could do what I just said and then use the layout manager to ask what it did, i.e. to read backwards from the line fragments to the glyphs to the character ranges and find out how it split the text into four text containers; but this seems silly when you consider that the problem is already solved before you even start to do that.

Creating a signup form using a tableview in xcode (like SnapChat)

I am looking to improve my app's signup and login form from standard text boxes to using table rows (or something similar).
I am pretty much inspired by the forms which SnapChat have created, which you can see below...
I'm trying to figure out how they accomplished this, and am thinking it must be a table view with 3 cells (Static?), and the text below is part of the footer of that selection of cells.
How is one able to then capture data into it directly?
Am I right in maybe assuming that each cell is 'custom' with a text field in each one (with placeholder text) with a no-borders style on the text field?
Or has this been achieved via some other way?
Keen to hear your thoughts. Thanks!
You absolutely could do that with a table view. But I don't think this one is. Notice the divider lines start at the far left rather than at 15 pixels in (with the text). The separator lines are also two pixels tall rather than one. So I'd say it's a safe bet that it's just a simple view with 1 pixel tall UIView's for lines.

iOS - How can I hide text inputs without leaving gaps?

I am creating a form in my iOS app in which certain text fields need to be hidden depending on the number that was entered in the previous field. For example if 1 is entered there will be one field, if 4 is entered there will be four fields etc. all the way up to 25. I understand how to hide the buttons depending on number...the problem is when I hide the buttons they still leave the white space because all the fields are set up to position at x and y height. I have tried to put the inputs into a table view because I thought it would allow me to hide each table view cell containing the input and then move the rest up. But XCode gives me an error saying I can't connect IBOutlet to repeating content. Positioning the x and y height in the code won't work either because I need to do this a few times and there would be too many variables.
I have looked for a solution everywhere and haven't been able to find a solution. Does any one know how to hide text fields and make everything else below move up?
You could use autolayout by anchor each textfield to the one above.
Or you could give a tag to each textfield and then iterate with a cycle for till the index of your previous view to setHidden:false to the textfields

Coded UI Test Builder assertions cannot access to DOM

I'm tring to make come UI test using Coded UI. Unfortuanley, It seems to not have access to all DOM elements in browser.
I want to assert value of one text block in form, and by"Add Assertion" the lowest element i can assert is form itself. All tags contained by form was flatten and putted to "id" property in "Add Assertion" widnows, like in the screen below:
Is there a way to assert only one tag in form? In this case i want to assert value "Szczegóły przesyłki: 0--1526203258"
It depends on how your web page is designed. From the image shown it it not clear what field contains the Szczegóły przesyłki: 0--1526203258. However, given (1) the scroll bar and (2) that the Id field is shown and is empty, it is probably the Inner Text field.
Given the number of lines shown above and below the required text you are likely to have selected a larger than necessary part of the screen. When creating an assertion is it often best to move the cross hairs tool around the screen to find the smallest control that contains the required field. Such a UI Control will have no child controls.
I have found that occasionally the Coded UI cross hairs tool loses its place and leaves all four (UP, DOWN, LEFT and RIGHT) arrows grey and inactive, as shown in the screenshot. When this happens try clicking the refresh button located between Add Assertion and the arrows. Some of the arrows should then be shown as black and active. If the DOWN arrow is grey (inactive) and some of the other arrows are black then the properties panel shows a UI Control that has no child components. You should be able to find a UI Control that contains only the required text.

Resources