-1

I am a noob and need some guidance. I haven't messed with programming in 7 years. In objective-C. How can I save results to a second view controller? Lets say root view controller is a calculator. After I get the result I want to be able to hit a save button and the data will be saved to the second view controller. The second view controller will list the results. I will want to be able to delete them with a swipe of my finger.

vikingosegundo
  • 52,040
  • 14
  • 137
  • 178

2 Answers2

1

Create a property data in the 2nd View controller, and before pushing / displaying the view controller you set that property.

AlexWien
  • 28,470
  • 6
  • 53
  • 83
  • Viking: I do know how to use a search box. I have spent long enough looking and am hoping I can get help this way. – user1988925 Jan 18 '13 at 01:51
  • @user1988925 — and you found nothing? funny, my version of stackoverflow gives me 800+ results: http://stackoverflow.com/search?q=%5Bobjective-c%5D+pass+object+view+controller but sure it is my mistake. – vikingosegundo Jan 18 '13 at 01:57
0

Do bellow steps :

First you import your second view controller header file to first one. firstViewController.h

#import <UIKit/UIKit.h>
#import "secondViewController.h"

In second view controller header create a property secondViewController.h

@property NSString *passingValue;

Create a instance of secondViewController

secondViewController *targetVC ;
targetVC.passingValue = newValue;

Now you `@synthesize passingValue, in secondViewController.m

Now you can get values to secondViewController

- (void)viewDidLoad
{
    NSLog(@"Image Name : %@ ",passingValue);
   [super viewDidLoad];
}
Himesh
  • 458
  • 1
  • 3
  • 15