Update a label with speed every x seconds

后端 未结 2 1399
广开言路
广开言路 2021-01-21 05:32

I\'m developing my first iPhone application. I have to update a label with the device speed every x seconds. I have created my own CLController and I can get device

2条回答
  •  被撕碎了的回忆
    2021-01-21 06:01

    you are right you have to use NSTimer. You will be calling one method after x seconds and updating the label.

    [NSTimer scheduledTimerWithTimeInterval:x  target:self selector:@selector(updateLabel) userInfo:nil repeats:YES];
    
    -(void)updateLabel
    {
        // update your label
    }
    

提交回复
热议问题