UICustomActionSheet不调用委托方法来处理事件

时间:2016-07-29 10:10:42

标签: ios xcode uiactionsheet uiactionsheetdelegate

我在我的代码中使用this示例。它现在工作得很好但是当我点击一个按钮时它没有响应或调用任何方法。这是我的代码:

UICustomActionSheet* customActionSheet = [[UICustomActionSheet alloc] initWithTitle:nil delegate:nil buttonTitles:@[@"Cancel",@"Delete picture", @"Take a new photo", @"Choose from existing"]];
    [customActionSheet setButtonColors:@[[UIColor redColor]]];
    [customActionSheet setBackgroundColor:[UIColor clearColor]];
    [customActionSheet setSubtitle:@"Select your Choice"];
    [customActionSheet setSubtitleColor:[UIColor whiteColor]];
    [customActionSheet showInView:self.view];

这里是需要调用的方法

-(void)customActionSheet:(UICustomActionSheet *)customActionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
    NSLog(@"%d",buttonIndex);
}

1 个答案:

答案 0 :(得分:0)

问题在于委托。您已将其设置为$list = WatchlistModel::whereHas('show', function ($query) { $query->orderBy('title', 'asc'); })->where('user_id', $slug)->get(); 。将其设置为nil,您的问题就会得到解决。