This is my code, it works when I send a Label value but when I Pass as string it shows null please help me out... Suggest me a way to pass a String to the second view
This is My First vc "AssignmentsDetailsJson.j"
#import <UIKit/UIKit.h>
#import "DocumentsViewController.h"
@interface AssignmentsDetailsJson : <UITabBarControllerDelegate,UITabBarDelegate>
@end
This is the AssignmentsDetailsJson.m file
#import "AssignmentsDetailsJson.h"
@interface AssignmentsDetailsJson ()
@property(strong, nonatomic) DocumentsViewController *controllerB;
@end
@implementation AssignmentsDetailsJson
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
self.controllerB = (DocumentsViewController *) [tabBarController.viewControllers objectAtIndex:1];
self.controllerB.data= @"yooooooooooo!";
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.tabBarController.delegate = self;
}
This is the second view DocumentsViewController.h
#import <UIKit/UIKit.h>
#import "AssignmentsDetailsJson.h"
@interface DocumentsViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *aLabelInControllerB;
@property (nonatomic, strong) NSString *data;
@property(strong, nonatomic) DocumentsViewController *controllerB;
@end
This is the DocumentsViewController.m
#import "DocumentsViewController.h"
@interface DocumentsViewController ()
@end
@implementation DocumentsViewController
@synthesize data;
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"hooo %@",data);
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}