LCActionSheetConfig.m 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // LCActionSheetConfig.m
  3. // LCActionSheet
  4. //
  5. // Created by Leo on 2016/11/29.
  6. //
  7. // Copyright (c) 2015-2017 Leo <leodaxia@gmail.com>
  8. //
  9. // Permission is hereby granted, free of charge, to any person obtaining a copy
  10. // of this software and associated documentation files (the "Software"), to deal
  11. // in the Software without restriction, including without limitation the rights
  12. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. // copies of the Software, and to permit persons to whom the Software is
  14. // furnished to do so, subject to the following conditions:
  15. //
  16. // The above copyright notice and this permission notice shall be included in all
  17. // copies or substantial portions of the Software.
  18. //
  19. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  25. // SOFTWARE.
  26. #import "LCActionSheetConfig.h"
  27. #define LC_ACTION_SHEET_BUTTON_HEIGHT 49.0f
  28. #define LC_ACTION_SHEET_RED_COLOR LC_ACTION_SHEET_COLOR(254, 67, 37)
  29. #define LC_ACTION_SHEET_TITLE_FONT [UIFont systemFontOfSize:14.0f]
  30. #define LC_ACTION_SHEET_BUTTON_FONT [UIFont systemFontOfSize:18.0f]
  31. #define LC_ACTION_SHEET_ANIMATION_DURATION 0.3f
  32. #define LC_ACTION_SHEET_DARK_OPACITY 0.3f
  33. @implementation LCActionSheetConfig
  34. + (LCActionSheetConfig *)config {
  35. static id _config = nil;
  36. static dispatch_once_t onceToken;
  37. dispatch_once(&onceToken, ^{
  38. _config = [[self alloc] initSharedInstance];
  39. });
  40. return _config;
  41. }
  42. + (instancetype)shared {
  43. return self.config;
  44. }
  45. - (instancetype)initSharedInstance {
  46. if (self = [super init]) {
  47. self.titleFont = LC_ACTION_SHEET_TITLE_FONT;
  48. self.buttonFont = LC_ACTION_SHEET_BUTTON_FONT;
  49. self.destructiveButtonColor = LC_ACTION_SHEET_RED_COLOR;
  50. self.titleColor = LC_ACTION_SHEET_COLOR(111, 111, 111);
  51. self.buttonColor = [UIColor blackColor];
  52. self.buttonHeight = LC_ACTION_SHEET_BUTTON_HEIGHT;
  53. self.animationDuration = LC_ACTION_SHEET_ANIMATION_DURATION;
  54. self.darkOpacity = LC_ACTION_SHEET_DARK_OPACITY;
  55. self.titleEdgeInsets = UIEdgeInsetsMake(15.0f, 15.0f, 15.0f, 15.0f);
  56. self.separatorColor = LC_ACTION_SHEET_COLOR_A(150, 150, 150, 0.3f);
  57. }
  58. return self;
  59. }
  60. - (instancetype)init {
  61. return LCActionSheetConfig.config;
  62. }
  63. - (NSInteger)cancelButtonIndex {
  64. return 0;
  65. }
  66. @end