我陷入了这个问题。我有一个带有几个视图控制器的故事板。
我需要做的是:我需要将一个数组从FirstViewController
到SecondViewController
(它们不是邻居,也不是通过 segue 连接)传递给 PikerView 将上传数组的位置。之后,应将选取的结果传递给ThirdViewController
. 我有选项卡式应用程序,其中FirstViewController
并SecondViewControllers
连接到选项卡栏视图控制器并通过 Push SegueThirdViewController
连接。SecondViewController
看看我如何尝试将数据形式从 First 传递到 Second
CategoryExpencesViewController.h
#import <UIKit/UIKit.h>
#import "AddCategoryViewController.h"
#import "CategoryPickerViewController.h"
@interface CategoryExpencesViewController : UITableViewController <AddCategoryViewControllerDelegate>
@property(nonatomic, weak) IBOutlet UIBarButtonItem *editButton;
@property(nonatomic, strong) NSMutableArray *categories; //list of category items
@property(nonatomic, strong) NSMutableArray *listOfCategories; //list of category names
CategoryExpencesViewController.m
-(void)updateArray
{
CategoryPickerViewController *controller = [[CategoryPickerViewController alloc]init];
controller.categoryList = [[NSMutableArray alloc]init];
controller.categoryList = listOfCategories;
NSLog(@"%d", [listOfCategories count]);
NSLog(@"%d", [controller.categoryList count]);
}