I have a question. I have a class which is implementing the DatasourceDelegate
for a UITableView
.
My TableViewController
is segued from a pop-over which i have set onto a UIBarButton
in a toolbar. (this toolbar is part of a UINavigationController
).
My problem now is that i dont how to pass my datasource
object to my UITableviewController
. so the question is. how can i get the instance of the UITableviewController
that has been segued from the toolbar in my navigation controller?
in the prepareForSeque method in the previous viewController you can access segue.destinationViewController. Then cast that into what you need (UITableViewController *)segue.destinationViewController
so you can access custom methods to set the data object or set the data delegate
Something like
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
SomeClasViewController *vc = [segue destinationViewController];
[vc setDataObject:SomeDataObject];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.