-2

I have 1 view controller that holds a property that I want to pass to another view controller

View controller A:

@interface StackTableViewController () <NSFetchedResultsControllerDelegate>

@property (nonatomic, strong) NSFetchedResultsController *fetchedResultController;
@property (nonatomic, strong) Target *current;

@end

@implementation StackTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self.fetchedResultController performFetch:nil];
    NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:0];
    Target *record = [self.fetchedResultController objectAtIndexPath:indexPath];

    self.current = record;
}

Now I want another view controller to be able to get the target property attribute values.. Like it's NSString body attribute.

How this should be done?

should I this view controller property in the other view controller(view controller B)? how do I do this?

thanks

JohnBigs
  • 2,691
  • 3
  • 31
  • 61

2 Answers2

0

I would add the property to view controller B and assign it once you create view controller B:

ViewControllerB *vc = [[ViewControllerB alloc] init];
[vc setProperty:value];
Choppin Broccoli
  • 3,048
  • 2
  • 21
  • 28
-1

You can store the property in NSUserDefaults if you want it fix in the app every time you login, or if you are using its fresh instance every time then you can store it in app delegate and access everywhere in the application.

NewStackUser
  • 657
  • 5
  • 17