我有一个应用程序,我在其中设置了通知。当通知发出时,声音取决于设备的音量级别。所以我想在我的视图中添加一个进度条或滑块来控制设备的音量。例如,您有一个视图,其中您有滑块/进度条。当你滑动它们时,音量会增加或减少。如何通过这些工具控制设备的音量?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ 静态 NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
if(indexPath.row==0)
{
cell.textLabel.text = @"Vibration";
UISwitch *switch_vib=[[UISwitch alloc] initWithFrame:CGRectMake(210, 9, 94, 27 )];
switch_vib.on=YES;
[cell addSubview:switch_vib];
}
else //if(indexPath.row==1)
cell.textLabel.text = @"Set volumes";
return cell;
}
提前致谢...