gpt4 book ai didi

ios - SGActionView 网格菜单

转载 作者:行者123 更新时间:2023-11-28 18:32:29 25 4
gpt4 key购买 nike

我正在开发一个应用程序,我在其中使用我从这里下载的网格菜单 https://github.com/sagiwei/SGActionView它工作正常,但我的问题是我不知道当用户从这个网格菜单中点击一个按钮时我将如何显示 nslog。例如,如果用户点击 Facebook,它应该 NSLog “Facebook Pushed”。这是调用网格的代码。

[SGActionView showGridMenuWithTitle:@"Share"
itemTitles:@[ @"Facebook", @"Twitter", @"Google+", @"Linkedin",
@"Weibo", @"WeChat", @"Pocket", @"Dropbox" ]
images:@[ [UIImage imageNamed:@"facebook"],
[UIImage imageNamed:@"twitter"],
[UIImage imageNamed:@"googleplus"],
[UIImage imageNamed:@"linkedin"],
[UIImage imageNamed:@"weibo"],
[UIImage imageNamed:@"wechat"],
[UIImage imageNamed:@"pocket"],
[UIImage imageNamed:@"dropbox"]]
selectedHandle:nil];

请告诉我从这个网格(facebook、twitter 或任何其他)按下按钮时如何执行操作谢谢

最佳答案

好的,我查了图书馆。

方法原型(prototype)为

+ (void)showGridMenuWithTitle:(NSString *)title
itemTitles:(NSArray *)itemTitles
images:(NSArray *)images
selectedHandle:(SGMenuActionHandler)handler

SGMenuActionHandler 是 block 类型。

typedef void(^SGMenuActionHandler)(NSInteger index);

所以你可以这样使用

[SGActionView showGridMenuWithTitle:@"Share"
itemTitles:@[ @"Facebook", @"Twitter", @"Google+", @"Linkedin",
@"Weibo", @"WeChat", @"Pocket", @"Dropbox" ]
images:@[ [UIImage imageNamed:@"facebook"],
[UIImage imageNamed:@"twitter"],
[UIImage imageNamed:@"googleplus"],
[UIImage imageNamed:@"linkedin"],
[UIImage imageNamed:@"weibo"],
[UIImage imageNamed:@"wechat"],
[UIImage imageNamed:@"pocket"],
[UIImage imageNamed:@"dropbox"]]
selectedHandle:^(NSInteger index){

if(index == 0){
}
else if(index == 1){
},....

}];

正如我对您的原始帖子的评论,我以前从未使用过该库。这只是一个猜测。

关于ios - SGActionView 网格菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25804034/

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