【发布时间】:2017-08-27 06:50:32
【问题描述】:
当我从 UITableViewSource 单击 RowSelected 时,我想打开视图控制器
我在打开 UIViewController 时使用此代码
任何帮助将不胜感激。
谢谢
MainStudUn controller =this.Storyboard.InstantiateViewController("MainStudUn") as MainStudUn;
this.NavigationController.PushViewController(controller, true);
但我在使用 UITableViewSource 中的此代码时遇到问题
class EmployeesTVS : UITableViewSource
{
List<Employee> employees;
public EmployeesTVS(List<Employee> employees)
{
this.employees = employees;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = (EmployeeCell) tableView.DequeueReusableCell("Cell_id", indexPath);
var employee = employees[indexPath.Row];
cell.updatecell(employee);
return cell;
}
public override nint RowsInSection(UITableView tableview, nint section)
{
return employees.Count;
}
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
var SelectName = employees[indexPath.Row];
Globals.AskX = SelectName.Fullname;
Globals.AnswerX = SelectName.Department;
//OpnWerd();
//MainStudUn controller = this.Storyboard.InstantiateViewController("MainStudUn") as MainStudUn;
//this.NavigationController.PushViewController(controller, true);
}
}
【问题讨论】:
标签: c# ios xamarin xamarin.ios