[問題]如何將 label的值傳到glow label

看板MacDev作者 (策馬天下)時間10年前 (2014/03/03 10:17), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
小弟目前遇到一點小問題 就是我用sensor去掃描時 我想把值傳回來 那目前我的值是有傳到R(0000) ex:sensor是有徵測到R的顏色值是1500 那回傳的值就是R(1500) 那我想說該如何在回傳到glow label裡 變成說 R 如果掃到是1200 而回傳出現也是R(1200) 而glow label 也是出現1200 我目前是用button的方式glow label才會出現0000 那如果我不用button的方式 而是我按外部裝置的一個鍵 讓他去讀要怎麼做?? (目前只能在R(0000)會一直變換數字 而glow label則沒有動作) http://ppt.cc/3YAx butto按下去的程式碼 - (IBAction)b1:(id)sender { _glow.text=self.RValue.text;//表格內容=文字的內容 // [_glow setText:[NSString stringWithFormat:@"%04d", (int)[self.RValue.text intValue]]];//字串轉整數 [_glow setText:[NSString stringWithFormat:@"%04d", (int)[self.RValue.text intValue]]]; } R(0000)部分的程式碼 - (void)sensorTagDidUpdateColorSensor:(int16_t *) rgb //rgb給16bits { int16_t r,g,b; r=rgb[0]; g=rgb[1]; b=rgb[2]; self.ColorSensor_R_View.normalizedReading = ((float)r)/4096; //長度條(單位4096) self.ColorSensor_G_View.normalizedReading = ((float)g)/4096; self.ColorSensor_B_View.normalizedReading = ((float)b)/4096; self.RValue.text=[NSString stringWithFormat: @"R(%04d):", r]; //數字(4位數整數值) self.GValue.text=[NSString stringWithFormat: @"G(%04d):", g]; //數字(4位數整數值) self.BValue.text=[NSString stringWithFormat: @"B(%04d):", b]; //數字(4位數整數值) } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.120.61.247

03/03 17:45, , 1F
ui只能在main thread裡改,用 dispatch async 試試
03/03 17:45, 1F

03/06 15:34, , 2F
不怎麼懂,可以再詳細解說下嗎?
03/06 15:34, 2F
文章代碼(AID): #1J4-PAsu (MacDev)