用兩個Button調整應用中音量的大小,一個增大,一個減小。通過學習教程,寫出了下面代碼:
- (IBAction)volumeUp:(id)sender
{
[[musicPlayer setVolume:["current volume???" + 0.1]];
}
- (IBAction)volumeDown:(id)sender
{
[[musicPlayer setVolume:["current volume???" - 0.1]];
}
但是好像不對。不知道哪裡不對,請指教,謝謝。
- (IBAction)volumeUp:(id)sender
{
[[musicPlayer setVolume:musicPlayer.volume+0.1];
}
- (IBAction)volumeDown:(id)sender
{
[[musicPlayer setVolume:musicPlayer.volume-0.1];
}