I have a table view with many headers. The cells of every header are hidden. These cells will appear when the user presses the header.
Suppose I have header 3 under header 2 under header 1. when I press on header 1 the cells of that header must appear, and header 2 and 3 must be pushed down and not covered by the cells of 1. I succeeded in pushing the 2 headers, but with no animation. What I want is to animate the appearance of the cells when a section is pressed.
Simply use:
self.tableView.reloadSections(NSIndexSet(index: sender.tag) as IndexSet, with: .fade)
Related
I am trying to implement a matrix of views in appcelerator.
Some thing like the one i have shown above.
When a user clicks on any of the view, the row and column of views containing that view should be highlighted as well.. Can someone please suggest me an approach in appcelerator code?
Where are you stuck? Some code would be helpful. The problem isn't that complicated.
Create the grid (e.g. with a horizontal layout and with to 20%). Then when you click one item set its background color and border color to a value you like and get its id (e.g. id3). Then you know that you have to set id3, id3+5, id3+5+5,..to be selected (for the vertical row).
You can get the horizontal row by using modulo (e.g. id6 -> 6%5=1 -> row 1 [2nd row]). And select all elements inside this row (row 1 = id6 to id10).
So it is not a Appcelerator problem but just a logic problem. Clicking and changing the elements is possible in Titanium
My requirement is to create a table with fixed header and first column, table data will scroll in both horizontal and vertical directions.
for this I have used 3 scrollviews , following gif will make it clear
1st scrollview is the header name row, it is set to horizontal = true (i.e its scroll direction is horizontal)
2nd scrollview is kcname 1st column of the table, it is vertical scroll, both of these have scrollEnabled={false}, as they wont take scroll gesture, they are scroll programmatically using scrollTo
3rd scrollview is body cell table filled with data, this view has 2 scrollviews as parent , one to take horizontal scroll and another to take vertical scroll.
the scroll values of two body scroll views are put in scrollTo of the other two scrollview using refs on onScroll event, scrollEventThrottle value is 16 .
My problem is how to sync these scrollviews scrolls as this clearly shows lag, which is not acceptable
Disable scrollTos animation like this:
this.toolbar.scrollTo({
x: yourXValue,
animated: false,
});
Then there is no lag :)
I am trying to build a screen similar to twitter/instagram profile page where there is a header section and below that scrollable content.
I have a view controller which has a table view. I wanted to include a header view on top of the table cells. So i dragged and dropped a "View" just above my cell and it works fine. Now i have a label inside this header view and i want the label height and UI view height to adjust automaticlly based on the content length of the label. (If the content is a long string, the number of lines of label should automatically increase and the container view(headerview)'s height should increased based on it's content items property.
I tried to set auto layout on the table(top left right and bottom to the container view(headerview). But then the label is shown in single line, truncated at the very right corner. If i remove the bottom constraint from my constraints, the label appear in multiple lines, but the container view(headerview)'s height is not increased, thus producing an overlap of the label on top of the table below that.
I have the number of lines property set to 0 for the label.
Can anyone share some ideas how to do this ? I am using Xcode 7 and swift 2
There are several approaches for what you want to accomplish. If you do not care if the header scrolls with the cells, the easiest way is to do something like this:
----------------
Header
Label
TableView
----------------
You should pin your header Top,Right,Left.
You should pin your tableView Right,Bottom,Left.
You should pin Header.bottom = TableView.top.
You should pin your Label 4 sides to it's superview(Header).
Set Label numberOfLines = 0
If your header has a fixed width, the label will automatically inherit that width, and setting numberOfLines=0 (a.k.a unlimited number of lines) will make your label increase it's height. Because your label is pinned to it's superView by it's 4 sides (and the header has no fixed height), your header must increase it's height to match the label height.
Hope it helps!!
I have made a window in which I will be having two groups/panels and some buttons in between them. I want to code the resizing behavior in a way that when the window expands, the two panels increase their widths while keeping the distance between them constant.
Please see this mockup:
As you see above, I want the 'Local' and 'Server' Panels to resize while keeping the distance in between them same. If I use anchors (Top+Left+Right+Bottom), the left panel will overlap the right one and the right's width one will go out of the window. I want them to share the increased width of the window equally.
As for the buttons in between, I have kept ancors as Top only. By removing Left anchor from button, it automatically places itself in the center of the window when window is expanded, which is just the way I want it to be.
Any ideas how to manage resizing of panels?
Thanks.
Use the TableLayoutPanel control.
First add the TableLayout to the Form and set its Dock() property to Fill.
Next you'll need to setup 3 columns and two rows. Add the two buttons to the middle column with each one is in its own row. Afterwards, setup the column values so they are like this:
Leave the rows at 50% on both.
Now add your two GroupBoxes to the 1st and 3rd columns in the 1st row.
For both GroupBoxes, set Dock() to Fill, and RowSpan() to 2.
For the top Button, turn on only the Bottom Anchor.
For the bottom Button, turn only the Top Anchor.
For the TableLayoutPanel, set Padding() to 5,5,5,5.
Here is what it looked like when I was all done:
Resize the window and observe how the controls behave...
My NSTableView has variable height rows. The rows correctly resize after an edit of a cell has been completed, and during/after resizing the column/table. The Row also correctly resizes while a user is typing into the text cell.
However, the cell itself does NOT resize during editing to match the height of the row. Does anyone have any ideas on this? In this screenshot one end-edit has occurred already (which is why the text area is larger than 1 line) but there is currently enough text in the cell to account for about 5 lines, thus the height of the row is not matching what should be displayed.
Both the textview and the cell have to have their autoresize set if you want them to automatically scale.
It looks like the cells in the Tag Name column are properly set to resize but that either the cell or the textview in the value column has not been. Check the sittings in Interface Builder.