Do something after a certain time after button clicked

后端 未结 2 870
予麋鹿
予麋鹿 2021-01-24 01:32

I am trying to have an object disappear from the view after a certain time after a button is tapped. I\'m a little confused with how to get the object to do something a certain

2条回答
  •  粉色の甜心
    2021-01-24 02:13

    You can use NStimer Also

    NSTimer scheduledTimerWithTimeInterval:2.0
                target:self
                selector:@selector(afterTapped:)
                userInfo:nil
                repeats:NO];
    

    and the create action to be done for afterTapped

    -(void)afterTapped:(id)sender{
    
          //do something
        }
    

提交回复
热议问题