开发者

Objective C - displaying data in UITextView

I'm having difficulties displaying data in a UITextView in iPhone programming.

I'm analyzing incoming audio data (from the microphone). In order to do that, I create an object "analyzer" from my SignalAnalyzer class which performs analysis of the incoming data. What I would like to do is to display each new incoming data in a TextView in realtime.

So when I push a button, I create the object "analyzer" which analyze the incoming data. Each time there is new data, I need to display it on the screen in a TextView.

My problem is that I'm getting an error because (I think) I'm trying to send a message to the parent class (the one taking care of displaying stuff in my UITextView : it has a UITexView instance variable linked in Interface Builder). What should I do in order to tell my parent class what it needs to display ? Or how should I design my classes to display automaticlally something ?

Thank you for your help.

PS : Here is my error :

    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. 开发者_StackOverflow中文版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”.


It looks like your problem is that you are trying to update the UI from a secondary thread, which you are not allowed to do. Look into using performSelectorOnMainThread: to do your UI updates.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜