2010-12-09 1 views
0

Ceci est une question délicate sur laquelle je travaille depuis un moment. J'ai une feuille d'action qui apparaît dans une vue avec une barre d'onglets, parfois quand je rejette la feuille d'action, il est "attrapé" dans la barre d'onglets et je ne peux rien faire.L'application ne plante pas parce que si je le minimise revenir en elle est dimissed, il semble juste que le comportement modal n'est pas rejeté correctement.Fiche d'action se coincer sur la barre d'onglets

J'ai récemment changé la façon dont la feuille d'action est affichée de "showInView" à "showFromTabBar" et je ne suis pas sûr si cela crée le problème.

Merci, William

Edit:

est sous le code que j'utilise pour rejeter mon actionsheet:

-(void)doneButtonPressed:(id)sender{ 



    if ([[self viewWithTag:1] isKindOfClass:[PickerView class]]) { 

     PickerView *picker = (PickerView *)[self viewWithTag:1]; 

     if (picker.selectedRow == nil) { 
      [picker populateSelectRowForRow:0 andComponent:0]; 
     } 

     NSNotification *note = [NSNotification notificationWithName:@"doneButtonPressed" object:self.indexPath userInfo:picker.selectedRow]; 

     [[NSNotificationCenter defaultCenter] postNotification:note]; 

    }else { 

     DatePickerView *picker = (DatePickerView *)[self viewWithTag:1]; 

     NSDictionary *extraInfo = [[NSDictionary alloc] initWithObjects:[[NSArray alloc] initWithObjects:[self formatDateToString:[picker date]], nil] forKeys:[[NSArray alloc] initWithObjects:@"value", nil]]; 

     NSNotification *note = [NSNotification notificationWithName:@"doneButtonPressed" object:self.indexPath userInfo:extraInfo]; 

     [[NSNotificationCenter defaultCenter] postNotification:note]; 
    } 


    [self dismissWithClickedButtonIndex:0 animated:YES]; 
} 

et la méthode de notification qui est appelée:

-(void)pickerUpdate:(NSNotification *)note{ 

    NSIndexPath *indexPath = [note object]; 
    NSDictionary *extraInfo = [note userInfo]; 

    NSDictionary *dict = [[tableController.sectionAndFields objectAtIndex:indexPath.section] objectAtIndex:(indexPath.row + kHeaderAndFooterOffset)]; 

    [tableController.formDetails setObject:[extraInfo objectForKey:@"value"] forKey:[dict objectForKey:@"key"]]; 

    NSArray *reloadArray = [[NSArray alloc] initWithObjects:indexPath, nil]; 
    [indexPath release]; 

    [self.tv reloadRowsAtIndexPaths:reloadArray withRowAnimation:NO]; 
    [reloadArray release]; 


} 
+0

Pouvez-vous s'il vous plaît inclure un code/une capture d'écran pour aider à visualiser votre problème? –

+0

Pouvez-vous s'il vous plaît poster le code où vous montrez et rejeter la feuille d'action? – Ryan

+0

le second paramètre de '-reloadRowsAtIndexPaths: withRowAnimation:' n'est pas un 'BOOL'; c'est un type 'UITableViewRowAnimation' – user102008

Répondre

0

J'ai réussi à résoudre ce problème, mais il se sent très m ette comme un hack, j'ai introduit un retard dans le code à l'aide:

[self performSelector:@selector(dismissFromActionSheet) withObject:nil afterDelay:0.2]; 

Avec dismissFromActionSheet étant:

-(void)dismissFromActionSheet{ 
[self dismissWithClickedButtonIndex:0 animated:YES]; 
} 
Questions connexes