移动开发平台 mPaaS 二维码组件

By | 2021年4月23日
  • AUQRCodeView 为支持多选项按钮的 Alert 视图。
  • window 层级:self.windowLevel = UIWindowLevelAlert – 1

效果图

接口说明

  
  1. // 数据模型对象
  2. @interface QRDataModel : NSObject
  3. @property (nonatomic, strong) id topLeftIcon; // 可以传 image 或者 url 或者 cloudID
  4. @property (nonatomic, strong) NSString *topTitle; // 可以传 image 或者 url 或者 cloudID
  5. @property (nonatomic, strong) id qrCodeIcon; // 二维码图
  6. @property (nonatomic, strong) NSString *bottomTitle;
  7. @property (nonatomic, strong) NSString *bottomMessage;
  8. @property (nonatomic, strong) id actionButtonIcon; // 可以传 image 或者 url 或者 cloudID
  9. @property (nonatomic, strong) NSString *actionButtonTitle; // 底部行动按钮主文案
  10. @property (nonatomic, strong) NSString *actionButtonMessage; // 底部行动按钮辅助文案
  11. @end
  12. // 二维码底部行动按钮
  13. @interface QRActionButton : UIControl
  14. @end
  15. // 二维码组件
  16. @interface AUQRCodeView : UIView
  17. @property (nonatomic, strong) UIView *maskView;
  18. @property (nonatomic, strong) UIView *containerView; // 二维码容器
  19. @property (nonatomic, strong) UIImageView *topLeftImageView; // 左上角图片
  20. @property (nonatomic, strong) UILabel *topTitleLabel; // 顶部 title 描述文案
  21. @property (nonatomic, strong) UIImageView *qrCodeView; // 二维码图
  22. @property (nonatomic, strong) UILabel *bottomTitleLabel; // 底部主说明文案
  23. @property (nonatomic, strong) UILabel *bottomMessageLabel; // 底部辅助说明文案
  24. @property (nonatomic, strong) QRActionButton *actionButton; // 底部行为按钮
  25. // frame 即控件 frame; block 初始化数据模型
  26. - (instancetype)initWithFrame:(CGRect)frame model:(void(^)(QRDataModel *model))block;
  27. // 转菊花
  28. - (void)startLoading;
  29. // 停止菊花
  30. - (void)stopLoading;
  31. @end

代码示例

  • 标准样式
        
    1. AUQRCodeView *qrCodeView = [[AUQRCodeView alloc] initWithFrame:frame model:^(QRDataModel *model) {
    2. model.topLeftIcon = [UIImage imageWithColor:[UIColor colorWithRGB:0xbbbbbb] size:CGSizeMake(54, 54)];
    3. model.topTitle = @"生活号名称";
    4. model.bottomTitle = @"用支付宝二维码,关注生活号";
    5. model.bottomMessage = @"该二维码将在 2017 年 11 月 05 日失效";
    6. model.actionButtonTitle = @"保存到本地";
    7. }];
    8. [self.view addSubview:qrCodeView];

请关注公众号获取更多资料

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注