UIViewController+VLCAlert.m 1.5 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. @implementation UIViewController (UIViewController_VLCAlert)
  13. #if TARGET_OS_TV
  14. - (void)vlc_showAlertWithTitle:(NSString *)title message:(NSString *)message buttonTitle:(NSString *)buttonTitle
  15. {
  16. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
  17. [alertController addAction:[UIAlertAction actionWithTitle:buttonTitle style:UIAlertActionStyleDefault handler:nil]];
  18. [self presentViewController:alertController animated:YES completion:nil];
  19. }
  20. #else
  21. - (void)vlc_showAlertWithTitle:(NSString *)title message:(NSString *)message buttonTitle:(NSString *)buttonTitle
  22. {
  23. VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:title
  24. message:message
  25. delegate:self
  26. cancelButtonTitle:buttonTitle
  27. otherButtonTitles:nil];
  28. [alert show];
  29. }
  30. #endif
  31. @end