Skip to content

Instantly share code, notes, and snippets.

@hanfengs
Created July 27, 2022 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanfengs/7607e27eb902774e9f282ac53ddab8d0 to your computer and use it in GitHub Desktop.
Save hanfengs/7607e27eb902774e9f282ac53ddab8d0 to your computer and use it in GitHub Desktop.
[优惠券弹框]
/// 根据接口是否显示优惠券弹框
[self showCouponAlertView];
#pragma mark- 优惠弹框
- (void)showCouponAlertView {
UIView *contentView = [[UIView alloc] initWithFrame:CGRectZero];
contentView.backgroundColor = UIColorRed;
QMUIModalPresentationViewController *modalViewController = [[QMUIModalPresentationViewController alloc] init];
modalViewController.contentView = contentView;
modalViewController.modal = NO;
modalViewController.layoutBlock = ^(CGRect containerBounds, CGFloat keyboardHeight, CGRect contentViewDefaultFrame) {
CGFloat width = 270;
CGFloat height = 100;
contentView.qmui_frameApplyTransform = CGRectMake((CGRectGetWidth(containerBounds)-width)/2, (CGRectGetHeight(containerBounds)-height)/2, width, height);
};
[modalViewController showWithAnimated:YES completion:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment