我在scrollview内部有一组视图控制器,它与scrollview菜单相连。当我从菜单滚动中单击菜单时,它会显示受尊重的viewcontrollers。但最初加载了所有视图控制器。当我点击尊敬的菜单时,我需要重新加载视图控制器。我的代码看起来像
btnArray = @[@"Dashboard", @"Daily Log", @"Labour Timesheet", @"Work Safety", @"Soil", @"Equipment", @"Site Photos", @"Quick Links", @"Printable Forms"];
[self addButtonsInScrollMenu:btnArray];
DashBoardViewController *dashboardVC = [storyBoard instantiateViewControllerWithIdentifier:@"Dashboard"];
DailyReportListViewController *dailyLogVC = [storyBoard instantiateViewControllerWithIdentifier:@"DailyReportListVC"];
TimeSheetListViewController *labourTimesheetVC = [storyBoard instantiateViewControllerWithIdentifier:@"TimeSheetListVC"];
SafetyReportListViewController *workSafetyVC = [storyBoard instantiateViewControllerWithIdentifier:@"SafetyReportListVC"];
DashBoardViewController *soilVC = [storyBoard instantiateViewControllerWithIdentifier:@"Dashboard"];
DashBoardViewController *equipmentVC = [storyBoard instantiateViewControllerWithIdentifier:@"Dashboard"];
DashBoardViewController *sitePhotosVC = [storyBoard instantiateViewControllerWithIdentifier:@"Dashboard"];
DashBoardViewController *quickLinksVC = [storyBoard instantiateViewControllerWithIdentifier:@"Dashboard"];
DashBoardViewController *printableFormsVC = [storyBoard instantiateViewControllerWithIdentifier:@"Dashboard"];
controllerArray = @[dashboardVC, dailyLogVC, labourTimesheetVC, workSafetyVC, soilVC, equipmentVC, sitePhotosVC, quickLinksVC, printableFormsVC];
[self addChildViewControllersOntoContainer:controllerArray];
循环通过controllerArray并调用viewDidLoad