jimmysnn_17 Δημοσ. 2 Αυγούστου 2011 Δημοσ. 2 Αυγούστου 2011 Καλημέρα,έχω ένα table view το οποίο πέρνει δεδομένα από αρχείο σερ μορφή json. όταν επιλέγω ένα κελί με πηγαίνε σε άλλο view (detail view). Το ερώτημα μου είναι πως θα περάσω και τα δεδομένα που θέλω να εμφανίζονται στο detail view. (είτε κώδικα είτε τη λογική πως μπορώ να το κάνω) O κωδικας μου: > // // EventViewController.m // Event01 // // Created by Nikolaos Tsamis on 7/14/11. // Copyright 2011 Awapai. All rights reserved. // #import "EventViewController.h" #import "EventsDetailViewController.h" #import "EventTicketsViewController.h" #import "EventInfoViewController.h" #import "JSON.h" #import "SBJsonParser.h" #import "EventModel.h" @class EventModel; @implementation EventViewController @synthesize dummyTable,data; @class SpotlightClass; - (IBAction) segmentAction:(id)sender { UISegmentedControl* segCtl = sender ; if( [segCtl selectedSegmentIndex] == 0 ) { NSLog(@"hi this is first segment"); //[ self.view addSubview: first] ;// to add view use this statement first is the view controller name listOfEvents = Spotlight; //eventdetailController.dataObject = spotlights; } if( [segCtl selectedSegmentIndex] == 1 ) { NSLog(@"hi this is second segment"); listOfEvents = News; //[ self.view addSubview:second] ; } if( [segCtl selectedSegmentIndex] == 2 ) { NSLog(@"hi this is third segment"); // [ self.view addSubview:third] ; listOfEvents = Popular; } NSLog(@"%@",listOfEvents); [dummyTable reloadData]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [listOfEvents count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[uITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } // Set up the cell... NSString *cellValue = [listOfEvents objectAtIndex:indexPath.row]; cell.textLabel.text = cellValue; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //Initialize the detail view controller and display it. EventsDetailViewController *eventdetailController = [[EventsDetailViewController alloc] initWithNibName:@"EventsDetailView" bundle:[NSBundle mainBundle]]; //eventdetailController.dataObject = data; [self.navigationController pushViewController:eventdetailController animated:YES]; [eventdetailController release]; eventdetailController = nil; } - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { [self tableView:tableView didSelectRowAtIndexPath:indexPath]; } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; Spotlight = [[NSMutableArray alloc] init]; News = [[NSMutableArray alloc] init]; Popular = [[NSMutableArray alloc] init]; dummyTable = [[NSMutableArray alloc] init]; dummyTable = [[uITableView alloc] initWithFrame:CGRectMake(0,30,320,400) style:UITableViewStylePlain]; dummyTable.delegate = self; dummyTable.dataSource = self; listOfEvents=Spotlight; [self.view addSubview:dummyTable]; dummyTable.scrollEnabled=YES; [myMent addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged]; myMent.selectedSegmentIndex = 0 ; //Set the title self.navigationItem.title = @"Events"; //Conection with DataBase // Prepare URL request to download data NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.eventora.com/en/mobile/startjson"]]; // Perform request and get JSON back as a NSData object NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; // Get JSON as a NSString from NSData response NSString *json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]; // parse the JSON response into an object data =[json_string JSONValue]; //For Spotlight NSArray *spotlights = (NSArray *) [data valueForKey:@"spotlight"]; NSArray *spotlight_names =(NSArray *) [spotlights valueForKey:@"name"]; [spotlight addObjectsFromArray: spotlight_names]; NSLog(@"dedomena apo spotlights%@",Spotlight); //For News NSArray *news = (NSArray *) [data valueForKey:@"new"]; NSArray *new_names =(NSArray *) [news valueForKey:@"name"]; [News addObjectsFromArray: new_names]; NSLog(@"dedomena apo news %@",News); //For Popular NSArray *popular = (NSArray *) [data valueForKey:@"popular"]; NSArray *popular_names =(NSArray *) [popular valueForKey:@"name"]; [Popular addObjectsFromArray: popular_names]; [dummyTable reloadData]; NSLog(@"dedomena apo popular %@",Popular); } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc. that aren't in use. } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [myMent release]; [spotlight release]; [News release]; [Popular release]; [dummyTable release]; [listOfEvents release]; [super dealloc]; } @end Το json >{ - spotlight: [ - { name: "Thermodynamics 2011" slug: "thermodynamics2011" organizer: "[email protected]" timezone: "2" description: "Thermodynamics is the cornerstone for many scientific and engineering disciplines including physics, chemistry, chemical engineering, petroleum engineering and materials science. It provides the basis for the design and optimization of new sustainable industrial processes and the development of advanced materials and products. The combination of experiments, theory and simulation allows scientists and engineers to study complex systems from the molecular all the way to macroscopic level." startDate: "/Date(1314849600000)/" endDate: "/Date(1315047600000)/" email: "[email protected]" logo: http://eventora.s3.amazonaws.com/thermodynamics2011/thermodynamics2011-simplelogo.png - location: { venue: "Divani Caravel Hotel " region: "Attica" city: "Athens" postalCode: "16121" country: "Greece" address: "Leoforos Vasileos Alexandrou 2" lat: "37.974343749129275" lng: "23.7502086539673" } - paymentWays: [ - { id: 4 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } - { id: 2 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } ] - ticketTypes: [ - { id: 141 name: "Registration after 20 June 2011 - Regular Participant" description: "Registration includes all coffee breaks, 3 lunches, the welcome reception, the conference dinner and all conference material" price: "520.00" fee: "0" available: 1 } - { id: 142 name: "Registration after 20 June 2011 - Junior Participant (PhD student or similar): " description: "Registration includes all coffee breaks, 3 lunches, the welcome reception, the conference dinner and all conference material" price: "410.00" fee: "0" available: 1 } - { id: 143 name: "Accompanied persons (registration at anytime)" description: "For the accompanied persons, registration includes all coffee breaks, 3 lunches, the welcome reception and the conference dinner" price: "250.00" fee: "0" available: 5 } ] } - { name: "12th Eurasia Conference on Chemical Sciences" slug: "12th-eurasia-conference-chemical-sciences" organizer: "[email protected]" timezone: "2" description: null startDate: "/Date(1334552400000)/" endDate: "/Date(1335013200000)/" email: "[email protected]" logo: null - location: { venue: "Chandris Hotel" region: "Ionian Islands" city: "Corfu" postalCode: "49083" country: "49083" address: " Diasia" lat: "39.684895" lng: "19.842415" } - paymentWays: [ - { id: 2 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } ] - ticketTypes: [ - { id: 229 name: "Registration fee" description: "Includes accomodation" price: "500.00" fee: "0" available: 100 } ] } ] - new: [ - { name: "Hisham's cool pool party" slug: "hishams-cool-pool-party" organizer: "[email protected]" timezone: "2" description: null startDate: "/Date(1279429200000)/" endDate: "/Date(1342616400000)/" email: "[email protected]" logo: null - location: { venue: null region: null city: "Santa Clara" postalCode: null country: "CA" address: "123 Atypon Way" lat: "37.97213147309049" lng: "23.72617980642091" } - paymentWays: [ - { id: 427 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } - { id: 428 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } - { id: 429 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } - { id: 430 name: "piraeus" type: "online" displayName: "Credit Card" description: "Pay with Credit Card" merchant: "[email protected]" } ] - ticketTypes: [ - { id: 271 name: "Hisham's tickets" description: "ETickets" price: "100.00" fee: "2.00" available: 10 } ] } - { name: "Συνέδριο για το κοινό μέλλον υπαίθρου & πόλης - "Κάνε τη γεωργία τρόπο ζωής"" slug: "agri" organizer: "[email protected]" timezone: "2" description: "Κάνε τη γεωργία τρόπο ζωής! Συνέδριο για το κοινό μέλλον υπαίθρου & πόλης (27 Σεπτεμβρίου 2011, Αίγλη Ζαππείου). ΔΩΡΕΑΝ Συμμετοχή!" startDate: "/Date(1317100500000)/" endDate: "/Date(1317135600000)/" email: "[email protected]" logo: http://eventora.s3.amazonaws.com/agri/AGRI_LOGO.jpg - location: { venue: "Αίγλη Ζαππείου" region: "Αττική" city: "Αθήνα" postalCode: "105 57" country: "Ελλάδα" address: "Κήπος Ζαππείου" lat: "37.97111654807396" lng: "23.736608235070775" } - paymentWays: [ - { id: 415 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } ] - ticketTypes: [ - { id: 260 name: "Συμμετοχή στο Συνέδριο" description: "Θα ακολουθήσει cocktail" price: "0.00" fee: "0" available: 1 } ] } - { name: "18ο ΠΑΝΕΛΛΗΝΙΟ ΣΥΝΕΔΡΙΟ ΝΕΩΝ ΑΓΡΟΤΩΝ" slug: "neoiagrotes-18" organizer: "[email protected]" timezone: "2" description: null startDate: "/Date(1315544400000)/" endDate: "/Date(1315746000000)/" email: "[email protected]" logo: null - location: { venue: null region: null city: "Χίος" postalCode: null country: null address: " " lat: "38.4096929" lng: "26.0177448" } - paymentWays: [ - { id: 403 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } - { id: 404 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } ] - ticketTypes: [ - { id: 252 name: "Συμμετοχή στο 18ο Πανελλήνιο Συνέδριο Νέων Αγροτών" description: null price: "200.00" fee: "0" available: 10 } ] } - { name: "test110510" slug: "test110510" organizer: "[email protected]" timezone: "-8" description: null startDate: "/Date(1324141200000)/" endDate: "/Date(1324170000000)/" email: "[email protected]" logo: null - location: { venue: null region: "Attica" city: "Athens" postalCode: null country: null address: " " lat: "37.97918" lng: "23.716647" } - paymentWays: [ - { id: 382 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } ] - ticketTypes: [ - { id: 231 name: "free ticket" description: null price: "0.00" fee: "0" available: 10 } ] } - { name: "12th Eurasia Conference on Chemical Sciences" slug: "12th-eurasia-conference-chemical-sciences" organizer: "[email protected]" timezone: "2" description: null startDate: "/Date(1334552400000)/" endDate: "/Date(1335013200000)/" email: "[email protected]" logo: null - location: { venue: "Chandris Hotel" region: "Ionian Islands" city: "Corfu" postalCode: "49083" country: "49083" address: " Diasia" lat: "39.684895" lng: "19.842415" } - paymentWays: [ - { id: 379 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } ] - ticketTypes: [ - { id: 229 name: "Registration fee" description: "Includes accomodation" price: "500.00" fee: "0" available: 100 } ] } - { name: "test payments" slug: "test-payments" organizer: "[email protected]" timezone: "2" description: null startDate: "/Date(1317358800000)/" endDate: "/Date(1317387600000)/" email: "[email protected]" logo: null - location: { venue: null region: "Manawatu-Wanganui" city: "Awapuni" postalCode: null country: null address: " " lat: "-40.3768629" lng: "175.5827033" } - paymentWays: [ - { id: 323 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } - { id: 324 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } - { id: 325 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } - { id: 326 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } - { id: 327 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } - { id: 328 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } ] - ticketTypes: [ - { id: 208 name: "test ticket" description: "test" price: "10.00" fee: "0" available: 10 } - { id: 242 name: "φθηνό" description: null price: "0.90" fee: "0" available: 10 } ] } - { name: "AC Milan VS Real Madrid CF" slug: "milan-vs-real" organizer: "[email protected]" timezone: "1" description: "Five months after leaving, José Mourinho returns to San Siro to face AC Milan aiming to end Real Madrid CF's hoodoo at his old stamping ground – and book his new side's place in the last 16." startDate: "/Date(1320353100000)/" endDate: "/Date(1320359400000)/" email: "[email protected]" logo: http://eventora.s3.amazonaws.com/milan-vs-real/Milan-vs-Real.png - location: { venue: "Stadio Giuseppe Meazza" region: "Lombardy" city: "Milan" postalCode: "20151" country: "Italy" address: "Via dei Piccolomini 5" lat: "45.4784618" lng: "9.1253228" } - paymentWays: [ - { id: 130 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } - { id: 131 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } ] - ticketTypes: [ - { id: 106 name: "Behind The Goals" description: "Full Clear View." price: "45.00" fee: "0" available: 10 } - { id: 107 name: "Seated Category 1" description: "North Stand Lower, Row 10. The Seats Are On The Edge Of The Penalty Area At The Stretford End. Full Clear View." price: "80.00" fee: "0" available: 10 } - { id: 108 name: "Members" description: "For AC Milan legitimate members" price: "0.90" fee: "0" available: 10 } ] } - { name: "Καλυτερη εκδηλωση" slug: "kalyterh-ekdhlwsh" organizer: "[email protected]" timezone: "-1" description: null startDate: "/Date(1288458000000)/" endDate: "/Date(1319727600000)/" email: "[email protected]" logo: null - location: { venue: "test" region: "Αττική" city: "Αγία Παρασκευή" postalCode: "15343" country: "Ελλάς" address: "Κύπρου 33" lat: "38.0164457" lng: "23.8175799" } - paymentWays: [ - { id: 120 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } - { id: 121 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } - { id: 305 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } ] - ticketTypes: [ - { id: 98 name: "Τρελό " description: "Καλό" price: "2.00" fee: "0" available: 3 } - { id: 99 name: "free" description: null price: "0.00" fee: "0" available: 3 } ] } - { name: "Thermodynamics 2011" slug: "thermodynamics2011" organizer: "[email protected]" timezone: "2" description: "Thermodynamics is the cornerstone for many scientific and engineering disciplines including physics, chemistry, chemical engineering, petroleum engineering and materials science. It provides the basis for the design and optimization of new sustainable industrial processes and the development of advanced materials and products. The combination of experiments, theory and simulation allows scientists and engineers to study complex systems from the molecular all the way to macroscopic level." startDate: "/Date(1314849600000)/" endDate: "/Date(1315047600000)/" email: "[email protected]" logo: http://eventora.s3.amazonaws.com/thermodynamics2011/thermodynamics2011-simplelogo.png - location: { venue: "Divani Caravel Hotel " region: "Attica" city: "Athens" postalCode: "16121" country: "Greece" address: "Leoforos Vasileos Alexandrou 2" lat: "37.974343749129275" lng: "23.7502086539673" } - paymentWays: [ - { id: 203 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } - { id: 207 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } ] - ticketTypes: [ - { id: 141 name: "Registration after 20 June 2011 - Regular Participant" description: "Registration includes all coffee breaks, 3 lunches, the welcome reception, the conference dinner and all conference material" price: "520.00" fee: "0" available: 1 } - { id: 142 name: "Registration after 20 June 2011 - Junior Participant (PhD student or similar): " description: "Registration includes all coffee breaks, 3 lunches, the welcome reception, the conference dinner and all conference material" price: "410.00" fee: "0" available: 1 } - { id: 143 name: "Accompanied persons (registration at anytime)" description: "For the accompanied persons, registration includes all coffee breaks, 3 lunches, the welcome reception and the conference dinner" price: "250.00" fee: "0" available: 5 } ] } ] - popular: [ - { name: "Hisham's cool pool party" slug: "hishams-cool-pool-party" organizer: "[email protected]" timezone: "2" description: null startDate: "/Date(1279429200000)/" endDate: "/Date(1342616400000)/" email: "[email protected]" logo: null - location: { venue: null region: null city: "Santa Clara" postalCode: null country: "CA" address: "123 Atypon Way" lat: "37.97213147309049" lng: "23.72617980642091" } - paymentWays: [ - { id: 427 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } - { id: 428 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } - { id: 429 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } - { id: 430 name: "piraeus" type: "online" displayName: "Credit Card" description: "Pay with Credit Card" merchant: "[email protected]" } ] - ticketTypes: [ - { id: 271 name: "Hisham's tickets" description: "ETickets" price: "100.00" fee: "2.00" available: 10 } ] } - { name: "Συνέδριο για το κοινό μέλλον υπαίθρου & πόλης - "Κάνε τη γεωργία τρόπο ζωής"" slug: "agri" organizer: "[email protected]" timezone: "2" description: "Κάνε τη γεωργία τρόπο ζωής! Συνέδριο για το κοινό μέλλον υπαίθρου & πόλης (27 Σεπτεμβρίου 2011, Αίγλη Ζαππείου). ΔΩΡΕΑΝ Συμμετοχή!" startDate: "/Date(1317100500000)/" endDate: "/Date(1317135600000)/" email: "[email protected]" logo: http://eventora.s3.amazonaws.com/agri/AGRI_LOGO.jpg - location: { venue: "Αίγλη Ζαππείου" region: "Αττική" city: "Αθήνα" postalCode: "105 57" country: "Ελλάδα" address: "Κήπος Ζαππείου" lat: "37.97111654807396" lng: "23.736608235070775" } - paymentWays: [ - { id: 415 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } ] - ticketTypes: [ - { id: 260 name: "Συμμετοχή στο Συνέδριο" description: "Θα ακολουθήσει cocktail" price: "0.00" fee: "0" available: 1 } ] } - { name: "18ο ΠΑΝΕΛΛΗΝΙΟ ΣΥΝΕΔΡΙΟ ΝΕΩΝ ΑΓΡΟΤΩΝ" slug: "neoiagrotes-18" organizer: "[email protected]" timezone: "2" description: null startDate: "/Date(1315544400000)/" endDate: "/Date(1315746000000)/" email: "[email protected]" logo: null - location: { venue: null region: null city: "Χίος" postalCode: null country: null address: " " lat: "38.4096929" lng: "26.0177448" } - paymentWays: [ - { id: 403 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } - { id: 404 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } ] - ticketTypes: [ - { id: 252 name: "Συμμετοχή στο 18ο Πανελλήνιο Συνέδριο Νέων Αγροτών" description: null price: "200.00" fee: "0" available: 10 } ] } - { name: "test110510" slug: "test110510" organizer: "[email protected]" timezone: "-8" description: null startDate: "/Date(1324141200000)/" endDate: "/Date(1324170000000)/" email: "[email protected]" logo: null - location: { venue: null region: "Attica" city: "Athens" postalCode: null country: null address: " " lat: "37.97918" lng: "23.716647" } - paymentWays: [ - { id: 382 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } ] - ticketTypes: [ - { id: 231 name: "free ticket" description: null price: "0.00" fee: "0" available: 10 } ] } - { name: "12th Eurasia Conference on Chemical Sciences" slug: "12th-eurasia-conference-chemical-sciences" organizer: "[email protected]" timezone: "2" description: null startDate: "/Date(1334552400000)/" endDate: "/Date(1335013200000)/" email: "[email protected]" logo: null - location: { venue: "Chandris Hotel" region: "Ionian Islands" city: "Corfu" postalCode: "49083" country: "49083" address: " Diasia" lat: "39.684895" lng: "19.842415" } - paymentWays: [ - { id: 379 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } ] - ticketTypes: [ - { id: 229 name: "Registration fee" description: "Includes accomodation" price: "500.00" fee: "0" available: 100 } ] } - { name: "test payments" slug: "test-payments" organizer: "[email protected]" timezone: "2" description: null startDate: "/Date(1317358800000)/" endDate: "/Date(1317387600000)/" email: "[email protected]" logo: null - location: { venue: null region: "Manawatu-Wanganui" city: "Awapuni" postalCode: null country: null address: " " lat: "-40.3768629" lng: "175.5827033" } - paymentWays: [ - { id: 323 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } - { id: 324 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } - { id: 325 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } - { id: 326 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } - { id: 327 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } - { id: 328 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } ] - ticketTypes: [ - { id: 208 name: "test ticket" description: "test" price: "10.00" fee: "0" available: 10 } - { id: 242 name: "φθηνό" description: null price: "0.90" fee: "0" available: 10 } ] } - { name: "AC Milan VS Real Madrid CF" slug: "milan-vs-real" organizer: "[email protected]" timezone: "1" description: "Five months after leaving, José Mourinho returns to San Siro to face AC Milan aiming to end Real Madrid CF's hoodoo at his old stamping ground – and book his new side's place in the last 16." startDate: "/Date(1320353100000)/" endDate: "/Date(1320359400000)/" email: "[email protected]" logo: http://eventora.s3.amazonaws.com/milan-vs-real/Milan-vs-Real.png - location: { venue: "Stadio Giuseppe Meazza" region: "Lombardy" city: "Milan" postalCode: "20151" country: "Italy" address: "Via dei Piccolomini 5" lat: "45.4784618" lng: "9.1253228" } - paymentWays: [ - { id: 130 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } - { id: 131 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } ] - ticketTypes: [ - { id: 106 name: "Behind The Goals" description: "Full Clear View." price: "45.00" fee: "0" available: 10 } - { id: 107 name: "Seated Category 1" description: "North Stand Lower, Row 10. The Seats Are On The Edge Of The Penalty Area At The Stretford End. Full Clear View." price: "80.00" fee: "0" available: 10 } - { id: 108 name: "Members" description: "For AC Milan legitimate members" price: "0.90" fee: "0" available: 10 } ] } - { name: "Καλυτερη εκδηλωση" slug: "kalyterh-ekdhlwsh" organizer: "[email protected]" timezone: "-1" description: null startDate: "/Date(1288458000000)/" endDate: "/Date(1319727600000)/" email: "[email protected]" logo: null - location: { venue: "test" region: "Αττική" city: "Αγία Παρασκευή" postalCode: "15343" country: "Ελλάς" address: "Κύπρου 33" lat: "38.0164457" lng: "23.8175799" } - paymentWays: [ - { id: 120 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } - { id: 121 name: "door" type: "offline" displayName: "At the door" description: "Pay in cash" merchant: "" } - { id: 305 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } ] - ticketTypes: [ - { id: 98 name: "Τρελό " description: "Καλό" price: "2.00" fee: "0" available: 3 } - { id: 99 name: "free" description: null price: "0.00" fee: "0" available: 3 } ] } - { name: "Thermodynamics 2011" slug: "thermodynamics2011" organizer: "[email protected]" timezone: "2" description: "Thermodynamics is the cornerstone for many scientific and engineering disciplines including physics, chemistry, chemical engineering, petroleum engineering and materials science. It provides the basis for the design and optimization of new sustainable industrial processes and the development of advanced materials and products. The combination of experiments, theory and simulation allows scientists and engineers to study complex systems from the molecular all the way to macroscopic level." startDate: "/Date(1314849600000)/" endDate: "/Date(1315047600000)/" email: "[email protected]" logo: http://eventora.s3.amazonaws.com/thermodynamics2011/thermodynamics2011-simplelogo.png - location: { venue: "Divani Caravel Hotel " region: "Attica" city: "Athens" postalCode: "16121" country: "Greece" address: "Leoforos Vasileos Alexandrou 2" lat: "37.974343749129275" lng: "23.7502086539673" } - paymentWays: [ - { id: 203 name: "bankDeposit" type: "offline" displayName: "Bank" description: "Pay with bank transfer" merchant: "" } - { id: 207 name: "paypalAdaptive" type: "online" displayName: "PayPal" description: "Pay with credit card or debit card (PayPal) " merchant: "salo" } ] - ticketTypes: [ - { id: 141 name: "Registration after 20 June 2011 - Regular Participant" description: "Registration includes all coffee breaks, 3 lunches, the welcome reception, the conference dinner and all conference material" price: "520.00" fee: "0" available: 1 } - { id: 142 name: "Registration after 20 June 2011 - Junior Participant (PhD student or similar): " description: "Registration includes all coffee breaks, 3 lunches, the welcome reception, the conference dinner and all conference material" price: "410.00" fee: "0" available: 1 } - { id: 143 name: "Accompanied persons (registration at anytime)" description: "For the accompanied persons, registration includes all coffee breaks, 3 lunches, the welcome reception and the conference dinner" price: "250.00" fee: "0" available: 5 } ] } ] - eventCategories: [ - { name: "conference" transName: "Conferences" } - { name: "music" transName: "Music" } - { name: "seminar " transName: "Seminars" } - { name: "sport" transName: "Sports" } - { name: "theatre" transName: "Theatre" } - { name: "cinema" transName: "Cinema" } - { name: "other" transName: "Other" } ] } θέλω να περνάω όλες τις πληροφορίες (name,slug κλπ) όπως και το location, και το paymentWays. Είμαι αρχάριος στην objective c Ευχαριστώ!!!
jstark Δημοσ. 3 Αυγούστου 2011 Δημοσ. 3 Αυγούστου 2011 Φαντάζομαι εκεί που δημιουργείται ο controller με τη λεπτομερή περιγραφή της επιλογής του χρήστη, μπορείς με διάφορες μεθόδους να περάσεις τις εξτρα πληροφορίες 1. Μπορείς να τις περάσεις στην init συνάρτηση 2. Μπορείς αφού φτιαχτεί να καλέσεις μια συνάρτηση με τα δεδομένα, ώστε να τα λάβει 3. Μπορείς να βάλεις μια αναφορά (weak) στον μπαμπά controller, που αν κατάλαβα έχει ολα τα δεδομένα σου, ωστε να τα ζητάει από αυτόν 4. Μπορείς να στήσεις εναν μηχανισμό observer-observable που ο μπαμπάς controller να τροφοδοτεί όσους (controllers )έχουν κάνει ενα registration με δεδομένα, ή αυτοί να ζητάνε τα δεδομένα (push-pull).
jimmysnn_17 Δημοσ. 5 Αυγούστου 2011 Μέλος Δημοσ. 5 Αυγούστου 2011 Μπορείς να μου δώσεις ένα μικρο παράδειγμα για το πως θα ειναι το Dictionary, που πρέπει να το βάλω, και πως θα περάσω τα δεδομένα για το συγκεκριμένο event (το json έχει πολλά event). Έχω χαθεί εντελώς... Ευχαριστώ
jol1naras Δημοσ. 11 Αυγούστου 2011 Δημοσ. 11 Αυγούστου 2011 Λοιπόν, αφού κάνεις parse τα δεδομένα σου θα τα βάζεις σε αντικείμενα και αυτά με τη σειρά τους σε ένα πίνακα NSArray ή NSMutableArray. Για παράδειγμα, αν έχεις ενα αντικείμενο person, θα έχει ως δεδομένα ονομα, επιθετο κτλπ, αυτό το αντικείμενο λοιπόν θα το βάζεις σε ένα πίνακα. Σε κάθε αντικέιμενο θα βάζεις εσύ κάτι και μετά όταν θα θες να δεις λεπτομερειες από ένα κελί, θα περνάς όλόκληρο το αντικέιμενο. Θα φτιάξεις μια μέθοδο, - (id)initWithPerson:(MyPerson *)pers; και εκεί θα φτιάχνεις το view σου και θα περνάς τα δεδομένα σου, στο viewDidLoad θα πέρνεις τα δεδομένα από το αντικείμενο και θα τα εμφανίζεις. Η initWithPerson θα είναι μέθοδος του νέου view και θα την χρησιμοποιείς στο didSelectRowAtIndexPath; Ελπίζω να βοήθησα.
Προτεινόμενες αναρτήσεις
Αρχειοθετημένο
Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.