Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------
- //yourAppDelegate.h
- @interface yourAppDelegate : UIResponder <UIApplicationDelegate>
- //i assume you want to share a string
- @property (copy, readwrite) NSString *sharedString;
- @end
- ----------------------
- //yourAppDelegate.m
- @synthesize sharedString;
- ...
- -------------------------
- ----------------------
- classA.m(the source where you get the string data from xml)
- //on the top of file import your appDelegate class
- #import "YourAppDelegate.h"
- .
- .
- //navigate to the place(place) you want to share data, i assume you do that in viewDidLoad
- - (void)viewDidLoad
- {
- .
- .
- .
- //your other codes...
- //i assume your parsed string(which you want to share) is an NSString called myString;
- NSLog("Result from Server: %@", myString);
- YourAppDelegate *sharedData = (YourAppDelegate *)([[UIApplication sharedApplication]delegate]);
- sharedData.sharedString= myString;
- }
- -------------------------------------
- ------------------------------------
- //ClassB.m
- //in your classB, again import your AppDelegate,
- .
- .
- //navigate to the method you want to retrieve shared data
- YourAppDelegate *sharedData = (YourAppDelegate *)([[UIApplication sharedApplication]delegate]);
- NSString *myNewString =sharedData.myString;
- .......
- .
- .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement