首页 > 其他 > 详细

mono touch中重置UITableView选中行

时间:2014-02-12 01:24:46      阅读:466      评论:0      收藏:0      [点我收藏+]
/// <summary>
/// 重置UITableView选中行
/// </summary>
/// <param name="rowindex">要选中的行索引.</param>
public void SetTableSelectRow(int rowindex)
{
      NSIndexPath indexPath = NSIndexPath.FromRowSection (rowindex, 0);
      TBCourseView.SelectRow (indexPath, true, UITableViewScrollPosition.None);
}


我们可以在RowSelected事件中处理一些业务判断,比如手动单击UITableView的行和动态设定选中行是否一致:

public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
		{
			//不是重复选择才执行事件
			bool tag = tableView.IndexPathForSelectedRow.Row != indexPath.Row;
			if (currentselect != indexPath.Row && tag && this.OnSelectList != null) {
				currentselect = indexPath.Row; //重新定位选中行标记
				this.OnSelectList (this, new SelectEventArgs (listarr [indexPath.Row, 1], currentselect));
			}
		}

bool tag = tableView.IndexPathForSelectedRow.Row != indexPath.Row;

mono touch中重置UITableView选中行

原文:http://blog.csdn.net/joyhen/article/details/19081217

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!