RAEditRequiredAlert.m 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // RAEditRequiredAlert.m
  3. // Apex And Drivers
  4. //
  5. // Created by Jack on 2018/9/6.
  6. // Copyright © 2018年 USAI. All rights reserved.
  7. //
  8. #import "RAEditRequiredAlert.h"
  9. @interface RAEditRequiredAlert ()
  10. @property (strong, nonatomic) IBOutlet UILabel *titleLabel;
  11. @property (strong, nonatomic) IBOutlet UILabel *msgLabel;
  12. @property (nonatomic,copy) NSString *alertTitle;
  13. @property (nonatomic,copy) NSString *alertMessage;
  14. @end
  15. @implementation RAEditRequiredAlert
  16. + (instancetype)alertWithTile:(NSString *)title message:(NSString *)msg {
  17. RAEditRequiredAlert *alertVC = [[UIStoryboard storyboardWithName:@"Edit" bundle:nil] instantiateViewControllerWithIdentifier:NSStringFromClass(self)];
  18. alertVC.alertTitle = title;
  19. alertVC.alertMessage = msg;
  20. return alertVC;
  21. }
  22. - (void)viewDidLoad {
  23. [super viewDidLoad];
  24. // Do any additional setup after loading the view.
  25. self.titleLabel.text = self.alertTitle;
  26. [self.titleLabel sizeToFit];
  27. self.msgLabel.text = self.alertMessage;
  28. [self.msgLabel sizeToFit];
  29. CGFloat h = CGRectGetHeight(self.titleLabel.bounds) + CGRectGetHeight(self.msgLabel.bounds) + 60.0f;
  30. CGFloat w = 300.0f;
  31. self.preferredContentSize = CGSizeMake(w, h);
  32. }
  33. - (void)didReceiveMemoryWarning {
  34. [super didReceiveMemoryWarning];
  35. // Dispose of any resources that can be recreated.
  36. }
  37. - (IBAction)okBtnClick:(id)sender {
  38. [self dismissViewControllerAnimated:YES completion:nil];
  39. }
  40. @end