2012-03-30 3 views
4

개별 셀 높이를 높이기 만하면됩니다. 나는 IB와 코드에서 높이를 늘 렸지만 둘 다 작동하지 않는 것 같습니다. Poicell은 내 맞춤형 uitableviewcell 클래스입니다. 당신은 GetHeightForRow 방법을 무시하고 각 행이 원하는 높이를 반환해야Monotouch에서 사용자 지정 UITableViewCell 크기 조정

public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) 
{ 
      var cell = tableView.DequeueReusableCell(kCellIdentifier) as PoiCell; 

      if (null == cell) { 

       cell = new PoiCell(); 

       var views = NSBundle.MainBundle.LoadNib("PoiCell", cell, null); 

       cell = Runtime.GetNSObject(views.ValueAt(0)) as PoiCell; 
      } 
      UIImage imgAmenity = UIImage.FromBundle ("Images/ico-ConservationGarden"); 
      UIImage imgRestrooms = UIImage.FromBundle ("Images/ico-restrooms"); 

      RectangleF rectCell = cell.Frame; 
      rectCell.Height = 50; 

      cell.Frame = rectCell; 
      var imageView = new UIImageView(imgAmenity) 
      { 
       Frame = new Rectangle(10, 24, 20, 20) 
      }; 
      var imageView2 = new UIImageView(imgRestrooms) 
      { 
       Frame = new RectangleF(30, 24, 20, 20) 
      }; 
      cell.ContentView.Add(imageView); 
      cell.ContentView.Add(imageView2); 

      cell.Title = _poiFilterController.Posts[indexPath.Row].Title; 
      cell.Distance = _poiFilterController.Posts[indexPath.Row].Distance; 
      cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton; 

      return cell; 

} 

답변

6

: 다음은 내 코드입니다. 추가

public override float GetHeightForRow(UITableView tableView, NSIndexPath indexPath) 
{ 
    return 50f; 
} 
1

보십시오 : 당신이 셀을 반환 직전에

cell.SetNeedsDisplay(); 

. 나는 이것이 그것이 작동하도록하기 위해해야만한다고 믿습니다.

관련 문제