Hallo,
ich hock schon seit Stunden davor und hab den Fehler zwar gefunden, aber ich weiß nicht wie ich ihn beheben kann.
Fallbeschreibung:
- Ich habe ein UIImage (Rädchen) welches ich mit einer Pangesture Bewegung nach oben oder nach unten bewege.
- Geht der Finger nach oben, dann bewegt sich das Rädchen nach oben (startAnimation). gbf auch andersrum.
- Dazu habe ich ein Array erstellt, welches ein Tableview damit füllt.
- Das bedeutet, wenn ich nach oben bewege wandert mein tableview nach oben und mein selected Item auch (row).
-> Soweit klappt auch alles, wenn ich den cell.textlabel.text NICHT abhängig vom Array mache!
-> Sind die Werte im Tableview aber abhängig von dem Array, dann gibt er mir folgende Fehlermeldung!
Alles anzeigen
Ja mein Array hat nur Platz für 9 items. Aber ich lad doch nur den Text hinein und scroll dann unabhängig hoch und runter? oder verstehe ich das falsch?
Wenn ich ihm aber zum Beispiel sage, dass numberOfRowsInSection 9 ist, und es NICHT vom Array abhängig mache, dann macht er keine Probleme. Das bestätigt doch das ganze oder?
Mein Code:
Alles anzeigen
sry für die vielen Fragen -.-
ich hock schon seit Stunden davor und hab den Fehler zwar gefunden, aber ich weiß nicht wie ich ihn beheben kann.
Fallbeschreibung:
- Ich habe ein UIImage (Rädchen) welches ich mit einer Pangesture Bewegung nach oben oder nach unten bewege.
- Geht der Finger nach oben, dann bewegt sich das Rädchen nach oben (startAnimation). gbf auch andersrum.
- Dazu habe ich ein Array erstellt, welches ein Tableview damit füllt.
- Das bedeutet, wenn ich nach oben bewege wandert mein tableview nach oben und mein selected Item auch (row).
-> Soweit klappt auch alles, wenn ich den cell.textlabel.text NICHT abhängig vom Array mache!
-> Sind die Werte im Tableview aber abhängig von dem Array, dann gibt er mir folgende Fehlermeldung!
Quellcode
- 2011-11-22 15:47:19.301 GruenbeckiPhone[2110:707] counterForPlanOrProd: 1
- 2011-11-22 15:47:20.456 GruenbeckiPhone[2110:707] pdfNr Selected Row: 1
- 2011-11-22 15:47:31.048 GruenbeckiPhone[2110:707] pdfNr Selected Row: 1
- 2011-11-22 15:47:33.272 GruenbeckiPhone[2110:707] pdfNr Selected Row: 1
- 2011-11-22 15:47:35.785 GruenbeckiPhone[2110:707] pdfNr Selected Row: 2
- 2011-11-22 15:47:37.086 GruenbeckiPhone[2110:707] pdfNr Selected Row: 3
- 2011-11-22 15:47:39.893 GruenbeckiPhone[2110:707] pdfNr Selected Row: 4
- 2011-11-22 15:47:40.650 GruenbeckiPhone[2110:707] pdfNr Selected Row: 3
- 2011-11-22 15:47:41.965 GruenbeckiPhone[2110:707] pdfNr Selected Row: 2
- 2011-11-22 15:47:42.722 GruenbeckiPhone[2110:707] pdfNr Selected Row: 1
- 2011-11-22 15:47:43.379 GruenbeckiPhone[2110:707] pdfNr Selected Row: 2
- 2011-11-22 15:47:43.875 GruenbeckiPhone[2110:707] pdfNr Selected Row: 3
- 2011-11-22 15:47:44.234 GruenbeckiPhone[2110:707] pdfNr Selected Row: 4
- 2011-11-22 15:47:44.628 GruenbeckiPhone[2110:707] pdfNr Selected Row: 5
- 2011-11-22 15:47:45.027 GruenbeckiPhone[2110:707] pdfNr Selected Row: 6
- 2011-11-22 15:47:45.301 GruenbeckiPhone[2110:707] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 9 beyond bounds [0 .. 8]'
- *** First throw call stack:
- (0x342178bf 0x322391e5 0x3416f275 0x257c5 0x373f59cb 0x373f4aa9 0x373f4233 0x37398d4b 0x3417622b 0x32e80381 0x32e7ff99 0x32e8411b 0x32e83e57 0x32eab6f1 0x32ece4c5 0x32ece379 0x3542df93 0x33491891 0x341e0f43 0x341eb553 0x341eb4f5 0x341ea343 0x3416d4dd 0x3416d3a5 0x325c2fcd 0x373c3743 0x25d9 0x2598)
- terminate called throwing an exceptionkill
- quit
Ja mein Array hat nur Platz für 9 items. Aber ich lad doch nur den Text hinein und scroll dann unabhängig hoch und runter? oder verstehe ich das falsch?
Wenn ich ihm aber zum Beispiel sage, dass numberOfRowsInSection 9 ist, und es NICHT vom Array abhängig mache, dann macht er keine Probleme. Das bestätigt doch das ganze oder?
Mein Code:
Quellcode
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return 15;//([pdfArray count]+4);//+ 4, damit der selektierte Wert auch immer oben bleibt! 4 zellen dienen als Platzhalter
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- static NSString *CellIdentifier = @"Cell";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
- }
- cell.textLabel.text = [pdfArray objectAtIndex:indexPath.row]; //ich meine das hier der Fehler ist !
- return cell;
- }
- - (void)customReloadTableDefault {
- int tempNumber = pdfNr - 1;
- [table selectRowAtIndexPath:[NSIndexPath indexPathForRow:tempNumber inSection:0] animated:YES scrollPosition:0];
- [table scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:tempNumber inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
- NSLog(@"pdfNr Selected Row: %i", pdfNr);//zuständig für die aktuelle selektion und positionierung der Auswahl
- }
sry für die vielen Fragen -.-
lernen, lernen, lernen