iOS:将数据传递到前端SWRevealViewController

时间:2017-06-12 23:04:31

标签: ios objective-c iphone uiviewcontroller

我有以下viewControllers:enter image description here 当我单击“转到灰色”时,它使用SWRevealViewController加载灰色viewController。

这是我的代码:

#import "SWRevealViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (IBAction)gotoGray:(id)sender
{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    SWRevealViewController *swrController = [storyboard instantiateViewControllerWithIdentifier:@"SWRevealViewController"];
    [self presentViewController:swrController animated:YES completion:nil];
}

我的问题是,如何将数据从蓝色视图控制器传递到灰色(前面的SWRevealViewController)?

我真的很感谢你的帮助。

1 个答案:

答案 0 :(得分:0)

您可以使用SWRevealViewController *swrController引用它,您可以使用呈现视图控制器中的信息设置引用数据。

- (IBAction)gotoGray:(id)sender
{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    SWRevealViewController *swrController = [storyboard instantiateViewControllerWithIdentifier:@"SWRevealViewController"];
    swrController.aProperty = self.myInformation;
    swrContoller.anArray = self.arrayOfInfo
    [self presentViewController:swrController animated:YES completion:nil];
}
相关问题