2011-03-29 26 views
0

我實現一個基本的應用程序,它允許選擇與應用程序中,從音樂播放列表打開播放列表直接標籤。我做到了。但我的問題是,它是直接顯示直接的音樂標籤。但按我的要求,我需要在用戶需要到該視圖來顯示播放列表選項卡。以下是我的代碼,可能通過使用MPMediaPickerController

MPMediaPickerController *picker = 
    [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic]; 

    picker.delegate      = self; 
    picker.allowsPickingMultipleItems = YES; 
    picker.prompt      = NSLocalizedString (@"Select any song from the list", @"Prompt to user to choose some songs to play"); 

    // The media item picker uses the default UI style, so it needs a default-style 
    //  status bar to match it visually 
    [[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleDefault animated: YES]; 

    [self presentModalViewController: picker animated: YES]; 
    [picker release]; 

回答

3
-(IBAction)btnSelectSong:(id)sender 
{ 

     MPMediaPickerController *picker = 
     [[MPMediaPickerController alloc] 
     initWithMediaTypes: MPMediaTypeAnyAudio]; 

     [picker setDelegate: self]; 
     [picker setAllowsPickingMultipleItems: YES]; 
     picker.prompt = 
     NSLocalizedString (@"Add songs to play", 
          "Prompt in media item picker"); 

     [self presentModalViewController: picker animated: YES]; 

} 
0

開口MPMediaPickerController的播放列表部分按照蘋果的文檔

如已經我回答在這裏是不可能的: 您需要實現自己的選擇器,使用媒體查詢(按歌曲,藝術家等)。

您需要實現自己的選擇器,使用媒體查詢(按歌曲,藝術家等)。

我建議閱讀:「Using the iPod Library」在蘋果的 「iPod庫訪問編程指南」

和更具體: MPMediaPlaylist Class Ref

相關問題