title: Xamarin UITableView won't scroll
body: <p>I'm using Xamarin to develop a small test iOS app that displays a TableView filled with tweets. I have a Starter Edition account so I'm avoiding the use of Components since those increase the size of my binaries.</p>
  
  <p>I have a TableViewController and filled the UITableView with enough data to generate a scroll but it won't scroll.</p>
  
  <p>I have set Scroll Enabled to true on the Storyboard and my TableSource class has a List that holds the data to be displayed. Each cell (the cell style I'm using is UITableViewCellStyle.Value1) in the UITableView displays the tweet text, who posted it, the creation date and the user image.</p>
  
  <p>My TableSource class is structured like this:</p>
  
  <pre><code>public class TableSource : UITableViewSource
  {
      List&lt;Tweet&gt; tableItems;
      public static string cellIdentifier = "TableCell";
      public Dictionary&lt;string, UIImage&gt; photoCache;
  
      public TableSource (List&lt;Tweet&gt; items)
      {
          tableItems = items;
          photoCache = new Dictionary&lt;string, UIImage&gt; ();
      }
  
      public override int RowsInSection(UITableView tableview, int section){
          return tableItems.Count;
      }
  
      public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath){
          UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
  
          if (cell != null) {
              cell = new UITableViewCell (UITableViewCellStyle.Value1, cellIdentifier);
  
          }
  
          var index = indexPath.Row;
  
          var tweet = tableItems [index];
  
          cell.TextLabel.Text = tweet.TweetText;
          cell.DetailTextLabel.Text = "by " + tweet.UserName + " at " + tweet.CreatedAt.ToShortDateString();
  
          if (!photoCache.ContainsKey(tweet.UserImage)) {
              using (var imgUrl = new NSUrl (tweet.UserImage)) {
                  using (var data = NSData.FromUrl (imgUrl)) {
                      var img = UIImage.LoadFromData (data);
                      cell.ImageView.Image = img;
                      photoCache.Add (tweet.UserImage, img);
                  }
              }
          } else {
              cell.ImageView.Image = photoCache [tweet.UserImage];
          }
          return cell;
      }
  }
  </code></pre>
  
  <p>As you can see I have a List that holds Tweet objects (a tweet has text, user name, a DateTime object and user image url), also I have a Dictionary to hold the users photos that are downloaded. The cells are created with no problem and look as they should.</p>
  
  <p>But the UITableView won't scroll.</p>
  
  <p>The method that parses the tweets and creates the UITableView's source is this:</p>
  
  <pre><code>    private void ReadStreamFromTwitterMentionsResponse(WebResponse response){
          using (Stream responseStream = response.GetResponseStream ()) {
              using (StreamReader sr = new StreamReader (responseStream)) {
                  // read response and parse it
                  string content = sr.ReadToEnd ();
                  var json = JsonObject.Parse (content);
                  var statuses = json ["statuses"];
                  // for each status create a Tweet object and put it in a List
                  foreach (JsonObject status in statuses) {
                      try{
                          var user_name = status ["user"] ["name"];
                          var user_image = status ["user"] ["profile_image_url"];
                          var tweet_text = status ["text"];
                          var tweet_date = status ["created_at"];
                          Console.WriteLine("tweet_date " + tweet_date);
                          DateTime tweet_date_obj = DateTime.ParseExact (tweet_date, "ddd MMM dd HH:mm:ss zzzz yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AdjustToUniversal);
  
                          tweets.Add(new Tweet(tweet_text, user_name, user_image, tweet_date_obj));
                      }catch(Exception ex){
                          Console.WriteLine ("Error " + ex.Message);
                      }
                  }
                  // After finishing filling the List with tweets, tell main thread to
                  // make a TableSource instance and pass the tweets list and to reload its data
                  InvokeOnMainThread (delegate {
                      TableView.Source = new TableSource (tweets);
                      TableView.ReloadData();
                  // The following line returns a Rectangle which height value is greater than the device's height
                  Console.WriteLine("content size " + TableView.ContentSize);
                  });
              }
          }
      }
  </code></pre>
  
  <p>I came across a similar problem on CollectionViews, the content inside the control is enough to provoke a scroll but the scrolling isn't triggered.</p>
  
  <p>Am I missing something? Why isn't scrolling the contents?</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>To make sure the UITableView did have cells beyond the visible frame I called ScrollRectToVisible method and the UITableView scrolled to the specified area, programatically I can scroll but the UITableView is ignoring the user touch gesture.</p>
  
  <p>Do I have to specify a touch gesture to enable the scrolling? When I click on a row it will be selected, so how come only the scroll is not responding?</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>I forgot to clarify something, the UITableView was generated through the Storyboard with a TableViewController.</p>