// // RAPortfolioInputDialog.m // iSales-UWAVER // // Created by Jack on 2018/8/20. // Copyright © 2018年 United Software Applications, Inc. All rights reserved. // #import "RAPortfolioInputDialog.h" #import "config.h" @interface RAPortfolioInputDialog () @property (nonatomic,strong) IBOutlet UILabel *titleLabel; @property (nonatomic,strong) IBOutlet UILabel *nameLabel; @property (nonatomic,strong) IBOutlet UILabel *noteLabel; @property (nonatomic,strong) IBOutlet UITextField *nameField; @property (nonatomic,strong) IBOutlet UITextField *noteField; @property (nonatomic,copy) void (^completion) (BOOL preview, NSString *name, NSString *note); @end @implementation RAPortfolioInputDialog + (instancetype)build { RAPortfolioInputDialog *dialog = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Portfolio" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPortfolioInputDialog"]; return dialog; } + (void)presentDialogBy:(UIViewController *)viewController withCompletion:(void(^)(BOOL preview, NSString *name, NSString *note))completion { if (viewController == nil) { return; } RAPortfolioInputDialog *dialog = [self build]; dialog.completion = completion; dialog.modalPresentationStyle = UIModalPresentationFormSheet; dialog.preferredContentSize = CGSizeMake(360, 230); [viewController presentViewController:dialog animated:YES completion:nil]; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. //#ifdef BUILD_UWAVER // // self.titleLabel.text = @"Create Hang Tag"; // self.nameLabel.text = @"Hang Tag Name:"; // self.noteLabel.text = @"Hang Tag Note:"; // //#else self.titleLabel.text = @"Create Portfolio"; self.nameLabel.text = @"Portfolio Name:"; self.noteLabel.text = @"Portfolio Note:"; //#endif } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (IBAction)cancelBtnClick:(id)sender { [self dismissViewControllerAnimated:YES completion:^{ if (self.completion) { self.completion(NO, nil, nil); } }]; } - (IBAction)previewBtnClick:(id)sender { NSString *name = self.nameField.text; NSString *note = self.noteField.text; [self dismissViewControllerAnimated:YES completion:^{ if (self.completion) { self.completion(YES, name, note); } }]; } @end