2011-03-29 88 views
0

我正在實現基於MPMediaPickerController的應用程序。在那當我試圖打開音樂應用程序時,它需要帶我到「播放列表」選項卡,而不是顯示「音樂」選項卡。爲此,我使用選定的索引屬性來製作它。但仍然無效。以下是我的代碼,請問你們能否幫助我,這很緊急。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]; 
    picker.tabBarController.selectedIndex=1; 
    [picker.tabBarController.selectedViewController viewDidAppear:YES]; 

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

謝謝, 錢德拉。

回答

0

不幸的是,您不能設置MPMediaPickerController的選定索引。這不是常規的UITabBarController。如果你想改變選定的索引,顏色等,你必須將其子類化。抱歉。

查詢http://bit.ly/krMNMK以獲取更多參考。