You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.7 KiB
91 lines
2.7 KiB
1 year ago
|
//
|
||
|
// VolumeViewController.m
|
||
|
// watch
|
||
|
//
|
||
|
// Created by xTT on 2017/7/17.
|
||
|
// Copyright © 2017年 xTT. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "VolumeViewController.h"
|
||
|
|
||
|
@interface VolumeViewController ()
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation VolumeViewController
|
||
|
|
||
|
@synthesize myDataSource = _myDataSource;
|
||
|
|
||
|
- (NSMutableArray *)myDataSource{
|
||
|
if (!_myDataSource) {
|
||
|
_myDataSource = [[NSMutableArray alloc] initWithArray:@[@[@"1",@"2",@"3",@"4",@"5",@"6"]]];
|
||
|
}
|
||
|
return _myDataSource;
|
||
|
}
|
||
|
|
||
|
- (NSNumber *)volume{
|
||
|
if (!_volume) {
|
||
|
_volume = cUser.cDevice.opSettingVolume;
|
||
|
}
|
||
|
return _volume;
|
||
|
}
|
||
|
|
||
|
- (void)viewDidLoad {
|
||
|
[super viewDidLoad];
|
||
|
// Do any additional setup after loading the view.
|
||
|
}
|
||
|
|
||
|
- (IBAction)rightBarItemClick:(UIBarButtonItem *)sender{
|
||
|
WEAKSELF
|
||
|
[cUser.cDevice editOperationDeviceInfoWithParameters:@{@"opSettingVolume":self.volume}
|
||
|
success:^(id responseObject) {
|
||
|
cUser.cDevice.opSettingVolume = weakSelf.volume;
|
||
|
[weakSelf goBack:sender];
|
||
|
} failure:^(id faiObject) {
|
||
|
|
||
|
}];
|
||
|
}
|
||
|
|
||
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||
|
baseCell *cell = [tableView dequeueReusableCellWithIdentifier:@"baseCell"];
|
||
|
if (!cell) {
|
||
|
cell = [[baseCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"baseCell"];
|
||
|
|
||
|
UIImageView *imageView = [[UIImageView alloc] initWithImage:[myHelper getImageWithName:@"未选中"]];
|
||
|
cell.accessoryView = imageView;
|
||
|
}
|
||
|
NSString *title = self.myDataSource[indexPath.section][indexPath.row];
|
||
|
cell.textLabel.text = title;
|
||
|
|
||
|
UIImageView *imageView = (UIImageView *)cell.accessoryView;
|
||
|
if ([title integerValue] == [self.volume integerValue]) {
|
||
|
imageView.image = [myHelper getImageWithName:@"选中"];
|
||
|
}else{
|
||
|
imageView.image = nil;
|
||
|
}
|
||
|
return cell;
|
||
|
}
|
||
|
|
||
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||
|
self.volume = @(indexPath.row + 1);
|
||
|
[tableView reloadData];
|
||
|
}
|
||
|
|
||
|
|
||
|
- (void)didReceiveMemoryWarning {
|
||
|
[super didReceiveMemoryWarning];
|
||
|
// Dispose of any resources that can be recreated.
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
#pragma mark - Navigation
|
||
|
|
||
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||
|
// Get the new view controller using [segue destinationViewController].
|
||
|
// Pass the selected object to the new view controller.
|
||
|
}
|
||
|
*/
|
||
|
|
||
|
@end
|