Clarity: Is there a recommended way to make clr-datagrid take up all available vertical space? - clarity

I am trying to make my take up all vertical space even if there are no rows in the table yet. Is clr-datagrid customizable to do so? It seems like I have to manually override flexbox properties of .datagrid-host and .datagrid-overlay-wrapper in order to make it grow in column direction.
I tried even that but the datagrid don't seem to be growing vertically.

The Clarity datagrid supports any fixed height you want on the datagrid element itself. If the height is too large for the number of displayed rows, the body will expand with empty space. If the height is too small for the number of displayed rows, the body will scroll while the header and footer remain in place.
So in your case, it's as simple as putting height: 100% for the datagrid in your CSS. That's all you need to do. See https://plnkr.co/edit/eZqaic8CS6CFHVcGxAnH?p=preview for a working example.

Related

How to make table view horizontally engage full width

I'm developing an ios application which has a table view. when there is a long value in table cell, table column width size should be increase. I've develop a custom UI for this requirement as following images.
I have change the content size using following code, but it isn't increase
the table body size. you can see it in following image.
self.resultTableView.contentSize.width = self.cellWidth!
You can see the first image its appear as it is and when there is more indexes (columns) and user try to scroll horizontally towards right(as shown in second image), table view will not expand more than the viewport size.
How can I do table view fit to the scroll size?
and finally everything become invisible.
feel free to ask anything if you dont clear enough the quection.
I guess what you have to do is dynamically calculate the desired width and then set the tableView width (for example with a tableView.widtAnchor) to exactly this width.
For a table that scrolls into both dimensions, this could also be helpful:
http://www.brightec.co.uk/ideas/uicollectionview-using-horizontal-and-vertical-scrolling-sticky-rows-and-columns

Layout changing when running the app

I've been trying for days to make one layout of my app to work well, and after days of learning and mistakes I still can't get the table cell layout to look how I want it to be.
This is how my cell .xib looks like in the editor:
http://i.stack.imgur.com/VEr3r.png
And this is how my app looks like when running with suggested constraints:
http://i.stack.imgur.com/wiK1f.png
Why is that? How I can find my mistake and make the layout like it supposed to be, in the view?
Suggested constraints are rarely what I actually wanted to see.
For each label with fixed text, lock the horizontal and vertical positions either to the view or to the next adjacent item.
For imageViews, choose the size you want and lock the height and width.
For labels that you will be dynamically changing the text on, pick a size that will hold the longest string and lock the width. You'll need a vertical position constraint.
You have many options to simplify your layout.
you can use the stakview or create a static UITableView and insert your component inside the cells and enter the Constraint. excellent tutorial http://www.runtimecrash.com/2015/09/17/exploring-uistackview/

AutoLayout dynamic spacing?

I'm pretty new to the whole autolayout design and I'm trying to figure out the best way to make this design compatible on all sizes. I can't seem to find a way to space out each element so the size of each element changes according to the screen size. I know that I can constrain the subviews to the margin but Xcode seems to require a set width and height so the larger screen version ends up looking extremely compressed. (see below) What would be the best way to handle a custom form like this? Basically I need a way to dynamically space out each element.
Each element is on its own. IE text,dividers,icons
If I understood your issue correctly then I think!you need to set leading,top,tailing and bottom space and aspect ratio if necessary for change in height of textfield to the view of which you need to increase or decrease size according to its width.

UITableView Autolayout Positioning

Working in ios8/xcode6/swift
I have a UITableView that will generally have 2-3 items in it. As a result, it does not need to be very large. Although I could just use my own labels or not even a datasourced control at all, I kind of like how UITableView encapsulates everything for me, as well as the nifty lines it has between each item.
That being said, the behavior should be that the number of lines on the screen between each UITableViewCell equals the # of items bound to its datasource, correct?
So if I have 2 items, I should only see 2 rows.
Not sure if this is autolayout-related but when I view my table, the height is such that several extra blank rows get created (like 8 in total). So there are 8 clickable blank rows, when there should only be 2.
I did try removing constraints (once I ever just said use leading margin) so I could align it left, but no matter what I do (or don't do) there seems to be more rows than what I need.
Would you advise dynamically setting the height based on the # of items? I thought it was supposed to do this automatically ..
Thanks!
This ended up doing it:
myTableView.tableFooterView = UIView(frame: CGRectZero)
it works great now! Had nothing to do with autolayout I suspect.

Reposition images within view based on size of text - iOS

I have been recently getting into iOS development, and I'm trying to build something that looks (very roughly) like this: http://falkendev.com/downloads/ios-sample.png
Basically, it's a page that shows simple text -- large header text that may span multiple lines, a separator line, and then smaller descriptive text that may be a variable length. This text does not need to be editable. I'm working using interface builder, but I imagine that what I want done may need to be done programmatically?
Two questions:
-- How do I go about creating these text fields so that they adjust their height based on the content? I'm assuming I would be using a standard "text" field for each, make them not editable, and then programmatically change their height? And then based on the height of the various text fields, I would need to adjust the positioning of the text fields and the divider line between them?
-- How do I go about making the page scrollable? It's possible that the descriptive text will be long and would extend off the edge of the screen. I would want the whole page to be scrollable, not just the descriptive text section. I'm assuming I would place all my elements within a scroll view... but currently when I do that and view it, the view just gets centered (cutting off both the top and the bottom) and I can't scroll it at all.
Thanks for any help!
set the scrollview content size to greater than its actual size to
make it scrollable like this :
scrollView.contentSize = CGSizeMake(YourWidth ,YourHEight ); // Here you can change either of height and width to make it more scrollable in that direction.
You can use UITextView object to have a scrollable text field...
which can scroll to show additional text..just set its editing
property to NO.
Otherwise to dynamically update label height yourself...use
NSString sizeWithFont method

Resources