JXSettingsViewController.m 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028
  1. //
  2. // JXSettingsViewController.m
  3. // shiku_im
  4. //
  5. // Created by Apple on 16/5/6.
  6. // Copyright © 2016年 Reese. All rights reserved.
  7. //
  8. #import "JXSettingsViewController.h"
  9. #import "UIImage+Tint.h"
  10. #import "loginVC.h"
  11. #import "JXMoreSelectVC.h"
  12. #import "JXActionSheetVC.h"
  13. #define HEIGHT 50
  14. typedef enum : NSUInteger {
  15. Type_chatRecordTimeOut = 1,
  16. Type_chatSyncTimeLen,
  17. Type_groupChatSyncTimeLen,
  18. } PickerViewType;
  19. @interface JXSettingsViewController ()<UIAlertViewDelegate, UIPickerViewDelegate,JXMoreSelectVCDelegate,JXActionSheetVCDelegate>{
  20. ATMHud* _wait;
  21. }
  22. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *topCon;
  23. @property (nonatomic, strong) UILabel *timeOutLabel;
  24. @property (nonatomic, strong) UILabel *syncTimeLenLabel;
  25. @property (nonatomic, strong) UILabel *groupSyncTimeLenLabel;
  26. @property (nonatomic, strong) UIView *selectView;
  27. @property (nonatomic, strong) UIPickerView *pickerView;
  28. @property (nonatomic, strong) NSArray *pickerArr;
  29. @property (nonatomic, assign) PickerViewType selType;
  30. @property (nonatomic, strong) JXMoreSelectVC *moreVC;
  31. @property (nonatomic, strong) NSString *indexStr;
  32. @property (nonatomic, strong) UILabel *addMeTypeLab;
  33. @property (nonatomic, strong) UILabel *seeTimeTypeLab;
  34. @property (nonatomic, strong) UILabel *seeNumTypeLab;
  35. @property (nonatomic, strong) NSArray *loginTimeArr;
  36. @property (nonatomic, assign) BOOL isShowNum;
  37. @end
  38. @implementation JXSettingsViewController
  39. - (void)viewDidLoad {
  40. [super viewDidLoad];
  41. self.view.frame = CGRectMake(JX_SCREEN_WIDTH, 0, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT);
  42. [self createHeaderView];
  43. self.topCon.constant = JX_SCREEN_TOP;
  44. //self.view.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT);
  45. // self.dataSorce = [[NSDictionary alloc]init];
  46. // [self getData];
  47. //获取服务器的好友状态
  48. [self changeSettingsNum];
  49. _pickerArr = @[Localized(@"JX_OutOfSync"),Localized(@"JX_OneHour"), Localized(@"JX_OneDay"), Localized(@"JX_OneWeeks"), Localized(@"JX_OneMonth"), Localized(@"JX_OneQuarter"), Localized(@"JX_OneYear"),Localized(@"JX_Forever")];
  50. _loginTimeArr = @[Localized(@"JX_SetContactYES"),Localized(@"JX_SetAllFriendYES"),Localized(@"JX_SetAllYES"),Localized(@"JX_SetAllNO")];
  51. UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, 130)];
  52. headView.backgroundColor = HEXCOLOR(0xF2F2F2);
  53. [self.myTableView addSubview:headView];
  54. CGFloat y = 0;
  55. // JXImageView *iv = [self createButton:Localized(@"JX_SetTheChatMsgSaveTime") drawTop:NO drawBottom:YES must:NO click:@selector(chatTimeOut:) superView:headView];
  56. // iv.frame = CGRectMake(0,0, JX_SCREEN_WIDTH, HEIGHT);
  57. // _timeOutLabel = [[UILabel alloc]initWithFrame:CGRectMake(JX_SCREEN_WIDTH-135,11,100,30)];
  58. // _timeOutLabel.textAlignment = NSTextAlignmentRight;
  59. // _timeOutLabel.userInteractionEnabled = NO;
  60. // _timeOutLabel.font = g_factory.font15;
  61. // double outTime = [[self.dataSorce objectForKey:@"chatRecordTimeOut"] doubleValue];
  62. // _timeOutLabel.text = [self getPickerContentWithDay:outTime];
  63. // [iv addSubview:_timeOutLabel];
  64. // y = CGRectGetMaxY(iv.frame);
  65. JXImageView *iv = [self createButtonWithFrame:CGRectMake(0,y, JX_SCREEN_WIDTH, HEIGHT) title:Localized(@"JX_SingleRoamTime") drawTop:NO drawBottom:NO must:NO click:@selector(syncTimeLen:) superView:headView];
  66. _syncTimeLenLabel = [[UILabel alloc]initWithFrame:CGRectMake(JX_SCREEN_WIDTH-135,11,100,30)];
  67. _syncTimeLenLabel.textAlignment = NSTextAlignmentRight;
  68. _syncTimeLenLabel.userInteractionEnabled = NO;
  69. _syncTimeLenLabel.font = g_factory.font15;
  70. double syncTimeLen = [[self.dataSorce objectForKey:@"chatSyncTimeLen"] doubleValue];
  71. _syncTimeLenLabel.text = [self getPickerContentWithDay:syncTimeLen];
  72. [iv addSubview:_syncTimeLenLabel];
  73. y = CGRectGetMaxY(iv.frame);
  74. y += 10;
  75. //谁可以看到我的上线时间
  76. iv = [self createButtonWithFrame:CGRectMake(0,y, JX_SCREEN_WIDTH, 68) title:Localized(@"JX_WhoCanSeeMyOnlineTime") drawTop:NO drawBottom:YES must:YES click:@selector(showLastLoginTime) superView:headView];
  77. self.seeNumTypeLab = [[UILabel alloc] initWithFrame:CGRectMake(15, 37, 300, 20)];
  78. self.seeNumTypeLab.textColor = [UIColor grayColor];
  79. self.seeNumTypeLab.font = SYSFONT(14);
  80. self.seeNumTypeLab.text = [self getSeeLgoinLastTime:[self.dataSorce objectForKey:@"showLastLoginTime"]];
  81. [iv addSubview:self.seeNumTypeLab];
  82. if ([g_config.regeditPhoneOrName intValue] == 0) {
  83. //谁可以看到我的手机号码
  84. y += iv.frame.size.height;
  85. iv = [self createButtonWithFrame:CGRectMake(0,y, JX_SCREEN_WIDTH, 68) title:Localized(@"JX_WhoCanSeeMyNo.") drawTop:NO drawBottom:NO must:YES click:@selector(showNumber) superView:headView];
  86. self.seeTimeTypeLab = [[UILabel alloc] initWithFrame:CGRectMake(15, 37, 300, 20)];
  87. self.seeTimeTypeLab.textColor = [UIColor grayColor];
  88. self.seeTimeTypeLab.font = SYSFONT(14);
  89. self.seeTimeTypeLab.text = [self getSeeLgoinLastTime:[self.dataSorce objectForKey:@"showTelephone"]];
  90. [iv addSubview:self.seeTimeTypeLab];
  91. }
  92. //允许加我的方式
  93. y += iv.frame.size.height;
  94. iv = [self createButtonWithFrame:CGRectMake(0,y, JX_SCREEN_WIDTH, 68) title:Localized(@"JX_AddMeToWay") drawTop:YES drawBottom:NO must:YES click:@selector(selectAddMeType) superView:headView];
  95. self.addMeTypeLab = [[UILabel alloc] initWithFrame:CGRectMake(15, 37, 300, 20)];
  96. self.addMeTypeLab.textColor = [UIColor grayColor];
  97. self.addMeTypeLab.font = SYSFONT(14);
  98. self.addMeTypeLab.text = [self getaddMeTypeText:[self.dataSorce objectForKey:@"friendFromList"]];
  99. [iv addSubview:self.addMeTypeLab];
  100. // iv = [self createButton:Localized(@"JX_GroupRoamTime") drawTop:NO drawBottom:YES must:NO click:@selector(groupSyncTimeLen:) superView:headView];
  101. // iv.frame = CGRectMake(0,y, JX_SCREEN_WIDTH, HEIGHT);
  102. // _groupSyncTimeLenLabel = [[UILabel alloc]initWithFrame:CGRectMake(JX_SCREEN_WIDTH-135,11,100,30)];
  103. // _groupSyncTimeLenLabel.textAlignment = NSTextAlignmentRight;
  104. // _groupSyncTimeLenLabel.userInteractionEnabled = NO;
  105. // _groupSyncTimeLenLabel.font = g_factory.font15;
  106. // double groupSyncTimeLen = [[self.dataSorce objectForKey:@"groupChatSyncTimeLen"] doubleValue];
  107. // _groupSyncTimeLenLabel.text = [self getPickerContentWithDay:groupSyncTimeLen];
  108. // [iv addSubview:_groupSyncTimeLenLabel];
  109. headView.frame = CGRectMake(headView.frame.origin.x, headView.frame.origin.y, headView.frame.size.width, CGRectGetMaxY(iv.frame)+10);
  110. self.myTableView.backgroundColor = HEXCOLOR(0xF2F2F2);
  111. self.myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  112. self.myTableView.delegate = self;
  113. self.myTableView.dataSource = self;
  114. self.myTableView.tableHeaderView = headView;
  115. [self.myTableView reloadData];
  116. // UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction)];
  117. // [self.myTableView addGestureRecognizer:tap];
  118. _selectView = [[UIView alloc] initWithFrame:CGRectMake(0, JX_SCREEN_TOP, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT-JX_SCREEN_TOP)];
  119. _selectView.backgroundColor = [UIColor clearColor];
  120. _selectView.hidden = YES;
  121. [self.view addSubview:_selectView];
  122. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(cancelBtnAction)];
  123. [_selectView addGestureRecognizer:tap];
  124. UIView *selV = [[UIView alloc] initWithFrame:CGRectMake(0, _selectView.frame.size.height - 220, JX_SCREEN_WIDTH, 220)];
  125. selV.backgroundColor = HEXCOLOR(0xF2F2F2);
  126. [_selectView addSubview:selV];
  127. UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(selV.frame.size.width - 80, 20, 60, 20)];
  128. [btn setTitle:Localized(@"JX_Confirm") forState:UIControlStateNormal];
  129. btn.titleLabel.font = [UIFont systemFontOfSize:16.0];
  130. [btn setTitleColor:THEMECOLOR forState:UIControlStateNormal];
  131. [btn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
  132. [selV addSubview:btn];
  133. btn = [[UIButton alloc] initWithFrame:CGRectMake(20, 20, 50, 20)];
  134. [btn setTitle:Localized(@"JX_Cencal") forState:UIControlStateNormal];
  135. btn.titleLabel.font = [UIFont systemFontOfSize:16.0];
  136. [btn setTitleColor:THEMECOLOR forState:UIControlStateNormal];
  137. [btn addTarget:self action:@selector(cancelBtnAction) forControlEvents:UIControlEventTouchUpInside];
  138. [selV addSubview:btn];
  139. _pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 40, selV.frame.size.width, selV.frame.size.height - 40)];
  140. _pickerView.delegate = self;
  141. // [_pickerView selectRow:index inComponent:0 animated:NO];
  142. [selV addSubview:_pickerView];
  143. _pSelf = self;
  144. [g_notify addObserver:self selector:@selector(updateCurData:) name:kXMPPMessageUpadtePasswordNotification object:nil];
  145. }
  146. - (void)getData {
  147. //获取服务器的好友状态
  148. [self changeSettingsNum];
  149. double syncTimeLen = [[self.dataSorce objectForKey:@"chatSyncTimeLen"] doubleValue];
  150. _syncTimeLenLabel.text = [self getPickerContentWithDay:syncTimeLen];
  151. self.seeNumTypeLab.text = [self getSeeLgoinLastTime:[self.dataSorce objectForKey:@"showLastLoginTime"]];
  152. self.seeTimeTypeLab.text = [self getSeeLgoinLastTime:[self.dataSorce objectForKey:@"showTelephone"]];
  153. self.addMeTypeLab.text = [self getaddMeTypeText:[self.dataSorce objectForKey:@"friendFromList"]];
  154. [self.myTableView reloadData];
  155. }
  156. - (void)updateCurData:(NSNotification *)noti {
  157. JXMessageObject *msg = noti.object;
  158. if ([msg.objectId isEqualToString:SYNC_PRIVATE_SETTINGS]) {
  159. [g_server getFriendSettings:g_myself.userId toView:self];
  160. }
  161. }
  162. - (void)showNumber {
  163. self.isShowNum = YES;
  164. JXActionSheetVC *actionVC = [[JXActionSheetVC alloc] initWithImages:@[] names:self.loginTimeArr];
  165. actionVC.delegate = self;
  166. [self presentViewController:actionVC animated:NO completion:nil];
  167. }
  168. - (void)showLastLoginTime {
  169. self.isShowNum = NO;
  170. JXActionSheetVC *actionVC = [[JXActionSheetVC alloc] initWithImages:@[] names:self.loginTimeArr];
  171. actionVC.delegate = self;
  172. [self presentViewController:actionVC animated:NO completion:nil];
  173. }
  174. - (void)actionSheet:(JXActionSheetVC *)actionSheet didButtonWithIndex:(NSInteger)index {
  175. NSNumber *timeIndex = 0;
  176. if (index == 0) {
  177. timeIndex = @3;
  178. }
  179. else if (index == 1) {
  180. timeIndex = @2;
  181. }
  182. else if (index == 2) {
  183. timeIndex = @1;
  184. }
  185. else if (index == 3) {
  186. timeIndex = @-1;
  187. }
  188. NSString *key = [NSString string];
  189. if (self.isShowNum) {
  190. key = @"showTelephone";
  191. self.seeTimeTypeLab.text = self.loginTimeArr[index];
  192. }else {
  193. key = @"showLastLoginTime";
  194. self.seeNumTypeLab.text = self.loginTimeArr[index];
  195. }
  196. [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:key value:[NSString stringWithFormat:@"%@",timeIndex] toView:self];
  197. }
  198. - (NSString *)getSeeLgoinLastTime:(NSNumber *)str {
  199. NSDictionary *type =@{@"-1":Localized(@"JX_SetAllNO"),@"1":Localized(@"JX_SetAllYES"),@"2":Localized(@"JX_SetAllFriendYES"),@"3":Localized(@"JX_SetContactYES")};
  200. return [type objectForKey:[NSString stringWithFormat:@"%@",str]];
  201. }
  202. - (NSString *)getaddMeTypeText:(NSString *)indexStr {
  203. NSArray *type = @[Localized(@"JXQR_QRImage"),Localized(@"JX_Card"),Localized(@"JX_ManyPerChat"),Localized(@"JX_MobileSearch"),Localized(@"JX_NicknameSearch"),Localized(@"OTHER")];
  204. NSMutableArray *indexArr = [NSMutableArray arrayWithArray:[indexStr componentsSeparatedByString:@","]];
  205. NSMutableArray *typeArr = [NSMutableArray array];
  206. [indexArr enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
  207. if ([obj intValue] == 0) {
  208. [indexArr removeObject:obj];
  209. }else {
  210. [typeArr addObject:[type objectAtIndex:[obj intValue]-1]];
  211. }
  212. }];
  213. if (indexArr.count <= 0) {
  214. return Localized(@"JX_SetAllNO");
  215. }else if (indexArr.count >= type.count){
  216. return Localized(@"JX_SetAllYES");
  217. }
  218. return [typeArr componentsJoinedByString:@","];
  219. }
  220. - (void)selectAddMeType {
  221. self.moreVC = [[JXMoreSelectVC alloc] initWithTitle:Localized(@"JX_AddMeToWay") dataArray:@[Localized(@"JXQR_QRImage"),Localized(@"JX_Card"),Localized(@"JX_ManyPerChat"),Localized(@"JX_MobileSearch"),Localized(@"JX_NicknameSearch"),Localized(@"OTHER")]];
  222. self.moreVC.indexStr = self.indexStr.length > 0 ? self.indexStr : [NSString stringWithFormat:@"%@",[self.dataSorce objectForKey:@"friendFromList"]];
  223. self.moreVC.delegate = self;
  224. [self.view addSubview:self.moreVC.view];
  225. }
  226. - (void)didSureBtn:(JXMoreSelectVC *)moreSelectVC indexStr:(NSString *)indexStr {
  227. self.indexStr = indexStr; // 记录一下历史选项
  228. self.addMeTypeLab.text = [self getaddMeTypeText:indexStr];
  229. [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:@"friendFromList" value:indexStr toView:self];
  230. }
  231. - (NSString *)getPickerContentWithDay:(double)day{
  232. NSString *str;
  233. if (day == -2) {
  234. str = _pickerArr[0];
  235. }else if (day == 0 || day == -1) {
  236. str = _pickerArr[7];
  237. }else if (day == 0.04) {
  238. str = _pickerArr[1];
  239. }else if (day == 1) {
  240. str = _pickerArr[2];
  241. }else if (day == 7) {
  242. str = _pickerArr[3];
  243. }else if (day == 30) {
  244. str = _pickerArr[4];
  245. }else if (day == 90) {
  246. str = _pickerArr[5];
  247. }else{
  248. str = _pickerArr[6];
  249. }
  250. return str;
  251. }
  252. - (NSInteger)getPickerIndexWithDay:(double)day {
  253. NSInteger index;
  254. if (day == -2) {
  255. index = 0;
  256. }else if (day == 0 || day == -1) {
  257. index = 7;
  258. }else if (day == 0.04) {
  259. index = 1;
  260. }else if (day == 1) {
  261. index = 2;
  262. }else if (day == 7) {
  263. index = 3;
  264. }else if (day == 30) {
  265. index = 4;
  266. }else if (day == 90) {
  267. index = 5;
  268. }else{
  269. index = 6;
  270. }
  271. return index;
  272. }
  273. - (void)chatTimeOut:(JXImageView *)imageView {
  274. self.selType = Type_chatRecordTimeOut;
  275. double outTime = [[self.dataSorce objectForKey:@"chatRecordTimeOut"] doubleValue];
  276. NSInteger index = [self getPickerIndexWithDay:outTime];
  277. [_pickerView selectRow:index inComponent:0 animated:NO];
  278. _selectView.hidden = NO;
  279. }
  280. - (void)syncTimeLen:(JXImageView *)imageView {
  281. self.selType = Type_chatSyncTimeLen;
  282. double chatSyncTimeLen = [[self.dataSorce objectForKey:@"chatSyncTimeLen"] doubleValue];
  283. NSInteger index = [self getPickerIndexWithDay:chatSyncTimeLen];
  284. [_pickerView selectRow:index inComponent:0 animated:NO];
  285. _selectView.hidden = NO;
  286. }
  287. - (void)groupSyncTimeLen:(JXImageView *)imageView {
  288. self.selType = Type_groupChatSyncTimeLen;
  289. double groupChatSyncTimeLen = [[self.dataSorce objectForKey:@"groupChatSyncTimeLen"] doubleValue];
  290. NSInteger index = [self getPickerIndexWithDay:groupChatSyncTimeLen];
  291. [_pickerView selectRow:index inComponent:0 animated:NO];
  292. _selectView.hidden = NO;
  293. }
  294. - (void)btnAction:(UIButton *)btn {
  295. _selectView.hidden = YES;
  296. NSInteger row = [_pickerView selectedRowInComponent:0];
  297. NSString *str = [NSString stringWithFormat:@"%ld", row];
  298. switch (row) {
  299. case 0:
  300. str = @"-2";
  301. break;
  302. case 1:
  303. str = @"0.04";
  304. break;
  305. case 2:
  306. str = @"1";
  307. break;
  308. case 3:
  309. str = @"7";
  310. break;
  311. case 4:
  312. str = @"30";
  313. break;
  314. case 5:
  315. str = @"90";
  316. break;
  317. case 6:
  318. str = @"365";
  319. break;
  320. case 7:
  321. str = @"-1";
  322. break;
  323. default:
  324. break;
  325. }
  326. NSString *key;
  327. switch (self.selType) {
  328. case Type_chatRecordTimeOut: {
  329. key = @"chatRecordTimeOut";
  330. g_myself.chatRecordTimeOut = str;
  331. _timeOutLabel.text = _pickerArr[row];
  332. }
  333. break;
  334. case Type_chatSyncTimeLen: {
  335. key = @"chatSyncTimeLen";
  336. g_myself.chatSyncTimeLen = str;
  337. _syncTimeLenLabel.text = _pickerArr[row];
  338. }
  339. break;
  340. case Type_groupChatSyncTimeLen: {
  341. key = @"groupChatSyncTimeLen";
  342. g_myself.groupChatSyncTimeLen = str;
  343. _groupSyncTimeLenLabel.text = _pickerArr[row];
  344. }
  345. break;
  346. default:
  347. break;
  348. }
  349. [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:key value:str toView:self];
  350. }
  351. - (void)cancelBtnAction {
  352. _selectView.hidden = YES;
  353. }
  354. - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
  355. {
  356. return 1;
  357. }
  358. - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
  359. {
  360. return _pickerArr.count;
  361. }
  362. - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
  363. {
  364. return _pickerArr[row];
  365. }
  366. - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
  367. {
  368. }
  369. - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
  370. }
  371. - (void)viewWillAppear:(BOOL)animated{
  372. [super viewWillAppear:animated];
  373. NSLog(@"CurrentController = %@",[self class]);
  374. // UIView *view = g_window.subviews.lastObject;
  375. // //NSLog(@"lastObject = %@",g_window.subviews.lastObject);
  376. // [UIView animateWithDuration:0.3 animations:^{
  377. // view.frame = CGRectMake(-85, 0, JX_SCREEN_WIDTH, self.view.frame.size.height);
  378. // }];
  379. [self resetViewFrame];
  380. }
  381. -(void)createHeaderView{
  382. int heightHeader = JX_SCREEN_TOP;
  383. UIView * tableHeader = [[UIView alloc]initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, heightHeader)];
  384. UIImageView* iv = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, heightHeader)];
  385. if (THESIMPLESTYLE) {
  386. iv.image = [[UIImage imageNamed:@"navBarBackground"] imageWithTintColor:[UIColor whiteColor]];
  387. }else {
  388. iv.image = [g_theme themeTintImage:@"navBarBackground"];//[UIImage imageNamed:@"navBarBackground"];
  389. }
  390. iv.userInteractionEnabled = YES;
  391. [tableHeader addSubview:iv];
  392. // [iv release];
  393. JXLabel* p = [[JXLabel alloc]initWithFrame:CGRectMake(40, JX_SCREEN_TOP - 32, self_width-40*2, 16)];
  394. p.center = CGPointMake(tableHeader.center.x, p.center.y);
  395. p.backgroundColor = [UIColor clearColor];
  396. p.textAlignment = NSTextAlignmentCenter;
  397. p.textColor = THESIMPLESTYLE ? [UIColor blackColor] : [UIColor whiteColor];
  398. p.text = Localized(@"JX_PrivacySettings");
  399. p.userInteractionEnabled = YES;
  400. p.didTouch = @selector(actionTitle:);
  401. p.delegate = self;
  402. p.changeAlpha = NO;
  403. [tableHeader addSubview:p];
  404. UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, JX_SCREEN_TOP - 46, 46, 46)];
  405. [btn setBackgroundImage:[UIImage imageNamed:@"title_back_black_big"] forState:UIControlStateNormal];
  406. [btn addTarget:self action:@selector(actionQuitSet) forControlEvents:UIControlEventTouchUpInside];
  407. // btn.showsTouchWhenHighlighted = YES;
  408. [tableHeader addSubview:btn];
  409. [self.view addSubview:tableHeader];
  410. }
  411. -(JXImageView*)createButtonWithFrame:(CGRect)frame title:(NSString*)title drawTop:(BOOL)drawTop drawBottom:(BOOL)drawBottom must:(BOOL)must click:(SEL)click superView:(UIView *)superView{
  412. JXImageView* btn = [[JXImageView alloc] init];
  413. btn.frame = frame;
  414. btn.backgroundColor = [UIColor whiteColor];
  415. btn.userInteractionEnabled = YES;
  416. if(click)
  417. btn.didTouch = click;
  418. else
  419. btn.didTouch = @selector(hideKeyboard);
  420. btn.delegate = self;
  421. [superView addSubview:btn];
  422. JXLabel* p = [[JXLabel alloc] init];
  423. p.text = title;
  424. p.font = [UIFont systemFontOfSize:16.0];
  425. p.backgroundColor = [UIColor clearColor];
  426. p.textColor = [UIColor blackColor];
  427. [btn addSubview:p];
  428. if(must){
  429. p.frame = CGRectMake(15, 14, 200, 20);
  430. }else {
  431. p.frame = CGRectMake(15, (HEIGHT-20)/2, 200, 20);
  432. }
  433. if(drawTop){
  434. UIView* line = [[UIView alloc] initWithFrame:CGRectMake(15,0,JX_SCREEN_WIDTH-15,LINE_WH)];
  435. line.backgroundColor = THE_LINE_COLOR;
  436. [btn addSubview:line];
  437. }
  438. if(drawBottom){
  439. UIView* line = [[UIView alloc]initWithFrame:CGRectMake(15,frame.size.height-LINE_WH,JX_SCREEN_WIDTH-15,LINE_WH)];
  440. line.backgroundColor = THE_LINE_COLOR;
  441. [btn addSubview:line];
  442. }
  443. if(click){
  444. UIImageView* iv;
  445. iv = [[UIImageView alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH-15-7, (HEIGHT-13)/2, 7, 13)];
  446. iv.image = [UIImage imageNamed:@"new_icon_>"];
  447. [btn addSubview:iv];
  448. if (must) {
  449. iv.frame = CGRectMake(JX_SCREEN_WIDTH-15-6, (68-12)/2, 6, 12);
  450. }
  451. }
  452. return btn;
  453. }
  454. -(void)actionQuitSet{
  455. [_wait stop];
  456. [g_server stopConnection:self];
  457. [g_navigation dismissViewController:self animated:YES];
  458. // CGContextRef context = UIGraphicsGetCurrentContext();
  459. // [UIView beginAnimations:nil context:context];
  460. // [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
  461. // [UIView setAnimationDuration:0.2];
  462. // [UIView setAnimationDelegate:self];
  463. // [UIView setAnimationDidStopSelector:@selector(actionQuit)];
  464. //
  465. // self.view.frame = CGRectMake (JX_SCREEN_WIDTH, 0, self_width, self.view.frame.size.height);
  466. // UIView *view = g_window.subviews[g_window.subviews.count - 2];
  467. // view.frame = CGRectMake (0, 0, self_width, self.view.frame.size.height);
  468. //
  469. // [UIView commitAnimations];
  470. }
  471. -(void)actionQuit{
  472. [self.view removeFromSuperview];
  473. _pSelf = nil;
  474. }
  475. ////获取设置状态
  476. //- (void)getData{
  477. //
  478. // [g_server getFriendSettings:[NSString stringWithFormat:@"%ld",g_server.user_id] toView:self];
  479. //}
  480. - (void)didReceiveMemoryWarning {
  481. [super didReceiveMemoryWarning];
  482. // Dispose of any resources that can be recreated.
  483. }
  484. - (void)onSettings:(UISwitch *)switchButton{
  485. // if (switchButton.isOn) {
  486. //// if (switchButton.tag == 0) {//
  487. //// self.att = @"1";
  488. //// }else if (switchButton.tag == 1){//
  489. //// self.greet = @"1";
  490. //// }else
  491. // if (switchButton.tag == 0){
  492. // self.friends = @"1";
  493. // }else if (switchButton.tag == 1){
  494. // self.isEncrypt = YES;
  495. // g_xmpp.isEncryptAll = YES;
  496. // [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kMESSAGE_isEncrypt];
  497. //
  498. // }
  499. // }else{
  500. //// if (switchButton.tag == 0) {//
  501. //// self.att = @"0";
  502. //// }else if (switchButton.tag == 1){//
  503. //// self.greet = @"0";
  504. //// }else
  505. // if (switchButton.tag == 0){
  506. // self.friends = @"0";
  507. // }else if (switchButton.tag == 1){
  508. // self.isEncrypt = NO;
  509. // g_xmpp.isEncryptAll = NO;
  510. // [[NSUserDefaults standardUserDefaults] setBool:NO forKey:kMESSAGE_isEncrypt];
  511. // }
  512. // }
  513. if (switchButton.tag == 0) {
  514. self.friends = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  515. g_myself.friendsVerify = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  516. [g_server changeFriendSetting:self.friends allowAtt:self.att allowGreet:self.greet key:nil value:nil toView:self];
  517. }
  518. if (switchButton.tag == 1) { // 允许手机号搜索我
  519. g_myself.phoneSearch = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  520. [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:@"phoneSearch" value:g_myself.phoneSearch toView:self];
  521. }
  522. if (switchButton.tag == 2) {// 允许昵称搜索我
  523. g_myself.nameSearch = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  524. [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:@"nameSearch" value:g_myself.nameSearch toView:self];
  525. }
  526. if (switchButton.tag == 3) {
  527. self.isEncrypt = switchButton.isOn;
  528. g_myself.isEncrypt = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  529. [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:@"isEncrypt" value:g_myself.isEncrypt toView:self];
  530. }
  531. if (switchButton.tag == 4) {
  532. g_myself.isTyping = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  533. [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:@"isTyping" value:g_myself.isTyping toView:self];
  534. // [g_default setBool:switchButton.isOn forKey:kStartEnteringStatus];
  535. // [g_default synchronize];
  536. }else if (switchButton.tag == 5) {//是否振动
  537. g_myself.isVibration = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  538. [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:@"isVibration" value:g_myself.isVibration toView:self];
  539. // [g_default setBool:switchButton.isOn forKey:kMsgComeVibration];
  540. // [g_default synchronize];
  541. }else if (switchButton.tag == 6) {//是否静音
  542. g_myself.isMute = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  543. // 先不做网络同步
  544. // [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:@"isVibration" value:g_myself.isVibration toView:self];
  545. // 本地
  546. [g_default setBool:switchButton.isOn forKey:kMsgComeMute];
  547. [g_default synchronize];
  548. }else if (switchButton.tag == 7) {//是否多点登录
  549. g_myself.multipleDevices = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  550. [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:@"multipleDevices" value:g_myself.multipleDevices toView:self];
  551. // [g_default setBool:switchButton.isOn forKey:kISMultipleLogin];
  552. // [g_default synchronize];
  553. // if (switchButton.isOn) {
  554. // g_myself.isMultipleLogin = [NSNumber numberWithLong:1];
  555. // }else {
  556. //
  557. // g_myself.isMultipleLogin = [NSNumber numberWithLong:0];
  558. // }
  559. }else if (switchButton.tag == 8) {//是否屠龙推送
  560. // g_myself.isMute = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  561. // 先不做网络同步
  562. // [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:@"isVibration" value:g_myself.isVibration toView:self];
  563. // 本地
  564. [g_default setBool:YES forKey:kLongComePushIsFirstSetUp];
  565. [g_default setBool:switchButton.isOn forKey:kLongComePush];
  566. [g_default synchronize];
  567. }else if (switchButton.tag == 7) {//是否多点登录
  568. g_myself.multipleDevices = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  569. [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:@"multipleDevices" value:g_myself.multipleDevices toView:self];
  570. // [g_default setBool:switchButton.isOn forKey:kISMultipleLogin];
  571. // [g_default synchronize];
  572. // if (switchButton.isOn) {
  573. // g_myself.isMultipleLogin = [NSNumber numberWithLong:1];
  574. // }else {
  575. //
  576. // g_myself.isMultipleLogin = [NSNumber numberWithLong:0];
  577. // }
  578. }
  579. // else if (switchButton.tag == 8){//新设备登录是否需要授权
  580. // g_myself.authSwitch = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  581. // [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:@"authSwitch" value:g_myself.authSwitch toView:self];
  582. // }//else if (switchButton.tag == 7) {//是否使用Google地图
  583. //
  584. // g_myself.isUseGoogleMap = [NSString stringWithFormat:@"%@",switchButton.isOn ? @"1" : @"0"];
  585. // [g_server changeFriendSetting:nil allowAtt:nil allowGreet:nil key:@"isUseGoogleMap" value:g_myself.isUseGoogleMap toView:self];
  586. //
  587. //// BOOL isShowGooMap = NO;
  588. //// if (switchButton.isOn) {
  589. //// isShowGooMap = YES;
  590. //// }else {
  591. //// isShowGooMap = NO;
  592. //// }
  593. //// [g_default setBool:isShowGooMap forKey:kUseGoogleMap];
  594. //
  595. // }
  596. // else{
  597. // [g_server changeFriendSetting:self.friends allowAtt:self.att allowGreet:self.greet key:nil value:nil toView:self];
  598. // }
  599. }
  600. #pragma mark - tableView代理
  601. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  602. return 1;
  603. }
  604. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  605. int number = 9;
  606. if ([g_config.isOpenPositionService intValue] == 1) {
  607. number = 8;
  608. }
  609. return number;
  610. }
  611. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  612. JXSettingsCell * cell = [tableView dequeueReusableCellWithIdentifier:@"JXSC"];
  613. if (cell == nil) {
  614. cell = [[NSBundle mainBundle] loadNibNamed:@"JXSettingsCell" owner:self options:nil][0];
  615. cell.mySwitch = [[UISwitch alloc]initWithFrame:CGRectMake(JX_SCREEN_WIDTH -70, 10, 0, 0)];
  616. [cell.mySwitch addTarget:self action:@selector(onSettings:) forControlEvents:UIControlEventValueChanged];
  617. cell.mySwitch.tag = indexPath.row;
  618. cell.mySwitch.onTintColor = THEMECOLOR;
  619. cell.inTableView = self;
  620. [cell addSubview:cell.mySwitch];
  621. int number = 8;
  622. if ([g_config.isOpenPositionService intValue] == 1) {
  623. number = 7;
  624. }
  625. if (indexPath.row != number-1) {
  626. cell.line = [[UIView alloc] initWithFrame:CGRectMake(15, 56-LINE_WH, JX_SCREEN_WIDTH-15, LINE_WH)];
  627. cell.line.backgroundColor = THE_LINE_COLOR;
  628. [cell addSubview:cell.line];
  629. }
  630. }
  631. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  632. //从服务器获取数据后,改变switch的状态
  633. // if (indexPath.row == 0) {
  634. // cell.myLabel.text = Localized(@"JXSettings_AllowFollow");
  635. // if([[self.dataSorce objectForKey:@"allowAtt"] integerValue] == 1){
  636. //
  637. // cell.mySwitch.on = YES;
  638. // }else{
  639. //
  640. // cell.mySwitch.on = NO;
  641. // }
  642. //
  643. // }else if(indexPath.row == 1){
  644. // cell.myLabel.text = Localized(@"JXSettings_AllowSayHi");
  645. // if([[self.dataSorce objectForKey:@"allowGreet"] integerValue] == 1){
  646. //
  647. // cell.mySwitch.on = YES;
  648. // }else{
  649. //
  650. // cell.mySwitch.on = NO;
  651. // }
  652. // }else
  653. if(indexPath.row == 0){
  654. cell.myLabel.text = Localized(@"JXSettings_FirendVerify");
  655. if([[self.dataSorce objectForKey:@"friendsVerify"] integerValue] == 1){
  656. cell.mySwitch.on = YES;
  657. }else{
  658. cell.mySwitch.on = NO;
  659. }
  660. }
  661. else if(indexPath.row == 1){
  662. cell.myLabel.text = Localized(@"JX_AllowMeToSearchByNO.");
  663. if([[self.dataSorce objectForKey:@"phoneSearch"] integerValue] == 1){
  664. cell.mySwitch.on = YES;
  665. }else{
  666. cell.mySwitch.on = NO;
  667. }
  668. }
  669. else if(indexPath.row == 2){
  670. cell.myLabel.text = Localized(@"JX_AllowMeToSearchByNickname");
  671. if([[self.dataSorce objectForKey:@"nameSearch"] integerValue] == 1){
  672. cell.mySwitch.on = YES;
  673. }else{
  674. cell.mySwitch.on = NO;
  675. }
  676. }
  677. else if(indexPath.row == 3){
  678. cell.myLabel.text = Localized(@"JXSettings_Encrypt");
  679. if([[self.dataSorce objectForKey:@"isEncrypt"] integerValue] == 1){
  680. cell.mySwitch.on = YES;
  681. }else{
  682. cell.mySwitch.on = NO;
  683. }
  684. }
  685. else if(indexPath.row == 4){
  686. cell.myLabel.text = Localized(@"JX_StartEntering");
  687. if([[self.dataSorce objectForKey:@"isTyping"] integerValue] == 1){
  688. cell.mySwitch.on = YES;
  689. }else{
  690. cell.mySwitch.on = NO;
  691. }
  692. }
  693. else if(indexPath.row == 5){
  694. cell.myLabel.text = Localized(@"JX_Vibration");
  695. if([[self.dataSorce objectForKey:@"isVibration"] integerValue] == 1){
  696. cell.mySwitch.on = YES;
  697. }else{
  698. cell.mySwitch.on = NO;
  699. }
  700. }
  701. else if(indexPath.row == 6){
  702. cell.myLabel.text = @"是否静音";
  703. if([g_default boolForKey:kMsgComeMute] == 1){
  704. cell.mySwitch.on = YES;
  705. }else{
  706. cell.mySwitch.on = NO;
  707. }
  708. }
  709. else if(indexPath.row == 7){
  710. cell.myLabel.text = Localized(@"JX_OpenMultipointLogin");
  711. if([[self.dataSorce objectForKey:@"multipleDevices"] integerValue] == 1){
  712. cell.mySwitch.on = YES;
  713. }else{
  714. cell.mySwitch.on = NO;
  715. }
  716. }
  717. else if(indexPath.row == 8){
  718. cell.myLabel.text = @"是否屠龙推送";
  719. // 第一次设置
  720. if ([g_default boolForKey:kLongComePushIsFirstSetUp] != 1) {
  721. cell.mySwitch.on = YES;
  722. } else {
  723. if ([g_default boolForKey:kLongComePush] == 1) {
  724. cell.mySwitch.on = YES;
  725. }else{
  726. cell.mySwitch.on = NO;
  727. }
  728. }
  729. }
  730. // else if(indexPath.row == 8){
  731. // cell.myLabel.text = Localized(@"JX_LoginRequiresDeviceAuthorization");
  732. // if ([[self.dataSorce objectForKey:@"authSwitch"] integerValue] == 1) {
  733. // cell.mySwitch.on = YES;
  734. // }else{
  735. // cell.mySwitch.on = NO;
  736. // }
  737. // }
  738. // else if(indexPath.row == 7){
  739. // cell.myLabel.text = Localized(@"JX_UseGoogleMap");
  740. // if([[self.dataSorce objectForKey:@"isUseGoogleMap"] integerValue] == 1){
  741. //
  742. // cell.mySwitch.on = YES;
  743. // }else{
  744. //
  745. // cell.mySwitch.on = NO;
  746. // }
  747. // }
  748. return cell;
  749. }
  750. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  751. return 56;
  752. }
  753. - (void)changeSettingsNum{
  754. if([[self.dataSorce objectForKey:@"allowAtt"] integerValue] == 1){
  755. self.att = @"1";
  756. }else{
  757. self.att = @"0";
  758. }
  759. if([[self.dataSorce objectForKey:@"allowGreet"] integerValue] == 1){
  760. self.greet = @"1";
  761. }else{
  762. self.greet = @"0";
  763. }
  764. if([[self.dataSorce objectForKey:@"friendsVerify"] integerValue] == 1){
  765. self.friends = @"1";
  766. }else{
  767. self.friends = @"0";
  768. }
  769. if ([[self.dataSorce objectForKey:@"isEncrypt"] integerValue] == 1) {
  770. self.isEncrypt = YES;
  771. }else{
  772. self.isEncrypt = NO;
  773. }
  774. }
  775. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
  776. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  777. [self doLogout];
  778. });
  779. }
  780. -(void)doLogout{
  781. JXUserObject *user = [JXUserObject sharedInstance];
  782. [g_server logout:user.areaCode toView:self];
  783. }
  784. -(void)relogin{
  785. g_server.access_token = nil;
  786. [g_notify postNotificationName:kSystemLogoutNotifaction object:nil];
  787. [[JXXMPP sharedInstance] logout];
  788. NSLog(@"XMPP --- jxsettingsVC");
  789. loginVC* vc = [loginVC alloc];
  790. vc.isAutoLogin = NO;
  791. vc.isSwitchUser= NO;
  792. vc = [vc init];
  793. [g_mainVC.view removeFromSuperview];
  794. g_mainVC = nil;
  795. [self.view removeFromSuperview];
  796. self.view = nil;
  797. g_navigation.rootViewController = vc;
  798. [_wait stop];
  799. #if TAR_IM
  800. #ifdef Meeting_Version
  801. [g_meeting stopMeeting];
  802. #endif
  803. #endif
  804. }
  805. #pragma mark - 返回数据
  806. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  807. [_wait hide];
  808. if ([aDownload.action isEqualToString:act_SettingsUpdate]) {//更改了好友验证
  809. self.dataSorce = [dict objectForKey:@"settings"];
  810. [self changeSettingsNum];
  811. }
  812. if ([aDownload.action isEqualToString:act_UserUpdate]) {
  813. [g_App showAlert:Localized(@"JX_ModifiedMultipointLogonNeedsToBeLoggedIn") delegate:self tag:3333 onlyConfirm:YES];
  814. }
  815. if( [aDownload.action isEqualToString:act_UserLogout] ){
  816. [self relogin];
  817. }
  818. if ([aDownload.action isEqualToString:act_Settings]){
  819. // [g_server showMsg:@"其他端修改了隐私设置,已更新"];
  820. self.dataSorce = dict;
  821. [self getData];
  822. }
  823. }
  824. -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
  825. if( [aDownload.action isEqualToString:act_UserLogout] ){
  826. [self performSelector:@selector(doSwitch) withObject:nil afterDelay:1];
  827. }
  828. return hide_error;
  829. }
  830. -(int) didServerConnectError:(JXConnection*)aDownload error:(NSError *)error{//error为空时,代表超时
  831. [_wait hide];
  832. return show_error;
  833. }
  834. -(void) didServerConnectStart:(JXConnection*)aDownload{
  835. [_wait start];
  836. }
  837. /*
  838. #pragma mark - Navigation
  839. // In a storyboard-based application, you will often want to do a little preparation before navigation
  840. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  841. // Get the new view controller using [segue destinationViewController].
  842. // Pass the selected object to the new view controller.
  843. }
  844. */
  845. - (void)dealloc {
  846. // [_myTableView release];
  847. // [_myView release];
  848. // [super dealloc];
  849. [g_notify removeObserver:self];
  850. }
  851. //归位
  852. - (void)resetViewFrame{
  853. [UIView animateWithDuration:0.3 animations:^{
  854. self.view.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH, self.view.frame.size.height);
  855. }];
  856. }
  857. @end