I have this code, which runs the block of code after the delay. Public Fancy Delay (Delay: Double, Closed: () -> ()) {Dispatch_more (DISPATCH_time (DISPATCH_TIME_NOW, Int64 (Delayed * Double (NSEC_PER_SEC), Sending_out_man_Q (), Closed)}
The problem is that view controller persists even after the dismissal using the delay function. With the code being removed, it becomes zero, as it Should be.
I have to know how to do a delay function, in this way, but whoever He will not release the object, and instead just do not call the block, in this event it is not otherwise in existence.
It is in Swift, but the answer in the objective-cuites is completely appreciated. .
The problem, as others have pointed out, that you might see this function as a visual controller , But click on self
, which captures the view controller and for this one Then the context is called.
So, suppose you did something like this from your visual controller class:
delay (5) {self.label.hidden = true Return}
You will replace it with the thing that clearly says that it is weak
reference self
:
delay (5) {{weak self] in itself .. Label.hidden = true return}
Note, I had to open the optional self
when I used it. In this example, I have used alternative chaining to ensure that if it is turned off, then self
is zero
if it stops.
No comments:
Post a Comment