• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Einige Blicke in fremde Welten dürft Ihr nun bestaunen und darüber abstimmen, welche davon Euch am meisten gefällt: hier geht es lang für Euer Voting --> Klick

Spielplan // Grouped Tableview XML Parsen und dynamische Selection

mase_84

Jonagold
Registriert
28.02.10
Beiträge
23
Hi Zusammen,

also vorne weg. Das parsen einer xml und daraus eine TableView erstellen geht bereits. Allerdings brauch ich nicht nur eine Liste, sondern muss das ganze in gruppen darstellen. Ziel ist es ein Spielplan zu erstellen, wo wir heute noch nicht wissen wieviele Spiele es werden.

Mein XML-Datei sieht so aus:
Code:
[COLOR=#B731A1]<?xml version=[/COLOR][COLOR=#CE2E24]"1.0"[/COLOR][COLOR=#B731A1] encoding=[/COLOR][COLOR=#CE2E24]"UTF-8"[/COLOR][COLOR=#B731A1] ?>[/COLOR][COLOR=#B731A1]<channel>[/COLOR]

<spieltag name="1">
[COLOR=#B731A1]<item>[/COLOR]
        [COLOR=#b731a1]<club>[/COLOR]A Mannschaft - B Mannschaft[COLOR=#b731a1]</club>[/COLOR]
[COLOR=#B731A1]<date>[COLOR=#000000]14. Mai 2012 um 16:00 Uhr[/COLOR]</liga>[/COLOR]
[COLOR=#B731A1]</item>
[/COLOR]
<item>
        <club>A Mannschaft - B Mannschaft</club>
<date>[COLOR=#000000]14. Mai 2012 um 14:00 Uhr[/COLOR]</liga>
</item>

<item>
        <club>A Mannschaft - B Mannschaft</club>
<date>[COLOR=#000000]14. Mai 2012 um 12:00 Uhr[/COLOR]</liga>
</item>
</spieltag>   

<spieltag name="2">
[COLOR=#B731A1]<item>[/COLOR]
        [COLOR=#B731A1]<club>[/COLOR]A Mannschaft - B Mannschaf[COLOR=#B731A1]</club>[/COLOR]
[COLOR=#B731A1]<date>[COLOR=#000000]16. Mai 2012 um 16:00 Uhr[/COLOR]</liga>[/COLOR]
[COLOR=#B731A1]</item>
[/COLOR]
<item>
        <club>A Mannschaft - B Mannschaft</club>
<date>[COLOR=#000000]16. Mai 2012 um 14:00 Uhr[/COLOR]</liga>
</item>
</spieltag> 
[COLOR=#B731A1]
[/COLOR]
 
[COLOR=#B731A1]</channel>[/COLOR]

So und jetzt hörts bei mir auf... ich bekomm meinen code nicht so umgebaut, dass er die selection automatisch ausliest.

Kann mir hier vlt. jemand helfen?
Bitte bitte ...

Grüße
Matthias

UPDATE:

Code:
[COLOR=#77482D]#import [/COLOR][COLOR=#CE2E24]"SpielPlanViewController.h"[/COLOR]

[COLOR=#518187][COLOR=#b731a1]@interface[/COLOR][COLOR=#000000] [/COLOR]SpielPlanViewController[COLOR=#000000] ()[/COLOR][/COLOR]


[COLOR=#B731A1]@end[/COLOR]


[COLOR=#b731a1]@implementation[/COLOR] SpielPlanViewController


[COLOR=#B731A1]@synthesize[COLOR=#000000] stations;[/COLOR][/COLOR]
[COLOR=#b731a1]@synthesize[/COLOR] stationsTable;
[COLOR=#b731a1]@synthesize[/COLOR] loadingView;


- ([COLOR=#b731a1]id[/COLOR])initWithNibName:([COLOR=#6f41a8]NSString[/COLOR] *)nibNameOrNil bundle:([COLOR=#6f41a8]NSBundle[/COLOR] *)nibBundleOrNil
{
    [COLOR=#b731a1]self[/COLOR] = [[COLOR=#b731a1]super[/COLOR] [COLOR=#3c2280]initWithNibName[/COLOR]:nibNameOrNil [COLOR=#3c2280]bundle[/COLOR]:nibBundleOrNil];
    [COLOR=#b731a1]if[/COLOR] ([COLOR=#b731a1]self[/COLOR]) {
[COLOR=#0A830F][COLOR=#000000]        [/COLOR]// Custom initialization[/COLOR]
    }
[COLOR=#B731A1][COLOR=#000000]    [/COLOR]return[COLOR=#000000] [/COLOR]self[COLOR=#000000];[/COLOR][/COLOR]
}


- ([COLOR=#b731a1]void[/COLOR])viewDidLoad
{
[COLOR=#3C2280][COLOR=#000000]    [[/COLOR][COLOR=#b731a1]super[/COLOR][COLOR=#000000] [/COLOR]viewDidLoad[COLOR=#000000]];[/COLOR][/COLOR]


[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Navigation Controller ausblenden[/COLOR]
[COLOR=#3C2280][COLOR=#000000]    [[/COLOR][COLOR=#b731a1]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#6f41a8]navigationController[/COLOR][COLOR=#000000] [/COLOR]setNavigationBarHidden[COLOR=#000000]:[/COLOR][COLOR=#b731a1]YES[/COLOR][COLOR=#000000] [/COLOR]animated[COLOR=#000000]:[/COLOR][COLOR=#b731a1]NO[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Statusbar einblenden[/COLOR]
[COLOR=#6F41A8][COLOR=#000000]    [[/COLOR]UIApplication[COLOR=#000000]  [/COLOR][COLOR=#3c2280]sharedApplication[/COLOR][COLOR=#000000]].[/COLOR]statusBarHidden[COLOR=#000000] = [/COLOR][COLOR=#b731a1]NO[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
    
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Parser[/COLOR]
[COLOR=#518187][COLOR=#000000]    [/COLOR][COLOR=#b731a1]self[/COLOR][COLOR=#000000].[/COLOR]loadingView[COLOR=#000000].[/COLOR][COLOR=#6f41a8]hidden[/COLOR][COLOR=#000000] = [/COLOR][COLOR=#b731a1]NO[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
[COLOR=#3C2280][COLOR=#000000]    [[/COLOR][COLOR=#b731a1]self[/COLOR][COLOR=#000000] [/COLOR]performSelector[COLOR=#000000]:[/COLOR][COLOR=#b731a1]@selector[/COLOR][COLOR=#000000](parseXMLFile) [/COLOR]withObject[COLOR=#000000]:[/COLOR][COLOR=#b731a1]nil[/COLOR][COLOR=#000000] [/COLOR]afterDelay[COLOR=#000000]:[/COLOR][COLOR=#2633d5]0[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    
}


- ([COLOR=#b731a1]void[/COLOR])viewWillAppear:([COLOR=#b731a1]BOOL[/COLOR])animated {
    [[COLOR=#b731a1]super[/COLOR] [COLOR=#3c2280]viewWillAppear[/COLOR]:animated];


[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Navigation Controller ausblenden[/COLOR]
[COLOR=#3C2280][COLOR=#000000]    [[/COLOR][COLOR=#b731a1]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#6f41a8]navigationController[/COLOR][COLOR=#000000] [/COLOR]setNavigationBarHidden[COLOR=#000000]:[/COLOR][COLOR=#b731a1]YES[/COLOR][COLOR=#000000] [/COLOR]animated[COLOR=#000000]:[/COLOR][COLOR=#b731a1]NO[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Statusbar einblenden[/COLOR]
[COLOR=#6F41A8][COLOR=#000000]    [[/COLOR]UIApplication[COLOR=#000000]  [/COLOR][COLOR=#3c2280]sharedApplication[/COLOR][COLOR=#000000]].[/COLOR]statusBarHidden[COLOR=#000000] = [/COLOR][COLOR=#b731a1]NO[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
}


- ([COLOR=#b731a1]void[/COLOR])viewDidUnload
{
[COLOR=#3C2280][COLOR=#000000]    [[/COLOR][COLOR=#b731a1]super[/COLOR][COLOR=#000000] [/COLOR]viewDidUnload[COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Release any retained subviews of the main view.[/COLOR]
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// e.g. self.myOutlet = nil;[/COLOR]
}


- ([COLOR=#b731a1]BOOL[/COLOR])shouldAutorotateToInterfaceOrientation:([COLOR=#6f41a8]UIInterfaceOrientation[/COLOR])interfaceOrientation
{
    [COLOR=#b731a1]return[/COLOR] (interfaceOrientation == [COLOR=#3c2280]UIInterfaceOrientationPortrait[/COLOR]);
}


- ([COLOR=#b731a1]void[/COLOR]) parseXMLFile {
[COLOR=#3C2280][COLOR=#000000]    [/COLOR][COLOR=#6f41a8]NSString[/COLOR][COLOR=#000000] *filePath = [[[/COLOR][COLOR=#6f41a8]NSBundle[/COLOR][COLOR=#000000] [/COLOR]mainBundle[COLOR=#000000]] [/COLOR]pathForResource[COLOR=#000000]:[/COLOR][COLOR=#ce2e24]@"spielplan"[/COLOR][COLOR=#000000] [/COLOR]ofType[COLOR=#000000]:[/COLOR][COLOR=#ce2e24]@"xml"[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    [COLOR=#6f41a8]NSData[/COLOR] *data = [[COLOR=#6f41a8]NSData[/COLOR] [COLOR=#3c2280]dataWithContentsOfFile[/COLOR]:filePath];
    [COLOR=#6f41a8]NSXMLParser[/COLOR] *parser = [[[[COLOR=#6f41a8]NSXMLParser[/COLOR] [COLOR=#3c2280]alloc[/COLOR]] [COLOR=#3c2280]initWithData[/COLOR]:data] [COLOR=#3c2280]autorelease[/COLOR]];


	[parser [COLOR=#3c2280]setDelegate[/COLOR]:[COLOR=#b731a1]self[/COLOR]];
[COLOR=#3C2280][COLOR=#000000]	[parser [/COLOR]setShouldResolveExternalEntities[COLOR=#000000]:[/COLOR][COLOR=#b731a1]YES[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
	[parser [COLOR=#3c2280]parse[/COLOR]];
}


[COLOR=#77482D]#pragma NSXMLParserDelegate methods[/COLOR]


- ([COLOR=#b731a1]void[/COLOR])parser:([COLOR=#6f41a8]NSXMLParser[/COLOR] *)parser parseErrorOccurred:([COLOR=#6f41a8]NSError[/COLOR] *)parseError {
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Der XML-Parser meldet einen Fehler: die Ladeanzeige wird deaktiviert und eine Fehlermeldund wird angezeigt[/COLOR]
[COLOR=#518187][COLOR=#000000]    [/COLOR][COLOR=#b731a1]self[/COLOR][COLOR=#000000].[/COLOR]loadingView[COLOR=#000000].[/COLOR][COLOR=#6f41a8]hidden[/COLOR][COLOR=#000000] = [/COLOR][COLOR=#b731a1]YES[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
[COLOR=#CE2E24][COLOR=#000000]    [/COLOR][COLOR=#6f41a8]UIAlertView[/COLOR][COLOR=#000000] *alert = [[[/COLOR][COLOR=#6f41a8]UIAlertView[/COLOR][COLOR=#000000] [/COLOR][COLOR=#3c2280]alloc[/COLOR][COLOR=#000000]] [/COLOR][COLOR=#3c2280]initWithTitle[/COLOR][COLOR=#000000]:[/COLOR]@"Hinweis"[COLOR=#000000] [/COLOR][COLOR=#3c2280]message[/COLOR][COLOR=#000000]:[/COLOR]@"Der ausgewählte Sender ist aktuell Offline oder es besteht keine Datenverbindung."[COLOR=#000000] [/COLOR][COLOR=#3c2280]delegate[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#b731a1]nil[/COLOR][COLOR=#000000] [/COLOR][COLOR=#3c2280]cancelButtonTitle[/COLOR][COLOR=#000000]:[/COLOR]@"Schließen"[COLOR=#000000] [/COLOR][COLOR=#3c2280]otherButtonTitles[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#b731a1]nil[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    [alert [COLOR=#3c2280]show[/COLOR]];
    [alert [COLOR=#3c2280]release[/COLOR]];
}


- ([COLOR=#b731a1]void[/COLOR])parserDidStartDocument:([COLOR=#6f41a8]NSXMLParser[/COLOR] *)parser {
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Vorbereiten des Station-Arrays[/COLOR]
    [COLOR=#b731a1]if[/COLOR] ([COLOR=#b731a1]self[/COLOR].[COLOR=#518187]stations[/COLOR]) {
[COLOR=#3C2280][COLOR=#000000]        [[/COLOR][COLOR=#b731a1]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#518187]stations[/COLOR][COLOR=#000000] [/COLOR]removeAllObjects[COLOR=#000000]];[/COLOR][/COLOR]
    } [COLOR=#b731a1]else[/COLOR] {
        [COLOR=#b731a1]self[/COLOR].[COLOR=#518187]stations[/COLOR] = [[[COLOR=#6f41a8]NSMutableArray[/COLOR] [COLOR=#3c2280]alloc[/COLOR]] [COLOR=#3c2280]init[/COLOR]];
    }
[COLOR=#518187][COLOR=#000000]    [/COLOR][COLOR=#b731a1]self[/COLOR][COLOR=#000000].[/COLOR]loadingView[COLOR=#000000].[/COLOR][COLOR=#6f41a8]hidden[/COLOR][COLOR=#000000] = [/COLOR][COLOR=#b731a1]NO[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
}


- ([COLOR=#b731a1]void[/COLOR])parser:([COLOR=#6f41a8]NSXMLParser[/COLOR] *)parser didStartElement:([COLOR=#6f41a8]NSString[/COLOR] *)elementName namespaceURI:([COLOR=#6f41a8]NSString[/COLOR] *)namespaceURI qualifiedName:([COLOR=#6f41a8]NSString[/COLOR] *)qName attributes:([COLOR=#6f41a8]NSDictionary[/COLOR] *)attributeDict {
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// xmlString zusrücksetzen;[/COLOR]
[COLOR=#518187][COLOR=#000000]    [/COLOR]xmlString[COLOR=#000000] = [/COLOR][COLOR=#ce2e24]@""[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
}


- ([COLOR=#b731a1]void[/COLOR])parser:([COLOR=#6f41a8]NSXMLParser[/COLOR] *)parser foundCharacters:([COLOR=#6f41a8]NSString[/COLOR] *)string {
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Gefundenen Text zu xmlString hinzufügen[/COLOR]
[COLOR=#3C2280][COLOR=#000000]    [/COLOR][COLOR=#518187]xmlString[/COLOR][COLOR=#000000] = [[/COLOR][COLOR=#518187]xmlString[/COLOR][COLOR=#000000] [/COLOR]stringByAppendingString[COLOR=#000000]:string];[/COLOR][/COLOR]
}


- ([COLOR=#b731a1]void[/COLOR])parser:([COLOR=#6f41a8]NSXMLParser[/COLOR] *)parser didEndElement:([COLOR=#6f41a8]NSString[/COLOR] *)elementName namespaceURI:([COLOR=#6f41a8]NSString[/COLOR] *)namespaceURI qualifiedName:([COLOR=#6f41a8]NSString[/COLOR] *)qName {
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Welches Element wurde als letztes geparst? Der Wert aus xmlString wird der entsprechenden Variablen zugewiesen[/COLOR]
    [COLOR=#b731a1]if[/COLOR] ([elementName [COLOR=#3c2280]isEqualToString[/COLOR]:[COLOR=#ce2e24]@"spieltag"[/COLOR]]) {
        [COLOR=#b731a1]self[/COLOR].[COLOR=#6f41a8]title[/COLOR] = [COLOR=#518187]xmlString[/COLOR];
    } [COLOR=#b731a1]else[/COLOR] [COLOR=#b731a1]if[/COLOR] ([elementName [COLOR=#3c2280]isEqualToString[/COLOR]:[COLOR=#ce2e24]@"club"[/COLOR]]) {
[COLOR=#518187][COLOR=#000000]        [/COLOR]clubName[COLOR=#000000] = [/COLOR]xmlString[COLOR=#000000];[/COLOR][/COLOR]
        [[COLOR=#518187]clubName[/COLOR] [COLOR=#3c2280]retain[/COLOR]];
    } [COLOR=#b731a1]else[/COLOR] [COLOR=#b731a1]if[/COLOR] ([elementName [COLOR=#3c2280]isEqualToString[/COLOR]:[COLOR=#ce2e24]@"date"[/COLOR]]) {
[COLOR=#518187][COLOR=#000000]        [/COLOR]gameDate[COLOR=#000000] = [/COLOR]xmlString[COLOR=#000000];[/COLOR][/COLOR]
        [[COLOR=#518187]gameDate[/COLOR] [COLOR=#3c2280]retain[/COLOR]];
    } [COLOR=#b731a1]else[/COLOR] [COLOR=#b731a1]if[/COLOR] ([elementName [COLOR=#3c2280]isEqualToString[/COLOR]:[COLOR=#ce2e24]@"spieltag"[/COLOR]]) {
[COLOR=#518187][COLOR=#000000]        [/COLOR]spieltagNumber[COLOR=#000000] = [/COLOR]xmlString[COLOR=#000000];[/COLOR][/COLOR]
        [[COLOR=#518187]spieltagNumber[/COLOR] [COLOR=#3c2280]retain[/COLOR]];        
    } [COLOR=#b731a1]else[/COLOR] [COLOR=#b731a1]if[/COLOR] ([elementName [COLOR=#3c2280]isEqualToString[/COLOR]:[COLOR=#ce2e24]@"item"[/COLOR]]) {
[COLOR=#0A830F][COLOR=#000000]        [/COLOR]// Komplettes item wurde geparst, aus den Daten zum Sender wird ein NSDictionary erzeugt und dem Stations-Array hinzugefügt[/COLOR]
        [COLOR=#6f41a8]NSDictionary[/COLOR] *stationDict = [[COLOR=#6f41a8]NSDictionary[/COLOR] [COLOR=#3c2280]dictionaryWithObjectsAndKeys[/COLOR]:[COLOR=#518187]clubName[/COLOR], [COLOR=#ce2e24]@"club"[/COLOR], [COLOR=#518187]gameDate[/COLOR], [COLOR=#ce2e24]@"date"[/COLOR], [COLOR=#518187]spieltagNumber[/COLOR], [COLOR=#ce2e24]@"spieltag"[/COLOR], [COLOR=#b731a1]nil[/COLOR]];
        [[COLOR=#b731a1]self[/COLOR].[COLOR=#518187]stations[/COLOR] [COLOR=#3c2280]addObject[/COLOR]:stationDict];
        [[COLOR=#518187]clubName[/COLOR] [COLOR=#3c2280]release[/COLOR]];
        [[COLOR=#518187]gameDate[/COLOR] [COLOR=#3c2280]release[/COLOR]];
[COLOR=#518187][COLOR=#000000]        [[/COLOR]spieltagNumber[COLOR=#000000] [/COLOR][COLOR=#3c2280]release[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    }
}


- ([COLOR=#b731a1]void[/COLOR]) parserDidEndDocument:([COLOR=#6f41a8]NSXMLParser[/COLOR] *)parser {
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Nach dem Ende des Parsens wird die Tabelle mit den Daten neu geladen[/COLOR]
[COLOR=#518187][COLOR=#000000]    [[/COLOR][COLOR=#b731a1]self[/COLOR][COLOR=#000000].[/COLOR]stationsTable[COLOR=#000000] [/COLOR][COLOR=#3c2280]reloadData[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#518187][COLOR=#000000]    [/COLOR][COLOR=#b731a1]self[/COLOR][COLOR=#000000].[/COLOR]loadingView[COLOR=#000000].[/COLOR][COLOR=#6f41a8]hidden[/COLOR][COLOR=#000000] = [/COLOR][COLOR=#b731a1]YES[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
}


[COLOR=#77482D]#pragma UITableViewDataSource methods[/COLOR]


- ([COLOR=#6f41a8]NSInteger[/COLOR])numberOfSectionsInTableView:([COLOR=#6f41a8]UITableView[/COLOR] *)tableView {
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Eine Tabellensektion[/COLOR]
    [COLOR=#b731a1]return[/COLOR] [COLOR=#2633d5]1[/COLOR];
}


- ([COLOR=#6f41a8]NSInteger[/COLOR])tableView:([COLOR=#6f41a8]UITableView[/COLOR] *)tableView numberOfRowsInSection:([COLOR=#6f41a8]NSInteger[/COLOR])section {
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Die Anzahl der Zellen entspricht der Anzahl der Sender im Stations Array[/COLOR]
[COLOR=#B731A1][COLOR=#000000]    [/COLOR]return[COLOR=#000000] [/COLOR]self[COLOR=#000000].[/COLOR][COLOR=#518187]stations[/COLOR][COLOR=#000000].[/COLOR][COLOR=#3c2280]count[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
}


- ([COLOR=#6f41a8]NSString[/COLOR] *)tableView:([COLOR=#6f41a8]UITableView[/COLOR] *)tableView titleForHeaderInSection:([COLOR=#6f41a8]NSInteger[/COLOR])section {
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Der Inhalt des title-Tags ist der Titel der Tabellensektion[/COLOR]
[COLOR=#B731A1][COLOR=#000000]    [/COLOR]return[COLOR=#000000] [/COLOR]self[COLOR=#000000].[/COLOR][COLOR=#6f41a8]title[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
}


- ([COLOR=#6f41a8]UITableViewCell[/COLOR] *)tableView:([COLOR=#6f41a8]UITableView[/COLOR] *)tableView cellForRowAtIndexPath:([COLOR=#6f41a8]NSIndexPath[/COLOR] *)indexPath {
    
    [COLOR=#b731a1]static[/COLOR] [COLOR=#6f41a8]NSString[/COLOR] *CellIdentifier = [COLOR=#ce2e24]@"Cell"[/COLOR];
    
    [COLOR=#6f41a8]UITableViewCell[/COLOR] *cell = [tableView [COLOR=#3c2280]dequeueReusableCellWithIdentifier[/COLOR]:CellIdentifier];
    [COLOR=#b731a1]if[/COLOR] (cell == [COLOR=#b731a1]nil[/COLOR]) {
[COLOR=#3C2280][COLOR=#000000]        cell = [[[[/COLOR][COLOR=#6f41a8]UITableViewCell[/COLOR][COLOR=#000000] [/COLOR]alloc[COLOR=#000000]] [/COLOR]initWithStyle[COLOR=#000000]:[/COLOR]UITableViewCellStyleSubtitle[COLOR=#000000] [/COLOR]reuseIdentifier[COLOR=#000000]:CellIdentifier] [/COLOR]autorelease[COLOR=#000000]];[/COLOR][/COLOR]
    }
    
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Das NSDictionary mit den Daten zum Sender wird aus dem Zellenindex entsprechenden Position im Stations Array geholt[/COLOR]
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// Anschließend wird die Zelle mit den Daten konfiguriert[/COLOR]
    [COLOR=#6f41a8]NSDictionary[/COLOR] *stationDict = [[COLOR=#b731a1]self[/COLOR].[COLOR=#518187]stations[/COLOR] [COLOR=#3c2280]objectAtIndex[/COLOR]:indexPath.[COLOR=#6f41a8]row[/COLOR]];
    
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// mit Liga[/COLOR]
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// cell.textLabel.text = [NSString stringWithFormat:@"%@ - %@", [stationDict objectForKey:@"club"], [stationDict objectForKey:@"liga"]];[/COLOR]
[COLOR=#0A830F][COLOR=#000000]    [/COLOR]// ohne Liga[/COLOR]
    cell.[COLOR=#6f41a8]textLabel[/COLOR].[COLOR=#6f41a8]text[/COLOR] = [stationDict [COLOR=#3c2280]objectForKey[/COLOR]:[COLOR=#ce2e24]@"club"[/COLOR]];
	cell.[COLOR=#6f41a8]detailTextLabel[/COLOR].[COLOR=#6f41a8]text[/COLOR] = [stationDict [COLOR=#3c2280]objectForKey[/COLOR]:[COLOR=#ce2e24]@"date"[/COLOR]];
	
    [COLOR=#b731a1]return[/COLOR] cell;
}


[COLOR=#77482D]#pragma UITableViewDelegate methods[/COLOR]


- ([COLOR=#b731a1]void[/COLOR])tableView:([COLOR=#6f41a8]UITableView[/COLOR] *)tableView didSelectRowAtIndexPath:([COLOR=#6f41a8]NSIndexPath[/COLOR] *)indexPath {


[COLOR=#3C2280][COLOR=#000000]    [/COLOR][COLOR=#6f41a8]UIAlertView[/COLOR][COLOR=#000000] *alert = [[[/COLOR][COLOR=#6f41a8]UIAlertView[/COLOR][COLOR=#000000] [/COLOR]alloc[COLOR=#000000]] [/COLOR]initWithTitle[COLOR=#000000]:[/COLOR][COLOR=#ce2e24]@"Auswahl"[/COLOR][COLOR=#000000] [/COLOR]message[COLOR=#000000]:[/COLOR][COLOR=#ce2e24]@"Was nun?"[/COLOR][COLOR=#000000] [/COLOR]delegate[COLOR=#000000]:[/COLOR][COLOR=#b731a1]nil[/COLOR][COLOR=#000000] [/COLOR]cancelButtonTitle[COLOR=#000000]:[/COLOR][COLOR=#ce2e24]@"Schließen"[/COLOR][COLOR=#000000] [/COLOR]otherButtonTitles[COLOR=#000000]:[/COLOR][COLOR=#b731a1]nil[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    
    [alert [COLOR=#3c2280]show[/COLOR]];
    [alert [COLOR=#3c2280]release[/COLOR]];
}




- ([COLOR=#b731a1]void[/COLOR])dealloc {
    [[COLOR=#518187]stations[/COLOR] [COLOR=#3c2280]release[/COLOR]];
[COLOR=#518187][COLOR=#000000]    [[/COLOR]stationsTable[COLOR=#000000] [/COLOR][COLOR=#3c2280]release[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#518187][COLOR=#000000]    [[/COLOR]loadingView[COLOR=#000000] [/COLOR][COLOR=#3c2280]release[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    [[COLOR=#b731a1]super[/COLOR] [COLOR=#3c2280]dealloc[/COLOR]];
}


[COLOR=#B731A1]@end[/COLOR]
 
Zuletzt bearbeitet:
ich könnt wirklich hilfe gebrauchen! :) ... Niemand da, der sich das kurz ansehen kann?
 
So hab weiter dran gearbeitet und auch schon was erreicht. Habe mich von dem XML verabschiedet und jetzt eine PLIST verwendet. Diese sieht wie folgt aus:

Code:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>1. Spieltag</key>
    <array>
        <string>Augsburg vs. Berlin</string>
        <string>American Gansters</string>
    </array>
    <key>2. Spieltag</key>
    <array>
        <string>A Hand to Guide Me</string>
        <string>Inside Man</string>
    </array>
    <key>3. Spieltag</key>
    <array>
        <string>Deja Vu</string>
    </array>
    <key>4. Spieltag</key>
    <array>
        <string>Malcom X</string>
        <string>The Pelican Brief</string>
        <string>The Hurricane</string>
    </array>
    <key>2004</key>
    <array>
        <string>Man on Fire</string>
        <string>Out of TIme</string>
        <string>Training Day</string>
        <string>License to Kill</string>
        <string>Carbon Copy</string>
    </array>
    <key>2002</key>
    <array>
        <string>John Q.</string>
    </array>
    <key>2001</key>
    <array>
        <string>Remember the Titans</string>
        <string>The Bone Collector</string>
    </array>
</dict>
</plist>

mein SpielPlanViewController.m sieht so aus:

Code:
- ([COLOR=#B731A1]void[/COLOR])viewDidLoad
{
    
[COLOR=#0A830F]//Spielplan laden[/COLOR]
[COLOR=#3C2280][COLOR=#6f41a8]NSString[/COLOR][COLOR=#000000] *localPath = [[[/COLOR][COLOR=#6f41a8]NSBundle[/COLOR]mainBundle[COLOR=#000000]] [/COLOR]pathForResource[COLOR=#000000]:[/COLOR][COLOR=#ce2e24]@"Spielplan"[/COLOR]ofType[COLOR=#000000]:[/COLOR][COLOR=#ce2e24]@"plist"[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    [COLOR=#6f41a8]NSDictionary[/COLOR] *dic = [[[COLOR=#6f41a8]NSDictionary[/COLOR] [COLOR=#3c2280]alloc[/COLOR]] [COLOR=#3c2280]initWithContentsOfFile[/COLOR]:localPath];
    [COLOR=#b731a1]self[/COLOR].[COLOR=#518187]vereine[/COLOR] = dic;
    
    [dic [COLOR=#3c2280]release[/COLOR]];
    
    [COLOR=#6f41a8]NSArray[/COLOR] *array = [[[COLOR=#b731a1]self[/COLOR].[COLOR=#518187]vereine[/COLOR] [COLOR=#3c2280]allKeys[/COLOR]] [COLOR=#3c2280]sortedArrayUsingSelector[/COLOR]:[COLOR=#b731a1]@selector[/COLOR](compare:)];
    [COLOR=#b731a1]self[/COLOR].[COLOR=#518187]spieltage[/COLOR] = array;
    
[COLOR=#3C2280][COLOR=#000000]    [[/COLOR][COLOR=#b731a1]super[/COLOR]viewDidLoad[COLOR=#000000]];[/COLOR][/COLOR]


[COLOR=#0A830F]// Navigation Controller ausblenden[/COLOR]
[COLOR=#3C2280][COLOR=#000000]    [[/COLOR][COLOR=#b731a1]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#6f41a8]navigationController[/COLOR]setNavigationBarHidden[COLOR=#000000]:[/COLOR][COLOR=#b731a1]YES[/COLOR]animated[COLOR=#000000]:[/COLOR][COLOR=#b731a1]NO[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    
[COLOR=#0A830F]// Statusbar einblenden[/COLOR]
[COLOR=#6F41A8][COLOR=#000000]    [[/COLOR]UIApplication[COLOR=#3c2280]sharedApplication[/COLOR][COLOR=#000000]].[/COLOR]statusBarHidden[COLOR=#000000] = [/COLOR][COLOR=#b731a1]NO[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
    
}


- ([COLOR=#b731a1]void[/COLOR])viewWillAppear:([COLOR=#b731a1]BOOL[/COLOR])animated {
    [[COLOR=#b731a1]super[/COLOR] [COLOR=#3c2280]viewWillAppear[/COLOR]:animated];


[COLOR=#0A830F]// Navigation Controller ausblenden[/COLOR]
[COLOR=#3C2280][COLOR=#000000]    [[/COLOR][COLOR=#b731a1]self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#6f41a8]navigationController[/COLOR]setNavigationBarHidden[COLOR=#000000]:[/COLOR][COLOR=#b731a1]YES[/COLOR]animated[COLOR=#000000]:[/COLOR][COLOR=#b731a1]NO[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    
[COLOR=#0A830F]// Statusbar einblenden[/COLOR]
[COLOR=#6F41A8][COLOR=#000000]    [[/COLOR]UIApplication[COLOR=#3c2280]sharedApplication[/COLOR][COLOR=#000000]].[/COLOR]statusBarHidden[COLOR=#000000] = [/COLOR][COLOR=#b731a1]NO[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
}


- ([COLOR=#b731a1]void[/COLOR])viewDidUnload
{
[COLOR=#3C2280][COLOR=#000000]    [[/COLOR][COLOR=#b731a1]super[/COLOR]viewDidUnload[COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#0A830F]// Release any retained subviews of the main view.[/COLOR]
[COLOR=#0A830F]// e.g. self.myOutlet = nil;[/COLOR]
}


- ([COLOR=#b731a1]BOOL[/COLOR])shouldAutorotateToInterfaceOrientation:([COLOR=#6f41a8]UIInterfaceOrientation[/COLOR])interfaceOrientation
{
    [COLOR=#b731a1]return[/COLOR] (interfaceOrientation == [COLOR=#3c2280]UIInterfaceOrientationPortrait[/COLOR]);
}


[COLOR=#77482D]#pragma UITableViewDataSource methods[/COLOR]


- ([COLOR=#6f41a8]NSInteger[/COLOR])numberOfSectionsInTableView:([COLOR=#6f41a8]UITableView[/COLOR] *)tableView {
[COLOR=#0A830F]// Tabellensektionen[/COLOR]
    [COLOR=#b731a1]return[/COLOR] [[COLOR=#b731a1]self[/COLOR].[COLOR=#518187]spieltage[/COLOR] [COLOR=#3c2280]count[/COLOR]];
}


- ([COLOR=#6f41a8]NSString[/COLOR] *)tableView:([COLOR=#6f41a8]UITableView[/COLOR] *)tableView titleForHeaderInSection:([COLOR=#6f41a8]NSInteger[/COLOR])section {
[COLOR=#0A830F]// Der Inhalt des title-Tags ist der Titel der Tabellensektion[/COLOR]
    [COLOR=#6f41a8]NSString[/COLOR] *spieltag = [[COLOR=#b731a1]self[/COLOR].[COLOR=#518187]spieltage[/COLOR] [COLOR=#3c2280]objectAtIndex[/COLOR]:section];
    [COLOR=#b731a1]return[/COLOR] spieltag;
 }


- ([COLOR=#6f41a8]NSInteger[/COLOR])tableView:([COLOR=#6f41a8]UITableView[/COLOR] *)tableView numberOfRowsInSection:([COLOR=#6f41a8]NSInteger[/COLOR])section {
[COLOR=#0A830F]// Die Anzahl der Zellen entspricht der Anzahl der Sender im Stations Array[/COLOR]
    [COLOR=#6f41a8]NSString[/COLOR] *spieltag = [[COLOR=#b731a1]self[/COLOR].[COLOR=#518187]spieltage[/COLOR] [COLOR=#3c2280]objectAtIndex[/COLOR]:section];
    [COLOR=#6f41a8]NSArray[/COLOR] *vereineSection = [[COLOR=#b731a1]self[/COLOR].[COLOR=#518187]vereine[/COLOR] [COLOR=#3c2280]objectForKey[/COLOR]:spieltag];
    [COLOR=#b731a1]return[/COLOR]  [vereineSection [COLOR=#3c2280]count[/COLOR]];
}


- ([COLOR=#6f41a8]UITableViewCell[/COLOR] *)tableView:([COLOR=#6f41a8]UITableView[/COLOR] *)tableView cellForRowAtIndexPath:([COLOR=#6f41a8]NSIndexPath[/COLOR] *)indexPath {
    
    [COLOR=#b731a1]static[/COLOR] [COLOR=#6f41a8]NSString[/COLOR] *CellIdentifier = [COLOR=#ce2e24]@"Cell"[/COLOR];
    
    [COLOR=#6f41a8]UITableViewCell[/COLOR] *cell = [tableView [COLOR=#3c2280]dequeueReusableCellWithIdentifier[/COLOR]:CellIdentifier];
    [COLOR=#b731a1]if[/COLOR] (cell == [COLOR=#b731a1]nil[/COLOR]) {
[COLOR=#3C2280][COLOR=#000000]        cell = [[[[/COLOR][COLOR=#6f41a8]UITableViewCell[/COLOR]alloc[COLOR=#000000]] [/COLOR]initWithStyle[COLOR=#000000]:[/COLOR]UITableViewCellStyleSubtitlereuseIdentifier[COLOR=#000000]:CellIdentifier] [/COLOR]autorelease[COLOR=#000000]];[/COLOR][/COLOR]
    }
    
[COLOR=#0A830F]// Configure the cell.[/COLOR]
    [COLOR=#6f41a8]NSString[/COLOR] *spieltag = [[COLOR=#b731a1]self[/COLOR].[COLOR=#518187]spieltage[/COLOR] [COLOR=#3c2280]objectAtIndex[/COLOR]:[indexPath [COLOR=#3c2280]section[/COLOR]]];
    [COLOR=#6f41a8]NSArray[/COLOR] *vereineSection = [[COLOR=#b731a1]self[/COLOR].[COLOR=#518187]vereine[/COLOR] [COLOR=#3c2280]objectForKey[/COLOR]:spieltag];
    cell.[COLOR=#6f41a8]textLabel[/COLOR].[COLOR=#6f41a8]text[/COLOR] = [vereineSection [COLOR=#3c2280]objectAtIndex[/COLOR]:[indexPath [COLOR=#3c2280]row[/COLOR]]];
    cell.[COLOR=#6f41a8]detailTextLabel[/COLOR].[COLOR=#6f41a8]text[/COLOR] = [vereineSection [COLOR=#3c2280]objectAtIndex[/COLOR]:[indexPath [COLOR=#3c2280]row[/COLOR]]];
    
    [COLOR=#b731a1]return[/COLOR] cell;    
    
[COLOR=#0A830F]/* NSString *spieltag = [self.spieltage objectAtIndex:[indexPath section]];[/COLOR]
[COLOR=#0A830F]    NSDictionary *vereineSection = [vereine objectForKey:spieltag];[/COLOR]
[COLOR=#0A830F]    cell.textLabel.text = [vereineSection objectForKey:@"name"];[/COLOR]
[COLOR=#0A830F]    cell.detailTextLabel.text =[vereineSection objectForKey:@"date"];[/COLOR]
[COLOR=#0A830F]    return cell; */[/COLOR]
    
}


[COLOR=#0A830F]// Override to support conditional editing of the table view.[/COLOR]
- ([COLOR=#b731a1]BOOL[/COLOR])tableView:([COLOR=#6f41a8]UITableView[/COLOR] *)tableView canEditRowAtIndexPath:([COLOR=#6f41a8]NSIndexPath[/COLOR] *)indexPath
{
[COLOR=#0A830F]// Return NO if you do not want the specified item to be editable.[/COLOR]
[COLOR=#B731A1]returnYES[COLOR=#000000];[/COLOR][/COLOR]
}


- ([COLOR=#b731a1]void[/COLOR])tableView:([COLOR=#6f41a8]UITableView[/COLOR] *)tableView commitEditingStyle:([COLOR=#6f41a8]UITableViewCellEditingStyle[/COLOR])editingStyle forRowAtIndexPath:([COLOR=#6f41a8]NSIndexPath[/COLOR] *)indexPath
{
[COLOR=#3C2280][COLOR=#b731a1]if[/COLOR][COLOR=#000000] (editingStyle == [/COLOR]UITableViewCellEditingStyleDelete[COLOR=#000000])[/COLOR][/COLOR]
    {
[COLOR=#0A830F]// Delete the row from the data source.[/COLOR]
[COLOR=#3C2280][COLOR=#000000]        [tableView [/COLOR]deleteRowsAtIndexPaths[COLOR=#000000]:[[/COLOR][COLOR=#6f41a8]NSArray[/COLOR]arrayWithObject[COLOR=#000000]:indexPath] [/COLOR]withRowAnimation[COLOR=#000000]:[/COLOR]UITableViewRowAnimationFade[COLOR=#000000]];[/COLOR][/COLOR]
    }
[COLOR=#3C2280][COLOR=#b731a1]else[/COLOR][COLOR=#b731a1]if[/COLOR][COLOR=#000000] (editingStyle == [/COLOR]UITableViewCellEditingStyleInsert[COLOR=#000000])[/COLOR][/COLOR]
    {
[COLOR=#0A830F]// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.[/COLOR]
    }
}


- ([COLOR=#b731a1]void[/COLOR])dealloc {
    [[COLOR=#518187]vereine[/COLOR] [COLOR=#3c2280]release[/COLOR]];
[COLOR=#518187][COLOR=#000000]    [[/COLOR]spieltage[COLOR=#3c2280]release[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#518187][COLOR=#000000]    [[/COLOR]stationsTable[COLOR=#3c2280]release[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#518187][COLOR=#000000]    [[/COLOR]loadingView[COLOR=#3c2280]release[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    [[COLOR=#b731a1]super[/COLOR] [COLOR=#3c2280]dealloc[/COLOR]];
}


[COLOR=#B731A1]@end[/COLOR]


Das funktioniert auch wunderbar. :) ... ABER ich brauch noch "cell.detailTextLabel.text" damit ich die Uhrzeit reinschreiben kann. Dafür muss ich meine PLIST abändern. Hab ich wie folgt gemacht:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>1. Spieltag</key>
    <array>
        <dict>
            <key>name</key>
            <string>Augsburg vs. Straubing</string>
            <key>date</key>
            <string>Lambeau Field</string>
        </dict>
        <dict>
            <key>name</key>
            <string>Augsburg vs. Straubing</string>
            <key>date</key>
            <string>Lambeau Field</string>
        </dict>
        <dict>
            <key>name</key>
            <string>Augsburg vs. Straubing</string>
            <key>date</key>
            <string>Lambeau Field</string>
        </dict>
    </array>
    <key>2. Spieltag</key>
    <array>
        <dict>
            <key>name</key>
            <string>Augsburg vs. Straubing</string>
            <key>date</key>
            <string>Lambeau Field</string>
        </dict>
        <dict>
            <key>name</key>
            <string>Augsburg vs. Straubing</string>
            <key>date</key>
            <string>Lambeau Field</string>
        </dict>
    </array>
    
    <key>3. Spieltag</key>
    <array>
        <dict>
            <key>name</key>
            <string>Augsburg vs. Straubing</string>
            <key>date</key>
            <string>Lambeau Field</string>
        </dict>
    </array>
    
</dict>
</plist>

so ... jetzt weiß ich aber nicht wie ich in meinem SpielPlanViewController.m ändern muss. Kann mir hier jemand helfen? Der Key "date" soll die detailDescription darstellen! :)


Grüße
und Danke
matthias
 
Kann mir echt keiner helfen? ... Könnt hier zumindest ratschläge oder what ever gut gebrauchen.