c# - Is there an iOS override for when a view was popped back? -
i have masterdetail application, , navbutton add new item. im able pop view back, need reload table nice done. how can masterviewcontroller know when popped reload?
heres pop code:
navigationcontroller.popviewcontroller(true);
it functions expected, need masterviewcontroller reload table, made method for:
public void reloadtable() { tableview.reloaddata (); }
try this:
public partial class masterviewcontroller : uiviewcontroller { public void reloadtable() { tableview.reloaddata (); } } public partial class detailviewcontroller : uiviewcontroller { public override void viewwilldisappear (bool animated) { var masterviewcontroller = navigationcontroller.viewcontrollers.oftype<masterviewcontroller> ().firstordefault(); if (masterviewcontroller != null) { masterviewcontroller.reloadtable (); } base.viewwilldisappear (animated); } }
you need add using system.linq;
oftype method.
Comments
Post a Comment