UIViewController+VLCAlert.m 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*****************************************************************************
  2. * VLC for iOS
  3. *****************************************************************************
  4. * Copyright (c) 2015 VideoLAN. All rights reserved.
  5. * $Id$
  6. *
  7. * Authors: Tobias Conradi <videolan # tobias-conradi.de>
  8. *
  9. * Refer to the COPYING file of the official project for license.
  10. *****************************************************************************/
  11. #import "UIViewController+VLCAlert.h"
  12. #import "VLC_iOS-Swift.h"
  13. @implementation UIViewController (UIViewController_VLCAlert)
  14. #if TARGET_OS_TV
  15. - (void)vlc_showAlertWithTitle:(NSString *)title message:(NSString *)message buttonTitle:(NSString *)buttonTitle
  16. {
  17. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
  18. [alertController addAction:[UIAlertAction actionWithTitle:buttonTitle style:UIAlertActionStyleDefault handler:nil]];
  19. [self presentViewController:alertController animated:YES completion:nil];
  20. }
  21. #else
  22. - (void)vlc_showAlertWithTitle:(NSString *)title message:(NSString *)message buttonTitle:(NSString *)buttonTitle
  23. {
  24. NSArray<VLCAlertButton *> *buttonsAction = @[[[VLCAlertButton alloc] initWithTitle: buttonTitle
  25. action: nil]];
  26. [VLCAlertViewController alertViewManagerWithTitle:title
  27. errorMessage:message
  28. viewController:self
  29. buttonsAction:buttonsAction];
  30. }
  31. #endif
  32. @end