Created
August 25, 2013 20:19
-
-
Save ybigus/6336052 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CategoryTableSource: UITableViewSource | |
{ | |
CategoryModel[] _category; | |
UINavigationController _controller; | |
public CategoryTableSource (CategoryModel[] category, UINavigationController controller) | |
{ | |
_category = category; | |
_controller = controller; | |
} | |
public override int RowsInSection (UITableView tableview, int section) | |
{ | |
return _category.Length; | |
} | |
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) | |
{ | |
UITableViewCell cell = tableView.DequeueReusableCell("TableCell"); | |
if (cell == null) { | |
cell = new UITableViewCell (UITableViewCellStyle.Subtitle, "TableCell"); | |
} | |
//show title | |
cell.TextLabel.Text = _category [indexPath.Row].Title; | |
//add accessory | |
cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton; | |
return cell; | |
} | |
public override void RowSelected (UITableView tableView, NSIndexPath indexPath) | |
{ | |
_controller.PushViewController (new NewsController (_category [indexPath.Row].Id), true); | |
tableView.DeselectRow(indexPath,false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment