Monotouch: MT.Dialog scroll down?

I have MT.Dialog where I add some log data.

Rows can have different heights.

How can I make sure my MT.Dialog always scrolls down so that the entire last line is always visible?

BUT ... if the user scrolls the list, then he should not scroll at the bottom when adding new lines.

Any suggestions?

Thanks! Mojo

+4
source share
1 answer

Hmm, no longer knowing about your implementation or structure of the root element, I can only assume that its top level is only nested. This is said ....

var lastIndexPath = this.Root.Last()[this.Root.Last().Count-1].IndexPath; this.TableView.ScrollToRow(lastIndexPath, UITableViewScrollPosition.Middle, true); 

... you can just grab the indexPath of the last row in the array, grab its pointer path and scroll the table view down to it programmatically.

FYI, the code to get indexPath has not been verified, but should work fine. Make sure the following is at the top of your class :-)

 using System.Linq; 
+7
source

Source: https://habr.com/ru/post/1388448/


All Articles