D
D
Dima Grib2018-05-18 21:33:03
Swift
Dima Grib, 2018-05-18 21:33:03

Working with time interval in view?

Friends, help with advice on the correct implementation.
There is a view in which, by clicking on the button and viewing the advertisement, the next click is possible only after a time period.
If the user remains in this view, then this time period, passing its interval, does not open the availability of pressing the button. Only re-entering this view will give such an opportunity

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
doublench21, 2018-05-19
@YeahGarage

Well, after the first click, make view.isUserInteractionEnabled = false, and set some flag to true in the viewWillDisappear method. This method is called when the person leaves the given view controller. Save this flag somewhere or make it global for all controllers. Well, next time you check this flag, you will return isUserInteractionEnabled. If he did not go anywhere, then the moisture above will not let you press.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question