gpt4 book ai didi

iOS AlertView 应用扩展

转载 作者:行者123 更新时间:2023-12-01 17:38:51 25 4
gpt4 key购买 nike

我正在定制 keyboard (iOS App Extension) .我有一个 UICollectionView在我的Keyboard Layout , 所以当一个 item已选中 我要显示 message (例如 UIAlerView)。

这是我的代码:

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{

...

UIAlertController * alert= [UIAlertController
alertControllerWithTitle:@"My Title"
message:@"Enter User Credentials"
preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:alert animated:YES completion:nil];
}

我收到此错误: 'Feature not available in extensions of type com.apple.keyboard-service'
那么...有什么方法可以显示 message来自 App Extension ?

编辑:

这是一个例子。 IKEA Emoticons Keyboard显示一条消息(如选择一个项目后的 Android Toast)。

我也试过这个库:

iOS Toast Library

enter image description here

最佳答案

遗憾的是,没有办法在键盘扩展中显示 UIAlertView。实际上,在 InputViewController 的框架之上什么都不能显示。 Apple的文档中很清楚:

...a custom keyboard can draw only within the primary view of its UIInputViewController object... it is not possible to display key artwork above the top edge of a custom keyboard’s primary view, as the system keyboard does on iPhone when you tap and hold a key in the top row.



至于键盘内的消息,有一些有用的库可以帮助我们。例如 https://github.com/scalessec/Toasthttps://github.com/sergeylenkov/PTHintController .

关于iOS AlertView 应用扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29825154/

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