Thursday, 15 May 2014

objective c - iOS: Make json data from one section available in another -


I took a little break from iOS programming for some versions and now I feel a bit wild. What I want to do is very simple. I have some Jason data which is loading in a section of my app which is unavailable in the other. And I can not understand that to get it to work

section 1

  - (zero) addSpringBroadIcon {primeView = [[UIView alloc] initWithFrame :. CGRectMake (0, 0, Self Observation. Boundskies. Withth, Self Video.bound.SizeHigh)]; PrimeShadowView = [[UIView alloc] initWithFrame: CGRectMake (0, 0, self.view.bounds.size.width, self.view.bounds.size.height)]; [PrimeShow Visual Setback Color Color: [UIColor whiteColor]]; [Self.view addSubview: primeShadowView]; [PrimaShadowlook sethead: Yes]; SESpringBoard * board2 = [SESpringBoard initWithTitle: @ "Welcome" item: Item launcherImage: [UIImage imageNamed: @ "navbtn_home.png"]]; [PrimaView Ad Sueview: Board 2]; [Self.view addSubview: PrimeView];  

section 2

  - (zero) fetchedData: (NSData *) responseData {NSMutableArray * items = [NSMutableArray array]; (In NSDictionary * pJson) {[Item addObject: [SEMenuItem initWithTitle: [dict objectForKey: @ "name"] imageName: @ "vitamin_d.jpg" ViewController: self-removable: NO]]; }}  

UPDATE

section 2 (modified)

  - (zero) fetched data :( NSDT *) Response Data {if (Project PlaceData) {NSSTING * JASON = [[NSSTING ALLOCK] INVITED DETACTIVE: RESPANCETTA ENCORDING: NSUTF 8 string encoding]; NSString * aesResponse = [AES 256 DET Wthreading: JSON Key: ASKI]; // NSLog (@ "AES:% @", aesResponse); NSDTA * Jason Response = [AESSpace DataUsputing Encoding: NSUTF 8 String Encoding]; NSDictionary * placeJson = [NSJSNSArilization JSONObjectWithData: jsonResponse option: kNilOptions error: zero]; Page = [[place Jason ObjectFor: @ "page"] intavele]; NSLog (@ "% d", page); If (page> 0) {NSDictionary * pJson = [placeJson objectForKey: @ "data"]; Self.items = [NSMutableArray array]; {Self.items addObject: {SEMENUItem initWithTitle: [dict objectForKey: @ "name"] imageName: [dict objectForKey: @ "image"] ViewController: self-removable: NO]]; }  

Update: My thinking is that data of self.items should be available in section 2, already decrypted in 1,

Actually I want to create * items in the "FetchDataata" available for * Board 2 in the "Add-onboarding Icon" section. I just tried to reverse the order of the squares, but obviously that did not work. Maybe the visual controller is changing the target? I do not know.

I also tried various ways of getting data to load in the addressing board Icon ... None of those functions can get all the data to load me in the Layered Data section (Including item to work with * 2 board), but it spoils that scene.

Any idea (or if you need to clean anything because the way I explained it is a mess) will be appreciated.

Answers based on you said in the comments - It seems that you just work here with a visual controller are doing. Your item array is a local variable, which means that it is only available under the method of your Fetch Data: Method

You should have a variable scanned in the whole class - that is, an example variable The best way to do this in Objective-C is using one.

How do you make the property? Maybe it's at the top of your implementation file.

  @interface MyViewController () @property NSMutableArray * Items; @end @implementation MyViewController // Your other code ...  

Then when you want to access it in the code later, you use your own.

- (zero) fetch data: (NSDT *) response data {self. ITEMS = [NSMUtABE array array];

No comments:

Post a Comment