-
Notifications
You must be signed in to change notification settings - Fork 4
/
SettingsViewController.m
139 lines (111 loc) · 3.59 KB
/
SettingsViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//
// SettingsViewController.m
// FFmpegRadioPlayer
//
// Created by Liao KuoHsun on 2014/1/31.
// Copyright (c) 2014年 Liao KuoHsun. All rights reserved.
//
#import "SettingsViewController.h"
#import "StopTimePickerViewController.h"
#import "ChooseCacheSizeViewController.h"
@interface SettingsViewController ()
{
}
@end
@implementation SettingsViewController
{
NSArray *PlayTimerSecondOptions;
NSArray *PlayTimerMinuteOptions;
}
@synthesize pViewController;
@synthesize AutoReplaySwitch, CacheSizeCell, StopTimerCell;
@synthesize CacheSizeValueLabel, StopTimerValueLabel;
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)viewWillAppear:(BOOL)animated
{
if(pViewController.audioReplaySwitch==eReplaySwitch_On)
{
[AutoReplaySwitch setSelectedSegmentIndex:0];
}
else
{
[AutoReplaySwitch setSelectedSegmentIndex:1];
}
NSString *pTmp;
if(pViewController.cacheSize==eCacheSize_Low)
{
pTmp = @"Low";
}
else if(pViewController.cacheSize==eCacheSize_Middle)
{
pTmp = @"Middle";
}
else
{
pTmp = @"High";
}
[CacheSizeValueLabel setText:pTmp];
NSString* pTime = [[NSString alloc]initWithFormat:@"%dh %dm" ,
pViewController.stopTimerHours,
pViewController.stopTimerMinutes];
[StopTimerValueLabel setText:pTime];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
// For static cell, below functions are unnecessary
//- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"didSelectRowAtIndexPath %d",indexPath.row);
}
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"accessoryButtonTappedForRowWithIndexPath %d",indexPath.row);
if(indexPath.row==0)
{
;
}
//[self performSegueWithIdentifier:@"ShowDailyProgram" sender:self.view];
}
- (IBAction)AutoReplaySwitchPressed:(id)sender {
pViewController.audioReplaySwitch = [sender selectedSegmentIndex];
NSLog(@"[sender selectedSegmentIndex]=%d",[sender selectedSegmentIndex]);
}
#pragma mark - segue control
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
NSLog(@"prepareForSegue");
if([[segue identifier] isEqualToString:@"SetCacheSize"])
{
ChooseCacheSizeViewController *dstViewController = [segue destinationViewController];
dstViewController.pViewController = self.pViewController;
;
}
else if([[segue identifier] isEqualToString:@"SetStopTimer"])
{
StopTimePickerViewController *dstViewController = [segue destinationViewController];
dstViewController.pViewController = self.pViewController;
;
}
}
@end