2014-09-30 5 views
1

저는 Xamarin을 사용하여 트윗으로 채워진 TableView를 표시하는 작은 테스트 iOS 앱을 개발하고 있습니다. 초보자 용 계정을 보유하고 있으므로 이진 파일의 크기가 커지기 때문에 구성 요소를 사용하지 않아도됩니다.Xamarin UITableView가 스크롤되지 않습니다.

나는 TableViewController가 있고 스크롤을 생성하기에 충분한 데이터로 UITableView를 채웠지 만 스크롤하지는 않습니다.

Storyboard에서 Scroll Enabled를 true로 설정하고 내 TableSource 클래스에 표시 할 데이터를 보유하는 List가 있습니다. UITableView의 각 셀 (내가 사용하고있는 셀 스타일은 UITableViewCellStyle.Value1)은 게시 한 트윗 텍스트, 생성 날짜 및 사용자 이미지를 표시합니다.

내 TableSource 클래스는 다음과 같이 구성되어있다 :

public class TableSource : UITableViewSource 
{ 
    List<Tweet> tableItems; 
    public static string cellIdentifier = "TableCell"; 
    public Dictionary<string, UIImage> photoCache; 

    public TableSource (List<Tweet> items) 
    { 
     tableItems = items; 
     photoCache = new Dictionary<string, UIImage>(); 
    } 

    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; 
    } 
} 

당신은 내가 트윗 객체를 보유 목록을 볼 수 있듯이 또한, (트윗 텍스트, 사용자 이름, DateTime 개체 및 사용자 이미지 URL이 있습니다) 다운로드 한 사용자 사진을 보유 할 사전이 있습니다. 세포는 아무런 문제없이 만들어지고 그들이해야하는 것처럼 보입니다.

하지만 UITableView는 스크롤하지 않습니다.

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); 
       }); 
      } 
     } 
    } 
내가 CollectionViews에 비슷한 문제가 건너 온

, 컨트롤 내부의 내용이 스크롤하지만 스크롤 ISN '을 자극하기에 충분 :

트윗을 분석하고 jQuery과의 소스를 생성하는 방법이있다 트리거되지 않습니다.

나는 뭔가를 놓친가요? 콘텐츠를 스크롤하지 않는 이유는 무엇입니까?

EDIT 1

jQuery과 내가로 scrollRectToVisible 방법과 지정된 영역에 스크롤 jQuery과는 프로그래밍 방식으로 내가 스크롤 할 수 있습니다라는 눈에 보이는 프레임 이상 세포를 가지고 않았는지 확인하려면하지만 jQuery과 사용자의 터치 제스처를 무시 .

스크롤을 사용하려면 터치 제스처를 지정해야합니까? 행을 클릭하면 해당 행이 선택되므로 스크롤이 응답하지 않는 이유는 무엇입니까?

편집 2 내가 뭔가를 명확히하는 것을 잊었다

, jQuery과는 TableViewController와 스토리 보드를 통해 생성되었습니다.

답변

2

이것은 iOS 시뮬레이터의 버그 일 가능성이 큽니다. 가끔은 일부 제스처를 감지하지 못하는 경우가 있습니다. 시뮬레이터를 종료하고 다시 시작하십시오.

UITableViewController는 특별한 작업을 수행하지 않고도 테이블을 스크롤하여 처리해야합니다.

+0

처음으로이 버그가 발생했습니다.이 문제는 본질적으로 또는 Titanium SDK에서도 발생하지 않았습니다. 나는 이것이 Xamarin 때문이라고 생각했다. –

관련 문제