菜鸟教程小白 发表于 2022-12-12 09:58:56

ios - KVO 属性列表?


                                            <p><p>在哪里可以找到 AVPlayer 的可观察属性列表?
我似乎在 Apple 文档中的任何地方都找不到它。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>只有在文档告诉您这是安全/正确的行为时,您才能使用 KVO。基本上,要获得您的列表,您只需搜索“observable”或“observe”或“observing”这个词。</p>

<p>所以,对于 AVPlayer,请咨询 <a href="https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVPlayer_Class/index.html" rel="noreferrer noopener nofollow">the docs</a> ,在 <code>status</code> 属性文档下,我们阅读:</p>

<blockquote>
<p>This property is key value observable <strong>using key-value observing</strong></p>
</blockquote>

<p>同样,在 <code>outputObscuredDueToInsufficientExternalProtection</code> 属性文档下,我们阅读:</p>

<blockquote>
<p>You can observe changes to the value of this property <strong>using key-value observing</strong></p>
</blockquote>

<p>因此,答案是:AVPlayer 的 <code>status</code> 属性,以及它的 <code>outputObscuredDueToInsufficientExternalProtection</code> 属性,并且没有其他属性,是键值可观察的。</p>

<p>但是,请注意,还有其他方式可以通知 AVPlayer 的情况,例如通过调用 <code>addPeriodicTimeObserverForInterval:queue:usingBlock:</code> 或 <code>addBoundaryTimeObserverForTimes:queue:usingBlock:</code>。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - KVO 属性列表?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/34441873/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/34441873/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - KVO 属性列表?