VLCAlertView.m 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*****************************************************************************
  2. * VLCStatusLabel.m
  3. * VLC for iOS
  4. *****************************************************************************
  5. * Copyright (c) 2014 VideoLAN. All rights reserved.
  6. * $Id$
  7. *
  8. * Authors: Carola Nitz <nitz.carola # googlemail.com>
  9. *
  10. * Refer to the COPYING file of the official project for license.
  11. *****************************************************************************/
  12. #import "VLCAlertView.h"
  13. @interface VLCAlertView () <UIAlertViewDelegate>
  14. @end
  15. // via http://stackoverflow.com/a/10082549/928646
  16. @implementation VLCAlertView
  17. - (id)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles {
  18. self = [self initWithTitle:title message:message delegate:self cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil];
  19. if (self) {
  20. for (NSString *buttonTitle in otherButtonTitles) {
  21. [self addButtonWithTitle:buttonTitle];
  22. }
  23. }
  24. return self;
  25. }
  26. - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
  27. if (self.completion) {
  28. self.completion(buttonIndex == self.cancelButtonIndex, buttonIndex);
  29. self.completion = nil;
  30. }
  31. }
  32. @end