gpt4 book ai didi

iphone - Objective C - 在 UITextView 中显示数据

转载 作者:行者123 更新时间:2023-12-03 20:36:41 26 4
gpt4 key购买 nike

我在 iPhone 编程中的 UITextView 中显示数据时遇到困难。

我正在分析传入的音频数据(来自麦克风)。为此,我从 SignalAnalyzer 类创建一个对象“分析器”,该对象对传入数据进行分析。我想做的是在 TextView 中实时显示每个新传入的数据。

因此,当我按下按钮时,我会创建对象“分析器”来分析传入的数据。每次有新数据时,我都需要将其显示在屏幕上的 TextView 中。

我的问题是我收到错误,因为(我认为)我正在尝试向父类发送消息(负责在我的 UITextView 中显示内容的父类:它有一个链接到的 UITexView 实例变量界面生成器)。我应该怎么做才能告诉我的父类它需要显示什么?或者我应该如何设计我的类来自动显示某些内容?

感谢您的帮助。

PS:这是我的错误:

    2010-04-19 14:59:39.360 MyApp[1421:5003] void WebThreadLockFromAnyThread(), 
0x14a890: Obtaining the web lock from a thread other than the main thread
or the web thread. UIKit should not be called from a secondary thread.

2010-04-19 14:59:39.369 MyApp[1421:5003] bool _WebTryThreadLock(bool),
0x14a890: Tried to obtain the web lock from a thread other than the main thread
or the web thread. This may be a result of calling to UIKit from a secondary thread.
Crashing now...

Program received signal: “EXC_BAD_ACCESS”.

最佳答案

看来您的问题是您正在尝试从辅助线程更新 UI,但您不允许这样做。考虑使用 performSelectorOnMainThread: 进行 UI 更新。

关于iphone - Objective C - 在 UITextView 中显示数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2667595/

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