Set text inside UIEdgeInsets? - iphone

I want to insert a text inside the area which one surrounded by UIEdgeInsets in UITextView.
Take a look at the following image
Here '1'(surrounded by border for easier understanding) --> The text which one I want to insert inside the UIEdgeInsets.
Here 'one' is the content inside UITextView.
Can I do it? If it is, give me an example.

Related

How to set position label text in TextFormField in outlineborder?

How to set position label in TextFormField in outlineborder?
i want set text position. Because, label prefer to bottom not center in border
According to the documentation for the label
Text that describes the input field.
When the input field is empty and unfocused, the label is displayed on
top of the input field (i.e., at the same location on the screen where
text may be entered in the input field). When the input field receives
focus (or if the field is non-empty), the label moves above (i.e.,
vertically adjacent to) the input field.
So, basically this is the behavior for the label. If you want something else you have to make it on your own ( using a Stack widget with a TextField and a Text ). But with this solution you have to treat the focus properties as well on your own.
You can use this post as a reference
https://stackoverflow.com/a/58039585/10143503

How can I render placeholders inside text in unity to allow drag n drop on them

I want to render placeholder inside text to allow drag and drop behavior on those placeholders like this image
What I want here is how to render this placeholder inside the text object, or even how to place them if the text length is not determined yet

Word 2010: expand a control to fill its table cell

I have a table cell of fixed large size, and in it is nothing but a Plain Text Content Control, whose default placeholder text "Click here to enter text" takes up only a small portion of that table cell.
The problem is that if the user clicks anywhere in the cell but outside of the control's placeholder text, then starts typing, the entered text will not be part of the control and will not be subject to the control's style or any other control properties.
So - other than adding a lot of dummy characters to the placeholder text, which doesn't seem to be predictable in its word-wrap behavior, is there a way to make the control's placeholder text (or, in general, its click-boundary) fill the entire table cell?
UPDATE actually there were some carriage returns after the control that I was not aware of; after deleting those, clicking anywhere in the cell as long as the x coordinate if the click is greater than or equal to the leftmost x coordinate of the control will edit the control text value as desired. If you click leftward of the control, you will end up editing whatever fixed text exists to the left of the control, i.e. a fixed text label. Still strange. The workaround here was to split cells for all multi line text entry areas, such that the label is on its own cell, and the control is now at the leftmost edge of its cell.
Content controls do not support something like expanding to the surrounding container. They will always use only the space that is required to render their content.
If you want to prevent users from clicking and typing text outside of the control, you could use the following approach:
Put a rich text content control around your table/table row/cell
Put the plain text content control as a nested content control in the table cell (the plain text content control must be non-vanishing for this to work)
Make the outer content control read-only
Now the only thing the user is allowed to edit is the inner plain text content control. The downside of this approach is that your document now contains areas that are locked. This has an impact on usability, first, because, it may not be obvious to the user why certain areas cannot be modified, and second, because a lot of standard actions do no longer work if part of the selection is locked (e.g. Select All > Update ToC).

UITableView cell multiline justification

I have seen questions posted on here asking how to left and right align two lumps of text, but how can I neatly left and right justify an entire paragraph inside a multiline cell? (Such as what MS Word etc would do if you click on the justification button so that left and right sides of the text are always aligned).
You can also create a custom cell with label which IBOutlet to this class that can be downloaded on github OHAttributedLabel, then try the code below
cell.label.textAlignment = UITextAlignmentJustify;
Is this what you're looking for?
yourTextLabel.textAlignment = UITextAlignmentCenter;
Along with the frame size that you want for your text label.

How to display multi-line text without scroll in UIView?

I have multi-line non-HTML text (with newlines). Need to output it inside ScrollView or just UIView.
I can't output it as UITextView: can't find how to resize UITextView to the size of text and/or disable scroll in it.
Should I output text to Label?
Or there's something more proper for that?
Thanks.
Try using a UILabel, then set the lineBreakMode property to UILineBreakModeWordWrap, and the numberOfLines property to zero (unlimited lines).
Depending on the style of text you're using, you might try stripping out the newlines so the result looks better.