THLabel.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. // THLabel.h
  3. //
  4. // Version 1.4.8
  5. //
  6. // Created by Tobias Hagemann on 11/25/12.
  7. // Copyright (c) 2012-2016 tobiha.de. All rights reserved.
  8. //
  9. // Original source and inspiration from:
  10. // FXLabel by Nick Lockwood,
  11. // https://github.com/nicklockwood/FXLabel
  12. // KSLabel by Kai Schweiger,
  13. // https://github.com/vigorouscoding/KSLabel
  14. // GTMFadeTruncatingLabel by Google,
  15. // https://github.com/google/google-toolbox-for-mac/tree/master/iPhone
  16. //
  17. // Big thanks to Jason Miller for showing me sample code of his implementation
  18. // using Core Text! It inspired me to dig deeper and move away from drawing
  19. // with NSAttributedString on iOS 7, which caused a lot of problems.
  20. //
  21. // Distributed under the permissive zlib license
  22. // Get the latest version from here:
  23. //
  24. // https://github.com/tobihagemann/THLabel
  25. //
  26. // This software is provided 'as-is', without any express or implied
  27. // warranty. In no event will the authors be held liable for any damages
  28. // arising from the use of this software.
  29. //
  30. // Permission is granted to anyone to use this software for any purpose,
  31. // including commercial applications, and to alter it and redistribute it
  32. // freely, subject to the following restrictions:
  33. //
  34. // 1. The origin of this software must not be misrepresented; you must not
  35. // claim that you wrote the original software. If you use this software
  36. // in a product, an acknowledgment in the product documentation would be
  37. // appreciated but is not required.
  38. //
  39. // 2. Altered source versions must be plainly marked as such, and must not be
  40. // misrepresented as being the original software.
  41. //
  42. // 3. This notice may not be removed or altered from any source distribution.
  43. //
  44. #import <UIKit/UIKit.h>
  45. //! Project version number for THLabel.
  46. FOUNDATION_EXPORT double THLabelVersionNumber;
  47. //! Project version string for THLabel.
  48. FOUNDATION_EXPORT const unsigned char THLabelVersionString[];
  49. // In this header, you should import all the public headers of your framework using statements like #import <THLabel/PublicHeader.h>
  50. typedef NS_ENUM(NSInteger, THLabelStrokePosition) {
  51. THLabelStrokePositionOutside,
  52. THLabelStrokePositionCenter,
  53. THLabelStrokePositionInside
  54. };
  55. typedef NS_OPTIONS(NSUInteger, THLabelFadeTruncatingMode) {
  56. THLabelFadeTruncatingModeNone = 0,
  57. THLabelFadeTruncatingModeTail = 1 << 0,
  58. THLabelFadeTruncatingModeHead = 1 << 1,
  59. THLabelFadeTruncatingModeHeadAndTail = THLabelFadeTruncatingModeHead | THLabelFadeTruncatingModeTail
  60. };
  61. @interface THLabel : UILabel
  62. @property (nonatomic, assign) CGFloat letterSpacing;
  63. @property (nonatomic, assign) CGFloat lineSpacing;
  64. @property (nonatomic, assign) CGFloat shadowBlur;
  65. @property (nonatomic, assign) CGFloat innerShadowBlur;
  66. @property (nonatomic, assign) CGSize innerShadowOffset;
  67. @property (nonatomic, strong) UIColor *innerShadowColor;
  68. @property (nonatomic, assign) CGFloat strokeSize;
  69. @property (nonatomic, strong) UIColor *strokeColor;
  70. @property (nonatomic, assign) THLabelStrokePosition strokePosition;
  71. @property (nonatomic, strong) UIColor *gradientStartColor;
  72. @property (nonatomic, strong) UIColor *gradientEndColor;
  73. @property (nonatomic, copy) NSArray *gradientColors;
  74. @property (nonatomic, assign) CGPoint gradientStartPoint;
  75. @property (nonatomic, assign) CGPoint gradientEndPoint;
  76. @property (nonatomic, assign) THLabelFadeTruncatingMode fadeTruncatingMode;
  77. @property (nonatomic, assign) UIEdgeInsets textInsets;
  78. @property (nonatomic, assign) BOOL automaticallyAdjustTextInsets;
  79. @end