0
У меня есть лист действий, который, когда один из его вариантов щелкнул успешно, вызывает clickedButtonAtIndex при запуске в симуляторе, но при тестировании на iPhone (5 в Xcode 6) он не достичь обратного вызова.iOS UIActionSheet callback работает в симуляторе, но не на телефоне
Заголовок ...
@protocol SGETriggerToolBarDelegate
-(void)showCustomEditView;
@end
@interface SGETriggerToolBarController : UIViewController <UIActionSheetDelegate>
@property (nonatomic, assign) id <SGETriggerToolBarDelegate> delegate;
@property (nonatomic, strong) UIToolbar *toolbar;
в реализации ...
// in xController.m
// ...
- (void)triggerButtonHandler
{
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Select an event type"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
for (SGETrigger *trigger in triggers) {
[actionSheet addButtonWithTitle:trigger.name];
}
[actionSheet addButtonWithTitle:@"Cancel"];
actionSheet.cancelButtonIndex = triggers.count;
[actionSheet showFromToolbar:self.toolbar];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == [actionSheet cancelButtonIndex]) {
return;
} else {
selectedTrigger = triggers[buttonIndex];
triggerButton.title = [NSString stringWithFormat:@"• %@ •", selectedTrigger.name];
[delegate showCustomEditView];
}
}
// ...
FYI - объединить две строки кнопок «Отмена»: 'actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle: @" Cancel "];'. – rmaddy