ZZItemInfoController.m 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // ZZItemInfoController.m
  3. // ZZUIKit_Example
  4. //
  5. // Created by Max on 2021/1/19.
  6. // Copyright © 2021 bymiracles@163.com. All rights reserved.
  7. //
  8. #import "ZZItemInfoController.h"
  9. #import <ZZUIKit/ZZUIKitEx.h>
  10. #import <ZZUIKit/ZZInfoItem.h>
  11. #import <Masonry/Masonry.h>
  12. @interface ZZItemInfoController ()
  13. @property (weak, nonatomic) IBOutlet UISwitch *switch1;
  14. @end
  15. @implementation ZZItemInfoController
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. //frame
  19. ZZInfoItem *item = [[ZZInfoItem alloc] initWithFrame:CGRectMake(50, NAV_STATUS_BAR_H() + 100,SCREEN_W()-100, 300)];
  20. item.subItems = @[
  21. @{
  22. ZZTitleKey:@"你好啊",
  23. ZZBgcKey:@"#1FDCA1",
  24. ZZCornerRadius:@"4.5",
  25. ZZPadding:@"7.5/2.5/7.5/2.5",
  26. },
  27. @{
  28. ZZTitleKey:@"你好啊!",
  29. ZZBgcKey:@"#1FDCA1",
  30. ZZCornerRadius:@"4.5",
  31. ZZPadding:@"7.5/2.5/7.5/2.5",
  32. },
  33. @{
  34. ZZTitleKey:@"李银河2!",
  35. ZZBgcKey:@"#1FDCA1",
  36. ZZCornerRadius:@"4.5",
  37. ZZPadding:@"7.5/2.5/7.5/2.5",
  38. },
  39. @{
  40. ZZTitleKey:@"李银河3!",
  41. ZZBgcKey:@"#1FDCA1",
  42. ZZCornerRadius:@"4.5",
  43. ZZPadding:@"7.5/2.5/7.5/2.5",
  44. },
  45. @{
  46. ZZTitleKey:@"李银河4!",
  47. ZZBgcKey:@"#1FDCA1",
  48. ZZCornerRadius:@"4.5",
  49. ZZPadding:@"7.5/2.5/7.5/2.5",
  50. },
  51. ];
  52. item.title.text = @"穿越银河";
  53. item.subtitle.text = @"2021";
  54. [self.view addSubview:item];
  55. [item layoutIfNeeded];
  56. _switch1.zz_origin = CGPointMake(item.zz_x, item.zz_bottom);
  57. // masonry混用
  58. UIView *bgView = [[UIView alloc] init];
  59. bgView.backgroundColor = zz_RGBHex(0xff00ff);
  60. [self.view insertSubview:bgView atIndex:0];
  61. [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.edges.mas_equalTo(item).insets(UIEdgeInsetsMake(-10, -10, -10, -10));
  63. }];
  64. }
  65. @end