on my last cell is a dynamic textview. With bigger contentSize it will be stay on top of the tableview (to see it, while you fill it on keyboard), but if the textview and also the cell is going to be dynamically bigger: [tableview beginupdates] and [tableview endUpdates] will delete my contentSize. And after that it is scrolling it down to bottom of tableview.
Any ideas how to scroll the cell to the top, and create the cell also dynamically without changes on contentSize? maybe I'm thinking on the right way, ideas?
EDIT
Hmm..not any "correct" solution found...the best way for this purpose is to try set any new cells or sections below the textview to get this cell easy to top of the view. After this its easy to use it with beginUpdates and endUpdates. The cursor will be always in the textview, textview will be dynamically bigger also the cell, so the only easy way.
Another option is to set the uitableview as a subview of another scrollview (uitableview himself has one) to scroll up an down in the new scrollview.
Thanks for help.
From my experience, Text views in cells is a very tricky issue. I recommend just using the free Sensible TableView framework, which has text view cells available out of the box.
Related
I have a view controller that I have a static view up at the top with a button and a tableview that is under it. I'm attempting to create custom cells in the tableview, but I cannot add labels or anything to the cell. Storyboard only allows me to add the labels to the original view or the tableview (but not the cell). How can I get around this?
Here's a picture for reference.
Out of pure "trying everything" I got it fixed by manually dragging a cell into the view and not using the auto generated prototype cells by xcode. It looks like it was a bug with xcode where it's auto generated prototype cells would not let any interaction happen. To fix it, I dragged a UITableView cell from the object list into the tableview and I was able to edit that just fine. Hope this helps someone else out.
I'm trying to show a list in a view based NSOutlineView in an NSPopover. When showing the list, it results in something like this:
That's not what I set up in IB:
I'm using a standard non-subclassed NSTableCellView with an NSImageView and an NSTextField as set up for me by IB.
Do you have any idea what could be causing this? I tried reloadData in awakeFromNib. That fixed the first loading, but as I scroll down, the cells are offset again.
Oh well, turns out turning off Autolayout fixed this.
I have a UITableView with some cells, where (for example) the first cell is a header, and the second cell contains a View.
I'd like to toggle the view's visibility when I press the header.
The press thingy is done in didSelectRowAtIndexPath, so can I set the visibility of another row from my UITableView (animated if possible)?
Can't find anything about it on Google..
Thanks!
You can reload the table and toggle the row count.
Sure if you know which cell you want to toggle then you can either get a hold of it with cellForRowAtIndexPath method of UITableView, or if you just want to reload the cell you can use reloadRowsAtIndexPaths:withRowAnimation: here is a ref
It works when I get the contentView of my UITableViewCell, and change the height of that view.
I'm not asking how to do this, it's more in line of "What would you call this?".
I have an NSTableView with several custom cells. I want the table to scroll row by row, meaning that when I move the scrollbar up I want the top row to disappear and when I move it down I want the bottom row also to disappear - I don't want to see half my cell.
How do you call this type of behavior? And can you share some pointers if you've implemented it in a NSTableView?
I'm not exactly sure what this would be called (maybe something like "constrained scrolling"?), but you can do it using NSView's -adjustScroll: method.
The general approach is that you need to make a subclass of NSTableView (if you don't already have one), and override this method to return a NSRect that has its origin.y value constrained to a multiple of your row height.
You probably also want to use NSScrollView's -setVerticalLineScroll: to set the proper amount to scroll when the user clicks the scroll arrows in the vertical scroll bar. You can get the scrollView by calling -enclosingScrollView on your tableView.
I'm using a tableview to display a list of rows and when selected, I want additional controls to appear right below the cell, probably in another view which I will control.
So far, I've managed to get a reference to the selected cell by running through the visiblecells array in the tableview but the frame property always returns a y-coordinate of 0 no matter what scroll position the table is in.
How do I get the position of the cell relative to the window?
I think the best way to deal with table views is in their own terms. That is, if you want to position something new inside the table, put it in a cell. It sounds like you want to subclass UITableViewCell to make your controls, and go through the whole tableView beginUpdates - insertCells - endUpdates process to animate their appearance.