小编Jit*_*jha的帖子

如何从iOS中的非UI线程更新UI标签

我是iOS开发的新手,我有简单的目标--c类"MoneyTimer.m"用于运行计时器,从那里我想用更改的计时器值更新UI标签.我想知道如何从非UI线程访问UI元素?我正在使用Xcode 4.2和故事板.

在黑莓手机中,只需获取事件锁定即可从非UI线程更新UI.

//this the code from MyTimerClass

 {...
    if(nsTimerUp == nil){

        nsTimerUp = [NSTimer scheduledTimerWithTimeInterval: 1.0 target:self selector:@selector(countUpH) userInfo:nil repeats: YES];
 ...}

(void) countUpH {

sumUp = sumUp + rateInSecH;
 **//from here i want to update the UI label **
...
}
Run Code Online (Sandbox Code Playgroud)

xcode ios

20
推荐指数
2
解决办法
3万
查看次数

标签 统计

ios ×1

xcode ×1