ThingsDetailViewController.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. //
  2. // ThingsDetailViewController.m
  3. // kneet
  4. //
  5. // Created by Jason Lee on 3/16/15.
  6. // Copyright (c) 2015 ntels. All rights reserved.
  7. //
  8. #import "RequestHandler.h"
  9. #import "DeviceModel.h"
  10. #import "CustomImageView.h"
  11. #import "CustomLabel.h"
  12. #import "CustomTextField.h"
  13. #import "CustomButton.h"
  14. #import "UIImageView+WebCache.h"
  15. #import "CustomTableView.h"
  16. #import "ChangeDeviceNamePopupView.h"
  17. #import "ValidateUtil.h"
  18. #import "CommandClassControlDetailView.h"
  19. #import "ThingsViewController.h"
  20. #import "ThingsDetailViewController.h"
  21. #import "ModifyDeviceNamePopupView.h"
  22. #import "JYPullToRefreshController.h"
  23. /**
  24. Hub 명 Text Color : kUITextColor03
  25. Update 알람 Text Color : kUITextColor04
  26. Device 상태 표시 Text Color
  27. - 꺼짐 : kUITextColor01
  28. - 켜짐 : kUITextColor02
  29. - 잠김 : kUITextColor02
  30. - 열림 : kUITextColor01
  31. 도어센서 마지막 동작 Text Color : kUITextColor01
  32. 도어센서 상태표시 Text Color
  33. - 열림 : kUITextColor02
  34. - 닫힘 : kUITextColor01
  35. Offline Text Color : kUITextColor01
  36. 노드명 표시 Text Color : kUITextColor03
  37. value 표시 Text Color : kUITextColor04
  38. (이미지 명)
  39. 플러그 on : img_things_detail_06_01_plug_state_on
  40. 플러그 off : img_things_detail_06_01_plug_state_off
  41. 밸브 on : img_things_detail_05_02_valve_state_locked
  42. 밸브 off : img_things_detail_05_02_valve_state_unlocked
  43. 도어센서 on : img_things_detail_01_02_sensor_door_open
  44. 도어센서 off : img_things_detail_01_02_sensor_door_close
  45. 장치 열림,켜짐 : img_things_detail_06_99_btn_off ,~off_press
  46. 장치 닫힘,꺼짐 : img_things_detail_06_99_btn_on ,~on_press
  47. **/
  48. @implementation ThingsDetailTitleTableViewCell
  49. @end
  50. @implementation ThingsDetailControlTableViewCell
  51. - (void)awakeFromNib {
  52. _controlContainer.pagingEnabled = YES;
  53. _controlContainer.scrollEnabled = NO;
  54. _pageControl.hidden = YES;
  55. }
  56. @end
  57. @implementation ThingsDetailOptionTableViewCell
  58. @end
  59. @implementation ThingsDetailDeviceIdTableViewCell
  60. @end
  61. @interface ThingsDetailViewController () <UITableViewDataSource, UITableViewDelegate ,changeDeviceNameDelegate> {
  62. DeviceDetailModel *_deviceDetail;
  63. // ModifyDeviceNamePopupView *_mpopup;
  64. NSArray<NodeModel> *_mandatoryNodes, *_optionalNodes;
  65. UIPageControl *_pageControl;
  66. NSTimer *_deviceBackgroundTimer;
  67. }
  68. @property (strong, nonatomic) JYPullToRefreshController *refreshController;
  69. @end
  70. #pragma mark - Class Definition
  71. @implementation ThingsDetailViewController
  72. - (void)viewDidLoad {
  73. [super viewDidLoad];
  74. // Do any additional setup after loading the view.
  75. [self initUI];
  76. [self prepareViewDidLoad];
  77. }
  78. - (void)initUI {
  79. //initialize tableView
  80. [self initTableViewAsDefaultStyle:_tableView];
  81. _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, IPHONE_WIDTH, 30.0f)];
  82. // [self setThingsDetailPopoverOptions];
  83. [self initRefreshController];
  84. [self setMoreBtnArray];
  85. }
  86. - (void)initRefreshController {
  87. //set refresh controls
  88. __weak typeof(self) weakSelf = self;
  89. self.refreshController = [[JYPullToRefreshController alloc] initWithScrollView:self.tableView];
  90. self.refreshController.pullToRefreshHandleAction = ^{
  91. [weakSelf requestDeviceDetail:@YES];
  92. };
  93. }
  94. //- (void)setThingsDetailPopoverOptions {
  95. // //set Popover Contents
  96. // __weak typeof(self) weakSelf = self;
  97. // _popooverOptionArray = [[NSMutableArray alloc] init];
  98. //
  99. // [_popooverOptionArray addObject:@{@"menuName" : NSLocalizedString(@"새로 고침",nil),
  100. // @"iconName": @"img_bg_morepopup_icon_refresh",
  101. // @"target": weakSelf,
  102. // @"selector": [NSValue valueWithPointer:@selector(requestDeviceDetail:)]}];
  103. //
  104. // if ([JDFacade facade].loginUser.level > 10) {
  105. // [_popooverOptionArray addObject:@{@"menuName" : NSLocalizedString(@"이름 변경", @"이름 변경"),
  106. // @"iconName": @"img_bg_morepopup_icon_edit",
  107. // @"target": weakSelf,
  108. // @"selector": [NSValue valueWithPointer:@selector(modifyDeviceName)]}];
  109. //
  110. // }
  111. //}
  112. - (void)prepareViewDidLoad {
  113. [self requestDeviceDetail:@YES];
  114. }
  115. //- (void)modifyDeviceName {
  116. //
  117. // _mpopup = [[ModifyDeviceNamePopupView alloc] initFromNib];
  118. // _mpopup.txtDeviceName.text = _deviceDetail.deviceName;
  119. //
  120. // [_mpopup showWithCompletion:^(CustomAlertView *alertView, NSInteger buttonIndex) {
  121. // if (buttonIndex == 0) {//OK
  122. // [self requestDeviceUpdate];
  123. // }
  124. // }];
  125. //}
  126. - (void)changeDeviceName:(NSString *)deviceName {
  127. [self requestDeviceDetail:@YES];
  128. _lblTitle.text = [deviceName isEqualToString:@""] ? _deviceDetail.prdName : deviceName;
  129. }
  130. - (void)updateTitle {
  131. [self setMoreBtnArray];
  132. if ([_deviceDetail.prdName isEqualToString:_deviceDetail.prdUserName] || [_deviceDetail.prdUserName isEqualToString:@""]) {
  133. _lblTitle.text = _deviceDetail.prdName;
  134. } else {
  135. _lblTitle.text = _deviceDetail.prdUserName;
  136. }
  137. _btnUpdate.hidden = !_deviceDetail.isProfileUpdate;
  138. if (![JDFacade facade].loginUser.isHomehubOnline) {
  139. _lblTitle.text = @"홈허브 오프라인";
  140. [_lblTitle setColor:kUITextColor01 text:_lblTitle.text];
  141. return;
  142. }
  143. if (_deviceDetail && !_deviceDetail.isOnline) {
  144. _lblTitle.text = @"장치 상태를 확인하세요";
  145. [_lblTitle setColor:kUITextColor02 text:_lblTitle.text];
  146. return;
  147. }
  148. }
  149. -(NSString *)getDeviceDetailUrl
  150. {
  151. NSMutableArray *arr = [NSMutableArray array];
  152. arr[0] = _refDevice.deviceId;
  153. arr[1] = _refDevice.nodeId;
  154. return [[JDFacade facade] getUrlWithCustAndGroupID:API_GET_NODE_DETAIL arguments:arr];
  155. }
  156. #pragma mark - Main Logic
  157. - (void)requestDeviceDetail:(id)arg {
  158. BOOL showLoadingView = NO;
  159. if (arg) {
  160. showLoadingView = [arg isKindOfClass:[NSTimer class]] ? [((NSTimer *)arg).userInfo boolValue] : [arg boolValue];
  161. }
  162. NSString *path = [NSString stringWithFormat:[self getDeviceDetailUrl], _refDevice.deviceId];
  163. [[RequestHandler handler] sendAsyncRequestAPIPath:path method:ksHTTPRequestGET parameters:nil
  164. modelClass:[DeviceDetailModel class] showLoadingView:showLoadingView completion:^(id responseObject) {
  165. if (!responseObject) {//응답결과가 잘못되었거나 없을 경우,
  166. return;
  167. }
  168. _deviceDetail = (DeviceDetailModel *)responseObject;
  169. NSLog(@"Device Detail : %@", _deviceDetail);
  170. if (_deviceDetail) {//API 성공 ,
  171. [self setDeviceContents];
  172. [self requestPollingDeviceStatusInBackground];
  173. }
  174. //refresh controller
  175. if (self.refreshController && self.refreshController.refreshState == JYRefreshStateLoading) {
  176. [self.refreshController stopRefreshWithAnimated:YES completion:nil];
  177. }
  178. } failure:^(id errorObject) {
  179. [self releaseDeviceTimer];
  180. JDErrorModel *error = (JDErrorModel *)errorObject;
  181. [[JDFacade facade] alert:error.errorMessage];
  182. }];
  183. }
  184. //디바이스 상태를 3초마다 갱신함.
  185. - (void)requestPollingDeviceStatusInBackground {
  186. //schedul timer.
  187. // if (!_deviceBackgroundTimer) {
  188. // _deviceBackgroundTimer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(requestDeviceDetail:) userInfo:@NO repeats:YES];
  189. // }
  190. }
  191. - (void)setDeviceContents {
  192. [self updateTitle];
  193. _mandatoryNodes = (NSArray<NodeModel> *)[_deviceDetail.cmdclsList filteredArrayUsingPredicateFormat:@"cmdclsMandatoryYn == %@", @"Y"];
  194. _optionalNodes = (NSArray<NodeModel> *)[_deviceDetail.cmdclsList filteredArrayUsingPredicateFormat:@"cmdclsMandatoryYn == %@", @"N"];
  195. [_tableView reloadData];
  196. }
  197. //- (void)requestDeviceUpdate {
  198. // //parameters
  199. // NSDictionary *parameter = @{@"device_name": _mpopup.txtDeviceName.text};
  200. //
  201. // NSString *path = [NSString stringWithFormat:API_GET_DEVICE_UPDATE, _deviceDetail.deviceId];
  202. //
  203. // [[RequestHandler handler] sendAsyncPostRequestAPIPath:path parameters:parameter modelClass:[JDJSONModel class] completion:^(id responseObject) {
  204. //
  205. // _refDevice.deviceName = _deviceDetail.deviceName = _mpopup.txtDeviceName.text;
  206. // [_tableView reloadData];
  207. //
  208. // //리스트를 다시 로드함.
  209. // ThingsViewController *vc = [[JDFacade facade] viewControllerOnNaviationController:[ThingsViewController class]];
  210. // [vc.collectionView reloadData];
  211. //
  212. // } failure:^(id errorObject) {
  213. // JDErrorModel *error = (JDErrorModel *)errorObject;
  214. // [[JDFacade facade] alert:error.errorMessage];
  215. // }];
  216. //}
  217. - (void)requestDeleteDevice {
  218. //parameters
  219. NSString *path = [NSString stringWithFormat:API_DELETE_DEVICE, _deviceDetail.deviceId];
  220. [[RequestHandler handler] sendAsyncRequestAPIPath:path method:ksHTTPRequestDELETE parameters:nil modelClass:[JDJSONModel class] showLoadingView:YES completion:^(id responseObject) {
  221. [[JDFacade facade] toast:NSLocalizedString(@"장치가 삭제되었습니다", @"장치가 삭제되었습니다")];
  222. // if ([JDFacade facade].loginHomeGroup.deviceId && ![[JDFacade facade].loginHomeGroup.deviceId isEmptyString]) {
  223. // if ([[JDFacade facade].loginHomeGroup.deviceId isEqualToString:_deviceDetail.deviceId]) {//현재 홈의 스마튼폰일 경우,
  224. // [JDFacade facade].loginHomeGroup.deviceId = nil;
  225. // [JDFacade facade].loginHomeGroup.deviceAuthorization = nil;
  226. // [JDFacade facade].loginHomeGroup.deviceKey = nil;
  227. // }
  228. // }
  229. //리스트를 다시 로드함.
  230. ThingsViewController *vc = [[JDFacade facade] viewControllerOnNaviationController:[ThingsViewController class]];
  231. [vc prepareViewDidLoad];
  232. [self.navigationController popToRootViewControllerAnimated:YES];
  233. } failure:^(id errorObject) {
  234. JDErrorModel *error = (JDErrorModel *)errorObject;
  235. [[JDFacade facade] alert:error.errorMessage];
  236. }];
  237. }
  238. #pragma mark - UITableView DataSource & Delegate
  239. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  240. return 4;
  241. }
  242. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  243. NSInteger count = 1;
  244. if (section == 1) {
  245. count = _deviceDetail && _deviceDetail.cmdclsList && _deviceDetail.cmdclsList.count > 0;
  246. } else if (section == 2) {//optional nodes
  247. count = _optionalNodes.count; //두번째 이후부터 옵셔널 노드임.
  248. }
  249. return count;
  250. }
  251. - (CGFloat)heightForMandatoryNode {
  252. CGFloat height = 0;
  253. NodeModel *node = _deviceDetail.cmdclsList.firstObject;
  254. if (node.cmdclsType == CmdClsTypeSwitchBinary || node.cmdclsType == CmdClsTypeValve) {
  255. height = 347.0f; //275 || 347
  256. } else {
  257. height = 275.0f;
  258. }
  259. height += _mandatoryNodes.count > 1 ? 75 : 0;
  260. return height;
  261. }
  262. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  263. CGFloat height = 86;
  264. NSInteger section = indexPath.section;
  265. if (section == 0) {
  266. height = 68;
  267. } else if (section == 1) {
  268. // height = [self heightForMandatoryNode] + 35.0f;
  269. height = 322;
  270. } else if (section == 2) {
  271. height = 63;
  272. // if (indexPath.row == _deviceDetail.nodes.count - 2) {
  273. // height += 35;
  274. // }
  275. } else if (section == 3) {
  276. height = 89;
  277. }
  278. return height;
  279. }
  280. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  281. UITableViewCell *cell = nil;
  282. NSInteger section = indexPath.section;
  283. if (section == 0) {//title
  284. ThingsDetailTitleTableViewCell *tcell = (ThingsDetailTitleTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"TitleCellIdentifier"];
  285. // [tcell.imgvDevice sd_setImageWithURL:[NSURL URLWithString:_deviceDetail.imageFileName] placeholderImage:nil options:SDWebImageRefreshCached];
  286. tcell.lblDeviceUpdate.hidden = !_deviceDetail.isProfileUpdate;
  287. cell = tcell;
  288. } else if (section == 1) {//device control
  289. ThingsDetailControlTableViewCell *tcell = (ThingsDetailControlTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"ControlCellIdentifier"];
  290. //뷰를 초기화함.
  291. [[tcell.controlContainer subviews] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
  292. UIView *subview = (UIView *)obj;
  293. [subview removeFromSuperview];
  294. }];
  295. if (_deviceDetail) {
  296. tcell.controlContainer.scrollEnabled = _mandatoryNodes.count > 1;
  297. tcell.controlContainer.contentSize = CGSizeMake(IPHONE_WIDTH * _mandatoryNodes.count, [self heightForMandatoryNode]);
  298. tcell.controlContainer.showsHorizontalScrollIndicator = NO;
  299. if (tcell.controlContainer.scrollEnabled) {
  300. tcell.controlContainer.delegate = self;
  301. }
  302. tcell.pageControl.hidden = !tcell.controlContainer.scrollEnabled;
  303. if (!tcell.pageControl.hidden && !_pageControl) {
  304. _pageControl = tcell.pageControl;
  305. _pageControl.numberOfPages = _mandatoryNodes.count;
  306. }
  307. __block CGFloat width = 0;
  308. for (NodeModel *node in _mandatoryNodes) {
  309. node.refDevice = _refDevice;
  310. CommandClassControlView *controlView = [CommandClassControlDetailView viewForCommandClass:node.cmdclsType];
  311. node.deviceId = _deviceDetail.deviceId;
  312. node.nodeId = _deviceDetail.nodeId;
  313. controlView.node = node;
  314. controlView.isMandatoryNode = [node.cmdclsMandatoryYn boolValue] && _mandatoryNodes.count > 1;
  315. tcell.controlContainer.hidden = !controlView;
  316. if (!tcell.controlContainer.hidden) {
  317. controlView.x = width;
  318. UIView *superview = tcell.controlContainer;
  319. [superview addSubview:controlView];
  320. [controlView mas_makeConstraints:^(MASConstraintMaker *make) {
  321. make.size.mas_equalTo(controlView.frame.size);
  322. make.leading.equalTo(superview).offset(width);
  323. // make.trailing.equalTo(superview).offset(width+IPHONE_WIDTH);
  324. width += IPHONE_WIDTH;
  325. }];
  326. }
  327. }
  328. }
  329. cell = tcell;
  330. } else if (section == 2) {//option control
  331. ThingsDetailOptionTableViewCell *tcell = (ThingsDetailOptionTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"OptionCellIdentifier"];
  332. NodeModel *node = _deviceDetail.cmdclsList[indexPath.row + _mandatoryNodes.count];
  333. tcell.lblNodeName.text = node.cmdclsName;
  334. tcell.lblNodeValue.text = node.contentValueMsg;
  335. cell = tcell;
  336. } else if (section == 3){ // Device Id
  337. ThingsDetailDeviceIdTableViewCell *tcell = (ThingsDetailDeviceIdTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"DeviceIdCellIdentifier"];
  338. tcell.lblDeviceName.text = _deviceDetail.deviceModelId;
  339. tcell.lblDeviceId.text = _deviceDetail.deviceId;
  340. cell = tcell;
  341. }
  342. return cell;
  343. }
  344. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  345. [super tableView:tableView didSelectRowAtIndexPath:indexPath];
  346. }
  347. - (void)setMoreBtnArray {
  348. _moreBtnArray = [NSMutableArray array];
  349. if (![[JDFacade facade].loginUser hasHomeHub]) {
  350. [_btnOption setHidden:YES];
  351. }
  352. if([[JDFacade facade].loginUser.gradeCode isEqualToString:KNEET_MEMBER_MASTER]) {
  353. for (int i = 0; i < 3; i++) {
  354. MoreBtnModel *btnModel;
  355. switch (i) {
  356. case 0:
  357. btnModel = [[MoreBtnModel alloc] initWithTyep:NameChange isEnable:YES];
  358. break;
  359. case 1:
  360. btnModel = [[MoreBtnModel alloc] initWithTyep:Del isEnable:YES];
  361. break;
  362. case 2:
  363. btnModel = [[MoreBtnModel alloc] initWithTyep:Refresh isEnable:YES];
  364. break;
  365. default:
  366. break;
  367. }
  368. [_moreBtnArray addObject:btnModel];
  369. }
  370. } else {
  371. MoreBtnModel *btnModel = [[MoreBtnModel alloc] initWithTyep:Refresh isEnable:YES];
  372. [_moreBtnArray addObject:btnModel];
  373. }
  374. }
  375. #pragma mark - MoreButtonDelegate
  376. -(void)moreBtnAction:(id)sender
  377. {
  378. NSInteger tag = [(UIButton *)sender tag];
  379. NSLog(@"MoreBtn Action : %li", (long)tag);
  380. switch (tag) {
  381. case NameChange:
  382. {
  383. ChangeDeviceNamePopupView *popup = [[ChangeDeviceNamePopupView alloc]initFromNib:_deviceDetail];
  384. popup.deviceDetailModel = _deviceDetail;
  385. popup.delegate = self;
  386. [popup show];
  387. }
  388. break;
  389. case Del:
  390. {
  391. NSLog(@"장치 삭제");
  392. }
  393. break;
  394. case Refresh:
  395. {
  396. [self requestDeviceDetail:@YES];
  397. }
  398. break;
  399. default:
  400. break;
  401. }
  402. }
  403. #pragma mark - UI Events
  404. - (IBAction)btnOptionTouched:(id)sender {
  405. // [self toggleOptions:sender];
  406. [self toggleOptionsWithArray:sender btnArray:_moreBtnArray];
  407. }
  408. - (IBAction)btnUpdateTouched:(id)sender {
  409. NSLog(@"업데이트");
  410. }
  411. - (IBAction)btnCloseTouched:(id)sender {
  412. [[JDFacade facade] dismissModalStack:YES completion:nil];
  413. }
  414. #pragma mark - ScrollView Delegate
  415. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  416. CGFloat pageWidth = scrollView.frame.size.width; // you need to have a **iVar** with getter for scrollView
  417. CGFloat fractionalPage = scrollView.contentOffset.x / pageWidth;
  418. NSInteger page = lround(fractionalPage);
  419. _pageControl.currentPage = page; // you need to have a **iVar** with getter for pageControl
  420. }
  421. -(void) receiveSocketData:(NSNotification *)notification {
  422. SocketModel *result = [[SocketModel alloc] initWithDictionary:notification.object error:nil];
  423. // CommandModel *response = [[CommandModel alloc] initWithDictionary:notification.object error:nil];
  424. NSLog(@"Result : %@", result);
  425. if ([result.messageType isEquestToIgnoreCase:MSG_TYPE_NODE_CONTENT]) {
  426. ContentModel *response = [[ContentModel alloc] initWithDictionary:notification.object error:nil];
  427. NSLog(@"Response : %@", response);
  428. // [weakSelf requestDeviceDetail:@YES];
  429. if ([_refDevice.deviceId isEqualToString:response.deviceId] && [_refDevice.nodeId isEqualToString:response.nodeId]) {
  430. [self requestDeviceDetail:@NO];
  431. }
  432. }
  433. // else if ([result.messageType isEquestToIgnoreCase:MSG_TYPE_NODE_COMMAND_RES]) {
  434. //
  435. // }
  436. // else if ([result.messageType isEquestToIgnoreCase:MSG_TYPE_NODE_REGIST_RES] || [result.messageType isEquestToIgnoreCase:MSG_TYPE_NODE_DELETE_RES]) {
  437. // [self refreshDeviceList];
  438. // }
  439. }
  440. #pragma mark - MemoryWarning
  441. - (void)releaseDeviceTimer {
  442. if (_deviceBackgroundTimer) {
  443. [_deviceBackgroundTimer invalidate];
  444. _deviceBackgroundTimer = nil;
  445. }
  446. }
  447. - (void)viewWillDisappear:(BOOL)animated {
  448. [self releaseDeviceTimer];
  449. }
  450. - (void)didReceiveMemoryWarning
  451. {
  452. [super didReceiveMemoryWarning];
  453. // Dispose of any resources that can be recreated.
  454. }
  455. @end