dkahgld

FMListPlaceholder.m 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // FMListPlaceholder.m
  3. // FMListPlaceholderExample
  4. //
  5. // Created by Mingo on 2018/8/9.
  6. // Copyright © 2017年 袁凤鸣. All rights reserved.
  7. // 项目地址:https://github.com/yfming93/FMListPlaceholder
  8. // 作者博客:https://www.yfmingo.cn
  9. //
  10. #import "FMListPlaceholder.h"
  11. static id _sharedInstance = nil;
  12. @interface FMListPlaceholder()<NSCopying,NSMutableCopying>
  13. @end
  14. @implementation FMListPlaceholder
  15. +(instancetype)allocWithZone:(struct _NSZone *)zone
  16. {
  17. static dispatch_once_t onceToken;
  18. dispatch_once(&onceToken, ^{
  19. _sharedInstance = [super allocWithZone:zone];
  20. });
  21. return _sharedInstance;
  22. }
  23. +(instancetype)sharedInstance {
  24. return [[self alloc]init];
  25. }
  26. - (id)copyWithZone:(NSZone *)zone {
  27. return _sharedInstance;
  28. }
  29. - (id)mutableCopyWithZone:(NSZone *)zone {
  30. return _sharedInstance;
  31. }
  32. + (void)fm_defaultBackgroundColor:(UIColor *)backgroundColor coverName:(NSString *)coverName tips:(NSString *)tips tipsTextColor:(UIColor *)tipsTextColor tipsFont:(UIFont *)tipsFont coverSize:(CGSize)coverSize coverCenterYOffset:(CGFloat)coverCenterYOffset coverSpaceToTips:(CGFloat)coverSpaceToTips {
  33. if (backgroundColor) {
  34. FMListPlaceholder.sharedInstance.defaultBackgroundColor = backgroundColor;
  35. }
  36. if (coverName) {
  37. FMListPlaceholder.sharedInstance.defaultCoverName = coverName;
  38. }
  39. if (tips) {
  40. FMListPlaceholder.sharedInstance.defaultTips = tips;
  41. }
  42. if (tipsTextColor) {
  43. FMListPlaceholder.sharedInstance.defaultTipsTextColor = tipsTextColor;
  44. }
  45. if (tipsFont) {
  46. FMListPlaceholder.sharedInstance.defaultTipsFont = tipsFont;
  47. }
  48. if (coverSize.width) {
  49. FMListPlaceholder.sharedInstance.defaultCoverSize = coverSize;
  50. }
  51. FMListPlaceholder.sharedInstance.coverCenterYOffset = coverCenterYOffset;
  52. FMListPlaceholder.sharedInstance.coverSpaceToTips = coverSpaceToTips;
  53. }
  54. @end