Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Showing cells at the bottom of a tableView

$
0
0

Hey guys, I'm building sort of a chat app, and I'm trying to add the messages to the bottom of the UITableView, which is almost all of the screen. I have no problem adding the messages to the end of the tableView's source, but I want the cells to be at the bottom of the tableView (i.e - if I have only 1 message, it will be at the bottom of the screen). I have tried several ways, but they all have a problem in some use case. I tried this code:

`public override float GetHeightForRow (UITableView tableView, NSIndexPath indexPath) { ChatCell cell = tableView.DequeueReusableCell (cellIdentifier) as ChatCell;

        if (cell == null) {
            cell = new ChatCell (cellIdentifier);
        }
        float height =  cell.GetCellHeight (tableItems[indexPath.Row].Msg);

        tableContentOffset = tableContentOffset + height;
        PointF pf = new PointF (0f, tableContentOffset - tableView.Bounds.Size.Height);
        tableView.SetContentOffset (pf, true);
        return height;
    }

` But it only works to some extent and has some problems. Any thoughts?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>