mpigio Inviato 17 Novembre 2010 Segnala Condividi Inviato 17 Novembre 2010 Ciao a tutti, sono nuovo di qui, sto creando un applicazione utilizzando una view con tab bar e una table view all'interno che richiama una seconda table view. Ho incluso l'interfaccia della seconda table view nel primo controller e nell'evento didSelectRowAtIndexPath ho inserito nel file FirstViewController.m: DetailsViewController *detailsVC = [[DetailsViewController alloc] initWithStyle:UITableViewStylePlain]; ma in questo punto mi da l'errore indicato in oggetto. Poi per cercare di correggere mi ritrovo anche con error: duplicate interface declaration for class 'FirstViewController' error: redefinition of 'struct FirstViewController' su FirstViewController.h Sapete aiutarmi? Grazie Link al commento Condividi su altri siti Altre opzioni di condivisione...
newsid Inviato 17 Novembre 2010 Segnala Condividi Inviato 17 Novembre 2010 torna alla situazione iniziale (prima che ti desse il secondo errore) poi vai su FirstViewController.h e sopra aggiungi #import "DetailsViewController.h" Link al commento Condividi su altri siti Altre opzioni di condivisione...
mpigio Inviato 17 Novembre 2010 Autore Segnala Condividi Inviato 17 Novembre 2010 L'import è già presente fin dall'inizio. L'unica operazione "strana" che ho fatto è stata quella di duplicare i 3 file (.h .m e xib) e poi personalizzarli per creare la detailsview. Rivedendo tutto il codice non trovo nulla di sbagliato (ma ovviamente l'errore c'è...) Link al commento Condividi su altri siti Altre opzioni di condivisione...
lucagianneschi Inviato 18 Novembre 2010 Segnala Condividi Inviato 18 Novembre 2010 posta il codice, sono anch'io dietro a fare un'applicazione di quel tipo, forse si riesce a capirne qualcosa Leggi di Murphy su App Store Link al commento Condividi su altri siti Altre opzioni di condivisione...
mpigio Inviato 18 Novembre 2010 Autore Segnala Condividi Inviato 18 Novembre 2010 La view principale si chiama AreasViewController mentre quella richiamata SectorsViewController. Di seguito i file delle classi .m In rosso la riga dove mi dice che SectorsViewController è duplicato AreasViewController #import "AreasViewController.h" @interface AreasViewController(Private) - (void)openInfo; @end @implementation AreasViewController @synthesize tableAreas, scrollViewButtons; - (void)viewDidLoad { [super viewDidLoad]; aAreas = [[NSMutableArray alloc] initWithObjects:@"Primo",@"Secondo",@"Terzo",@"Quarto",nil]; NSLog(@"Numero aree: %i",[aAreas count]); } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the sections return [aAreas count]; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *CellIdentifier = [NSString stringWithFormat:@"Cell%i%i",indexPath.section,indexPath.row]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[uITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell... cell.textLabel.text = [aAreas objectAtIndex:indexPath.row]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [color=Red]SectorsViewController *sectorsVC = [[sectorsViewController alloc] initWithStyle:UITableViewStylePlain];[/color] sectorsVC.cat_name = [aAreas objectAtIndex:indexPath.row]; sectorsVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:sectorsVC animated:YES]; [self dismissModalViewControllerAnimated:YES]; // da mettere nel btn dell'altra view x chiudere [sectorsVC release]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (void)viewDidUnload { } - (void)dealloc { [aAreas release]; [super dealloc]; } @end SectorsViewController #import "SectorsViewController.h" #import "InfoViewController.h" // Definizione privata del metodo per l'apertura della UIWebView @interface SectorsViewController(Private) - (void)openInfo; @end @implementation SectorsViewController @synthesize tableSectors, scrollViewButtons; - (void)viewDidLoad { [super viewDidLoad]; aSectors = [[NSMutableArray alloc] initWithObjects:@"Primo",@"Secondo",@"Terzo",@"Quarto",nil]; NSLog(@"Numero settori: %i",[aSectors count]); } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the sections return [aSectors count]; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *CellIdentifier = [NSString stringWithFormat:@"Cell%i%i",indexPath.section,indexPath.row]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[uITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell... cell.textLabel.text = [aSectors objectAtIndex:indexPath.row]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here. Create and push another view controller. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (void)viewDidUnload { } - (void)dealloc { [aSectors release]; [super dealloc]; } @end Grazie! Link al commento Condividi su altri siti Altre opzioni di condivisione...
mpigio Inviato 19 Novembre 2010 Autore Segnala Condividi Inviato 19 Novembre 2010 Trovato! Avevo duplicato i file 2 volte... Link al commento Condividi su altri siti Altre opzioni di condivisione...
Messaggi raccomandati
Archiviato
Questa discussione è archiviata e chiusa a future risposte.