RAPortfolioInputDialog.m 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // RAPortfolioInputDialog.m
  3. // iSales-UWAVER
  4. //
  5. // Created by Jack on 2018/8/20.
  6. // Copyright © 2018年 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "RAPortfolioInputDialog.h"
  9. #import "config.h"
  10. @interface RAPortfolioInputDialog ()
  11. @property (nonatomic,strong) IBOutlet UILabel *titleLabel;
  12. @property (nonatomic,strong) IBOutlet UILabel *nameLabel;
  13. @property (nonatomic,strong) IBOutlet UILabel *noteLabel;
  14. @property (nonatomic,strong) IBOutlet UITextField *nameField;
  15. @property (nonatomic,strong) IBOutlet UITextField *noteField;
  16. @property (nonatomic,copy) void (^completion) (BOOL preview, NSString *name, NSString *note);
  17. @end
  18. @implementation RAPortfolioInputDialog
  19. + (instancetype)build {
  20. RAPortfolioInputDialog *dialog = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Portfolio" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPortfolioInputDialog"];
  21. return dialog;
  22. }
  23. + (void)presentDialogBy:(UIViewController *)viewController withCompletion:(void(^)(BOOL preview, NSString *name, NSString *note))completion {
  24. if (viewController == nil) {
  25. return;
  26. }
  27. RAPortfolioInputDialog *dialog = [self build];
  28. dialog.completion = completion;
  29. dialog.modalPresentationStyle = UIModalPresentationFormSheet;
  30. dialog.preferredContentSize = CGSizeMake(360, 230);
  31. [viewController presentViewController:dialog animated:YES completion:nil];
  32. }
  33. - (void)viewDidLoad {
  34. [super viewDidLoad];
  35. // Do any additional setup after loading the view.
  36. //#ifdef BUILD_UWAVER
  37. //
  38. // self.titleLabel.text = @"Create Hang Tag";
  39. // self.nameLabel.text = @"Hang Tag Name:";
  40. // self.noteLabel.text = @"Hang Tag Note:";
  41. //
  42. //#else
  43. self.titleLabel.text = @"Create Portfolio";
  44. self.nameLabel.text = @"Portfolio Name:";
  45. self.noteLabel.text = @"Portfolio Note:";
  46. //#endif
  47. }
  48. - (void)didReceiveMemoryWarning {
  49. [super didReceiveMemoryWarning];
  50. // Dispose of any resources that can be recreated.
  51. }
  52. - (IBAction)cancelBtnClick:(id)sender {
  53. [self dismissViewControllerAnimated:YES completion:^{
  54. if (self.completion) {
  55. self.completion(NO, nil, nil);
  56. }
  57. }];
  58. }
  59. - (IBAction)previewBtnClick:(id)sender {
  60. NSString *name = self.nameField.text;
  61. NSString *note = self.noteField.text;
  62. [self dismissViewControllerAnimated:YES completion:^{
  63. if (self.completion) {
  64. self.completion(YES, name, note);
  65. }
  66. }];
  67. }
  68. @end