İptal düğmesinin bir UIActionSheet'e basıldığını nasıl belirleyebilirim?İptal Düğmesi ve UIActionSheet ile İlgili Sorunlar
Benim UIActionSheet böyle kurulur:
-(IBAction)fileButtonPressed
{
UIActionSheet *mymenu = [[UIActionSheet alloc]
initWithTitle:@"Select Folder"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:nil];
for (i=0; i<3; i++)
{
[mymenu addButtonWithTitle:@"Button Name"];
}
[mymenu showInView:self.view];
}
Ben iptal düğmesi ve seçilen ilk düğmeye ayırt edemez ki var bir sorun.
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *option = [actionSheet buttonTitleAtIndex:buttonIndex];
//buttonIndex == 0 if the cancel button is pressed or
//if the first item is pressed.
}
Bunu kurmanın daha iyi bir yolu var mı?
Harika, Harika, Teşekkürler – shannoga
UIActionSheet, iOS'un en ürkütücü kod parçası olmalı – bugfixr