I have a view with two UITextView elements in it, each of which is tied to an outlet in the controller. The content for these is coming from a database, and is sometimes short an other times long. I want it to look like it would in html, with <p>content1</p><p>content2</p>, such that the distances from the end of content1 to beginning of content2 is fixed, but content2 gets shifted down the page if content1 is long.
Seems like a very basic requirement but I can't quite figure out how to do it with Interface Builder. Would appreciate any help.
Thanks
Interface builder doesn't support specifying relationships between sibling elements; the Cocoa layout engine does everything relative to the containing view.
I'd recommend creating a single UITextView that contains both paragraphs, inserting a single empty line between them. Keep each paragraph in its own instance variable, though, and when either one is updated, update the display as well, reconstructing the combined text from the two separate paragraphs.
You can use the textview's contentSize property to align them relative to each other. This property always reflects the size of the actual laid out text content.
Related
I want to know if it's possible to make first two lines (Titles and horizontal line in the image below) always show on top and to be unclickable, to make them something like a header of the current listbox.
I think that your approach is not feasible since this is just not how listboxes work (i.e. it's not a spreadsheet where you fix the top rows). Having said that, you might be able to create something that looks like what you're suggesting, by creating two listboxes one below the other, making the top one read-only or non-interactable (or better yet, make the top one a static text label or a text area).
Another thing I'd like to comment about is the structure of your listbox. In terms of UX, it's uncommon for a user to choose two things at the same time. So even if this makes sense in your context, I would advise to split it into two lists, and have them change each other within callbacks.
Is it possible to manage wrapping of text?
I have a long string, longer than a cell, in a paragraph. If it is in form "ABCDEFGHIJKLMN", will be displayed on a line (row) of text. But if it is in "ABC DEFGH IJKLM" form, it is wrapped in two lines. How could be forced to stay on one line?
In a comment the OP clarified
I would like the cell to expand. Anyway, the no wrapping idea comes out of many pages on the Internet saying it wouldn't wrap if no wrapping spaces are used. I don't know if it did, it doesn't do this anymore ...
The iText 7 Table with its default TableRenderer renderer class only supports fixed column widths which can be given by
a fixed table width and a single integer, the number of columns,
a fixed table width and an array of relative column widths, or
an array of absolute column widths.
Thus, what those many pages on the Internet say, does not seem possible.
That been said, the iText 7 architecture allows to set a custom next renderer. Thus, it might be possible to introduce a certain amount of dynamic behavior, in particular some automatic cell resizing, if you implement a table renderer to do so.
Such a custom renderer is likely to run into problems, though, whenever code makes use of the ILargeElement interface Table implements because then the first cells will have to be layout'ed before all cell contents are known.
As far as I can see, UICollectionViewFlowLayout justifies all the lines of a section except the last one. So for example, if there aren't enough items to fill more than 1 line, the result is not justified.
What is the simplest way to either configure or subclass UICollectionViewFlowLayout so that it also justifies the last line of a section?
This is not really possible, unfortunately. It's just not designed that way, unfortunately.
One thing I can think of that might work though is to add an extra item into the data source, returned at the end, which has a cell that is 0 pixels tall and the width of the collection view. That will force the last row to be a single row with just that one item on it and then all rows above it will be justified.
You can do this by subclassing UICollectionViewFlowLayout and overriding layoutAttributesForElementsInRect: and layoutAttributesForItemAtIndexPath: to place all the items in the last line (except the first, which is already correct) where you want them, by changing the frame property of the item's UICollectionViewLayoutAttributes object.
is it possible to add 3 anchors/ links in one cell of GWT celltable
like this
add/delete/copy
these are 3 anchors in one cell with different click handlers for all three of them ..
Thanks
What you are looking for is the CompositeCell.
The idea will be for you to create 3 separate Column (or lightweight HasCell impementations using ActionCell.Delegate for example) objects for your actions and instead of adding them to the table one by one you would add them as part of the CompositeCell.
It may seem a little counterintuitive to add HasCell implementations into an actual cell, but here is an example, from another Stackoverflow question: Does anyone have a working examples of ActionCells working within a CompositeCell?
You can't use Anchors because you can't use any widgets. However, you can render three different <a> elements and then override onBrowserEvent to catch clicks on them.
It may be simpler to use three separate columns and use a ClickableTextCell or something similar for each one.
Is it possible to format only a part of the text of a string?
User searches, and if the search entry is found in the array, it will highlight that particular part of the text only.
TIA.
Not in a standard UILabel, it isn't. You could draw the cell's contents yourself in its -drawRect: method, and draw the string in parts with different attributes. Or you could use one of the several third-party label classes out there that allow this. (For example, Three20's TTStyledLabel.)