0

I have an application in which i have set a notification. When notification raise then sound of that is according to device's volume level. So i want to add a progress bar or slider to control device's volume level in my view. For example u have a view in which u have slider/progress bar. When u slide them then level of volume increase or decrease. How control volume of device by any of those tools?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{ static 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;

}

Thanks in advance...

iRavan12
  • 101
  • 6

1 Answers1

0

You can only use the MPVolumeView to let the user control the volume. All you need to do is add that view to your view hierarchy, it takes care of setting the volume and reflecting any volume change done by the hardware buttons. You can walk its subviews to find the slider to adapt its design. There is (deliberately) no public way to programmatically change the volume.

DarkDust
  • 90,870
  • 19
  • 190
  • 224