gpt4 book ai didi

ios - 如何像 Apple Music 一样创建 UIActionSheet 或 UIAlertController(UIAlertControllerStyleActionSheet)?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:34:08 28 4
gpt4 key购买 nike

在我的应用程序中,我想创建一个 UIActionSheetUIAlertController (UIAlertControllerStyleActionSheet) 就像 Apple Music。

我想在 UIActionSheet 的第一行显示用户个人资料图片和用户的一些基本详细信息,以及像普通 UIActionSheet 一样的其他选项。

Apple Music My Requiremnt

最佳答案

在某种程度上,我可以为您提供问题的示例编码

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];

关于ios - 如何像 Apple Music 一样创建 UIActionSheet 或 UIAlertController(UIAlertControllerStyleActionSheet)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34962977/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com