search

Home  >  Q&A  >  body text

objective-c - How to change block variables into global variables

There is an external global variable self.array

dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);

dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
NSString *string=@"变量";

}
NSlog(@"%@",self.array); //self.array here is empty
How do I assign a value to self.array?

巴扎黑巴扎黑2813 days ago428

reply all(0)I'll reply

No reply
  • Cancelreply