隐藏在键盘下方的SKStoreReviewController按钮 [英] SKStoreReviewController buttons hidden under keyboard

查看:143
本文介绍了隐藏在键盘下方的SKStoreReviewController按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的快速iOS应用程序有一个活动的文本字段,其中显示了键盘. 每次用户点击键盘上的回车键,我都会呼叫

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.

问题是在较小的屏幕设备(iPhone 5等)上,显示的SKStoreReviewController的按钮隐藏在键盘下面.

Problem is that on smaller screen devices (iPhone 5 etc), the displayed SKStoreReviewController's buttons are hidden under the keyboard.

因此,由于无法关闭SKStoreReviewController,用户被卡住了. 我不想为用户添加键盘隐藏按钮.

So the user gets stuck as they cannot dismiss the SKStoreReviewController. I do not want to add a keyboard hide button for the user.

我怎么知道SKStoreReviewController何时显示,以便可以以编程方式隐藏键盘?

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.

您可以在SKStoreReviewController 此处上阅读文档,该文档仅显示 requestReview()您用来调用它的函数.

You can read the documentation on SKStoreReviewController here, which shows only the requestReview() function you use to call it.

但是,如果您想更深入地进行研究,我提供了以下屏幕截图,显示了显示请求时 Debug View Hierarchy 的外观.

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.

这告诉您的是,您无法尝试通过presentedViewController之类的属性来进行深入挖掘,以试图发现是否显示了屏幕.

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.

通常,如果您提出一个UIAlertController或与此相关的任何UI元素,则将看到堆叠在一起的UI片段,形成该UI元素,表明您可以访问关联的属性以查找正在呈现的内容.此类不提供任何内容,因此您的应用程序无视正在进行的事情.

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:

Apple在课程文档中提到了这一点,您需要开发自己的逻辑以在不显示您当前遇到的问题的时候显示它.

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按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆