2016-01-23 59 views
3

在我的应用程序中,我想创建一个UIActionSheetUIAlertController (UIAlertControllerStyleActionSheet),就像Apple Music一样。如何创建像Apple音乐一样的UIActionSheet或UIAlertController(UIAlertControllerStyleActionSheet)?

我想在UIActionSheet的第一行显示用户个人资料图片和用户的一些基本信息,以及其他选项,如正常UIActionSheet

Apple MusicMy Requiremnt

+0

好了,你有没有尝试实现这一目标呢?请在您尝试使用您要显示的所有数据显示自定义视图的位置显示当前设置。 – luk2302

+0

截至目前我正在做的是自定义的UIViewControllers,我已经设置了委托和东西。目前的Apple SDK没有提示他们如何做这个 –

回答

0

在一定程度上我可以给你的样品编码的提问

UIAlertController *alertMusicVideos = [UIAlertController 
          alertControllerWithTitle:@"Music Videos" 
          message:nil 
          preferredStyle:UIAlertControllerStyleActionSheet]; 

UIAlertAction *actionAddProfilePhoto = [UIAlertAction 
        actionWithTitle:@"" 
        style:UIAlertActionStyleDefault 
        handler:^(UIAlertAction * action) 
        { 
         //Do Whatever you want to do here 
         [alertMusicVideos dismissViewControllerAnimated:YES completion:nil]; 

        }]; 

UIAlertAction *actionPlayNext = [UIAlertAction 
        actionWithTitle:@"Play Next" 
        style:UIAlertActionStyleDefault 
        handler:^(UIAlertAction * action) 
        { 
         //Do some thing here 
         [alertMusicVideos dismissViewControllerAnimated:YES completion:nil]; 

        }]; 
UIAlertAction *actionAddToUpNext = [UIAlertAction 
         actionWithTitle:@"Add to Up Next" 
         style:UIAlertActionStyleDefault 
         handler:^(UIAlertAction * action) 
         { 
          //Do Whatever you want to do here when click this button 
          [alertMusicVideos dismissViewControllerAnimated:YES completion:nil]; 

         }]; 
UIAlertAction *actionAddToPlayList = [UIAlertAction 
         actionWithTitle:@"Add To PlayList" 
         style:UIAlertActionStyleDefault 
         handler:^(UIAlertAction * action) 
         { 
           //Do Whatever you want to do here when click this button 
          [alertMusicVideos dismissViewControllerAnimated:YES completion:nil]; 

         }]; 
UIAlertAction *actionDeleteFromMyMusic = [UIAlertAction 
           actionWithTitle:@"Delete From My Music" 
           style:UIAlertActionStyleDestructive 
           handler:^(UIAlertAction * action) 
           { 
            //Do Whatever you want to do here when click this button 
            [alertMusicVideos dismissViewControllerAnimated:YES completion:nil]; 

           }]; 

UIAlertAction *actionCancel = [UIAlertAction 
           actionWithTitle:@"Cancel" 
           style:UIAlertActionStyleDestructive 
           handler:^(UIAlertAction * action) 
           { 
            //Do Whatever you want to do here when click this button 
            [alertMusicVideos dismissViewControllerAnimated:YES completion:nil]; 

           }]; 

[actionAddProfilePhoto setValue:[[UIImage imageNamed:@"yourProfile.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forKey:@"image"]; 

[alertMusicVideos addAction:actionAddProfilePhoto]; 
[alertMusicVideos addAction:actionPlayNext]; 
[alertMusicVideos addAction:actionAddToUpNext]; 
[alertMusicVideos addAction:actionAddToPlayList]; 
[alertMusicVideos addAction:actionDeleteFromMyMusic]; 
[alertMusicVideos addAction:actionCancel]; 

[self presentViewController:alertMusicVideos animated:YES completion:nil]; 
+0

错误!大错特错! – RyanCodes

相关问题