Question

Is there a way to keep updating the subtitle string in an annotationView? The subtitle string gets it value from another class which is updating the value every second. Is it possible to get the subtitle in the annotationView to keep updating itself?

Was it helpful?

Solution

Create a method which update the value of your subtitle and call this method in main thread. All UI related changes should go in main thread.

[self performSelectorOnMainThread:<#(SEL)#> withObject:<#(id)#> waitUntilDone:<#(BOOL)#>]


-(void)updateValue 
 { 
      if(![NSThread isMainThread]) 
      { 
         [self updateValue]; 
         return; 
      } 
      update your values here. 
 } 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top