0
我試圖使UIActionSheet
調用中的按鈕轉到其他視圖控制器。這是迄今爲止的代碼,它只是崩潰。我得到的錯誤信息是''Receiver()沒有標識符'Town'的延續''「UIActionSheet按鈕插入到新的ViewController中
- (IBAction)CategorizeButton:(id)sender {
UIActionSheet* AS = [[UIActionSheet alloc]initWithTitle:@"Group by"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Town",@"Title",@"Location", nil];
[AS showInView:self.view];
}
-(void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
[self performSegueWithIdentifier:@"Town" sender:self];
}
if (buttonIndex == 1)
{
[self performSegueWithIdentifier:@"Title" sender:self];
}
if (buttonIndex == 2)
{
[self performSegueWithIdentifier:@"Location" sender:self];
}
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSString* CategorizeTown = @"Town";
NSString* CategorizeTitle = @"Title";
NSString* CategorizeLocation = @"Location";
if ([[segue identifier] isEqualToString:CategorizeTown])
{
CategoryTableViewController* CAT = [segue destinationViewController];
// blah blah
}
if ([[segue identifier] isEqualToString:CategorizeTitle])
{
CategoryTableViewController* CAT = [segue destinationViewController];
// blah blah
}
if ([[segue identifier] isEqualToString:CategorizeLocation])
{
CategoryTableViewController* CAT = [segue destinationViewController];
// blah blah
}
}
提供有關崩潰的細節。包括哪一行導致崩潰以及完整且確切的錯誤消息。 – rmaddy
@rmaddy當它到達其中一個時,它會崩潰[self performSegueWithIdentifier:@「Town」sender:self]; –
您忘記添加有關錯誤消息的詳細信息。 – rmaddy