SKStoreReviewController buttons hidden under keyboard(隐藏在键盘下的 SKStoreReviewController 按钮)
问题描述
我的 swift iOS 应用程序有一个带有键盘显示的活动文本字段.每次用户点击键盘上的返回键时,我都会调用
SKStoreReviewController.requestReview()
这听起来可能有点过分,但是一旦用户给出了评论,上面的声明将不会做任何事情,所以我认为我的方法是正确的.
问题是在较小的屏幕设备(iPhone 5 等)上,显示的 SKStoreReviewController 的按钮隐藏在键盘下方.
因此用户卡住了,因为他们无法关闭 SKStoreReviewController.我不想为用户添加键盘隐藏按钮.
我如何知道 SKStoreReviewController
何时显示,以便以编程方式隐藏键盘?
你无法判断它是否正在显示.
您可以在 SKStoreReviewController
这告诉您,您无法通过 presentedViewController
等属性尝试挖掘任何内容,以尝试预测屏幕是否正在呈现.
通常,如果您要呈现 UIAlertController
或任何与此相关的 UI 元素,您会看到构成它的 UI 部分堆叠在一起,这表明您可以访问关联的属性以找出什么正在呈现.在这个类中,这些都没有提供,因此您的应用程序不会注意到正在发生的事情.
以下屏幕截图说明了当屏幕上有多个元素时视图层次结构的样子:
正如 Apple 在课程文档中提到的那样,您需要开发自己的逻辑,以便在它不会呈现您当前遇到的问题时呈现它.
My swift iOS app has an active textfield with keyboard showing. Everytime user taps the return key on keyboard, I call
SKStoreReviewController.requestReview()
This may sound excessive but once the user has given the review, above statement will not do anything so I think my approach is correct.
Problem is that on smaller screen devices (iPhone 5 etc), the displayed SKStoreReviewController's buttons are hidden under the keyboard.
So the user gets stuck as they cannot dismiss the SKStoreReviewController. I do not want to add a keyboard hide button for the user.
How can I know when SKStoreReviewController
did display so I can programmatically hide the keyboard?
There is no way for you to tell if it is being displayed.
You can read the documentation on SKStoreReviewController
here, which shows only the requestReview() function you use to call it.
But, if you want to dig deeper, I provide the following screenshot which shows what the Debug View Hierarchy looks like while displaying the request.
What this tells you, is that there is nothing you can try to dig down to via properties such as presentedViewController
in an attempt to divine if the screen is being presented.
Normally, if you are presenting a UIAlertController
, or any UI element for that matter, you will see the UI pieces stacked together that form it, indicating that you can access associated properties to find out what is being presented. With this class, none of that is provided so your app is oblivious to what is going on.
The following screenshot illustrates what a view hierarchy looks like when you have multiple elements on the screen:
As Apple alludes to in the class documentation, you need to develop your own logic for presenting it at a time when it will not present the issue you are currently experiencing.
这篇关于隐藏在键盘下的 SKStoreReviewController 按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:隐藏在键盘下的 SKStoreReviewController 按钮
基础教程推荐
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01