| | |
| | | |
| | | @interface DetailDataViewController ()<UITableViewDelegate,UITableViewDataSource> |
| | | { |
| | | |
| | | NSTimer * myTimer; // 更新设备状态 |
| | | } |
| | | |
| | | @property(nonatomic,strong) UITableView * tableView; |
| | |
| | | [self initView]; |
| | | |
| | | [self getDetailList]; |
| | | |
| | | //每1秒运行一次function方法。 |
| | | myTimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(updateDynamicData) userInfo:nil repeats:YES]; |
| | | |
| | | } |
| | | |
| | | -(void)viewWillAppear:(BOOL)animated |
| | |
| | | [super viewWillAppear:YES]; |
| | | |
| | | self.navigationController.navigationBarHidden = YES; |
| | | |
| | | if (myTimer == nil) |
| | | myTimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(updateDynamicData) userInfo:nil repeats:YES]; |
| | | else |
| | | //开启定时器 |
| | | [myTimer setFireDate:[NSDate distantPast]]; |
| | | } |
| | | |
| | | -(void)viewDidDisappear:(BOOL)animated |
| | | { |
| | | [super viewDidDisappear:YES]; |
| | | |
| | | //关闭定时器 |
| | | if(myTimer) |
| | | [myTimer setFireDate:[NSDate distantFuture]]; |
| | | } |
| | | |
| | | -(void) initView |
| | |
| | | |
| | | |
| | | #pragma mark custom function |
| | | -(void)updateDynamicData |
| | | { |
| | | [self getDetailList]; |
| | | } |
| | | |
| | | -(void)getDetailList |
| | | { |
| | | NSMutableDictionary *param = [[NSMutableDictionary alloc] init]; |