BaseTableViewController.m 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. //
  2. // BaseTableViewController.m
  3. // IBOSS
  4. //
  5. // Created by iHope on 14-7-7.
  6. // Copyright (c) 2014年 elongtian. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "BaseTableViewController.h"
  10. @interface BaseTableViewController ()
  11. @end
  12. @implementation BaseTableViewController
  13. @synthesize hud;
  14. /**
  15. 初始化
  16. @param style <#style description#>
  17. @return <#return value description#>
  18. */
  19. - (id)initWithStyle:(UITableViewStyle)style
  20. {
  21. self = [super initWithStyle:style];
  22. if (self) {
  23. // Custom initialization
  24. }
  25. return self;
  26. }
  27. /**
  28. 进度条
  29. @param text <#text description#>
  30. */
  31. -(void)showLoadingText:(NSString*)text
  32. {
  33. //如果设置此属性则当前的view置于后台
  34. hud.dimBackground = YES;
  35. //设置对话框文字
  36. hud.labelText = text;
  37. [hud show:YES];
  38. }
  39. /**
  40. 弹出窗体对话框
  41. @param text <#text description#>
  42. */
  43. - (void)showAlertViewBackText:(NSString *)text{
  44. }
  45. /**
  46. 加载进度条
  47. */
  48. -(void)showLoading
  49. {
  50. //如果设置此属性则当前的view置于后台
  51. hud.dimBackground = YES;
  52. //设置对话框文字
  53. hud.labelText = @"正在加载";
  54. /* //显示对话框
  55. [ hud showAnimated:YES whileExecutingBlock:^{
  56. //对话框显示时需要执行的操作
  57. } completionBlock:^{}];
  58. */
  59. [hud show:YES];
  60. }
  61. /**
  62. 隐藏进度条
  63. */
  64. -(void) hideLoading
  65. {
  66. [hud hide:YES];
  67. // [hud removeFromSuperview];
  68. // self.hud=nil;
  69. }
  70. /**
  71. 弹出对话框
  72. @param text <#text description#>
  73. */
  74. -(void)showAlertViewText:(NSString *)text
  75. {
  76. // UIAlertController代替UIAlertView
  77. UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:text preferredStyle:UIAlertControllerStyleAlert ];
  78. [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
  79. }]];
  80. // 3.显示alertController:presentViewController
  81. [self presentViewController:alert animated:YES completion:nil];
  82. }
  83. /**
  84. viewDidLoad
  85. */
  86. - (void)viewDidLoad
  87. {
  88. [super viewDidLoad];
  89. hud = [[MBProgressHUD alloc] initWithView:self.view] ;
  90. [self.view addSubview:hud];
  91. }
  92. /**
  93. md5加密
  94. @param str <#str description#>
  95. @return <#return value description#>
  96. */
  97. - (NSString *) md5:(NSString *)str
  98. {
  99. const char *cStr = [str UTF8String];
  100. unsigned char result[16];
  101. CC_MD5( cStr, (CC_LONG)strlen(cStr), result );
  102. return [NSString stringWithFormat:@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
  103. result[0], result[1], result[2], result[3],
  104. result[4], result[5], result[6], result[7],
  105. result[8], result[9], result[10], result[11],
  106. result[12], result[13], result[14], result[15]
  107. ];
  108. }
  109. /**
  110. didReceiveMemoryWarning
  111. */
  112. - (void)didReceiveMemoryWarning
  113. {
  114. [super didReceiveMemoryWarning];
  115. }
  116. #pragma mark - Table view data source
  117. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  118. {
  119. return 0;
  120. }
  121. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  122. {
  123. // Return the number of rows in the section.
  124. return 0;
  125. }
  126. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  127. {
  128. static NSString *CellIdentifier = @"Cell";
  129. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  130. return cell;
  131. }
  132. @end