BaseVC.m 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // BaseVC.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/4/6.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "BaseVC.h"
  9. @interface BaseVC ()
  10. @end
  11. @implementation BaseVC
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. self.navigationController.navigationBar.translucent = NO;
  15. self.view.backgroundColor = KBackGroundColor;
  16. [self goBackByNavigation];
  17. }
  18. - (void)didReceiveMemoryWarning {
  19. [super didReceiveMemoryWarning];
  20. // Dispose of any resources that can be recreated.
  21. }
  22. #pragma mark 弹出框提示
  23. - (void)showMsgByAlertVCWithString:(NSString *)str{
  24. [RQ_SHARE_FUNCTION showAlertWithTitle:nil message:str alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"确定" otherButtonTitles:nil otherButtonStyles:nil completion:nil];
  25. }
  26. #pragma mark 获取数据
  27. -(void)getDataWithDic:(NSMutableDictionary *)mdic method:(NSString *)method block:(Block)block{
  28. //判断网络是否连接
  29. if (![NetManager connectedToNetWork]) {
  30. showMsgUnconnect();
  31. return;
  32. }
  33. [NetManager requestAnythingWithURL:method dictionary:mdic dataArray:nil completion:^(NSDictionary *root) {
  34. if (!root) {
  35. ShowMsg(@"数据请求失败,请重试");
  36. return;
  37. }
  38. if ([root[@"code"] integerValue] == 1) {
  39. ShowMsg(root[@"msg"]);
  40. return;
  41. }
  42. if (block) {
  43. block(root);
  44. }
  45. }];
  46. }
  47. /*
  48. #pragma mark - Navigation
  49. // In a storyboard-based application, you will often want to do a little preparation before navigation
  50. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  51. // Get the new view controller using [segue destinationViewController].
  52. // Pass the selected object to the new view controller.
  53. }
  54. */
  55. @end