12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- //
- // ShowPhotoCameraAlertView.m
- // smartRhino
- //
- // Created by armin on 2019/11/1.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "ShowPhotoCameraAlertView.h"
- @interface ShowPhotoCameraAlertView ()
- @property (copy, nonatomic) void(^confirmBlock)(ShowPhotoCameraType type);
- @property (copy, nonatomic) void(^cancelBlock)(void);
- @property (strong,nonatomic) IBOutlet NSLayoutConstraint *bottomH;
- @end
- @implementation ShowPhotoCameraAlertView
- static UINib *ViewNib = nil;
- + (instancetype)selectView{
- if (ViewNib == nil) {
- ViewNib = [UINib nibWithNibName:@"ShowPhotoCameraAlertView" bundle:nil];
- }
- ShowPhotoCameraAlertView *alert = [[ViewNib instantiateWithOwner:nil options:nil] lastObject];
- return alert;
- }
- /**
- * 弹出选择照片/相机alert
- */
- +(instancetype)initShowPhotoCameraAlertViewConfirm:(void(^)(ShowPhotoCameraType type))confirmBlock
- cancle:(void(^)(void))cancleBlock{
- ShowPhotoCameraAlertView *alert = [self selectView];
- [alert setFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
-
- alert.bottomH.constant = 143 + kiphoneXBootomHeight;
-
- [alert setStatusBarStyle:UIStatusBarStyleDefault];
- [alert setGesture:YES];
- [alert setConfirmBlock:confirmBlock];
- [alert setCancelBlock:cancleBlock];
- return alert;
- }
- -(IBAction)userDidBackClickAction:(id)sender{
- [self dismissWithAnimation:kAlertAnimationBottom];
- if(self.cancelBlock){
- self.cancelBlock();
- }
- }
- -(IBAction)userDidPhotoClickAction:(id)sender{
- [self dismissWithAnimation:kAlertAnimationBottom];
- if(self.confirmBlock){
- self.confirmBlock(ShowPhotoCameraType1);
- }
- }
- -(IBAction)userDidCameraClickAction:(id)sender{
- [self dismissWithAnimation:kAlertAnimationBottom];
- if(self.confirmBlock){
- self.confirmBlock(ShowPhotoCameraType2);
- }
- }
- @end
|