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.
Asked
Active
Viewed 112 times
-1
-
can you show me your code how you are transiting betweening view controller – Sunil Pandey Jan 18 '13 at 00:53
-
Currently I don't have any code. I am basically finding examples and then building off of those. – user1988925 Jan 18 '13 at 01:48
-
possible duplicate of [Passing Data between View Controllers](http://stackoverflow.com/questions/5210535/passing-data-between-view-controllers) – Jack Humphries Jan 18 '13 at 03:19
2 Answers
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
-
the use of `@synthesize` is not needed anymore. it will be done as default with an underscore prefixed ivar. – vikingosegundo Jan 18 '13 at 03:19