点击停用按钮10分钟(iOS)

Leo*_*nid 1 iphone xcode ios

我的iOS应用程序中有按钮:

    _Button = [UIButton buttonWithType:UIButtonTypeCustom];
    UIImage *shareIMG = [UIImage imageNamed:@"button.png"];
    [_Button setBackgroundImage:shareIMG forState:UIControlStateNormal];
    [_Button setBackgroundImage:[UIImage imageNamed:@"button_active.png"] forState:UIControlStateHighlighted];
    [_Button addSubview:titleLabel];

    UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 3, shareIMG.size.width, shareIMG.size.height)];
    [titleLabel setTextAlignment:UITextAlignmentCenter];
    [titleLabel setText:@"Button";
    [_Button addSubview:titleLabel];
    [titleLabel release];
    [_Button setFrame:CGRectMake(2 * self.sendPushButton.frame.origin.x + self.sendPushButton.frame.size.width , 380 - liteIndent1 - liteIndent2 + iphone5Fix, shareIMG.size.width, shareIMG.size.height)];
    [self addSubview:_Button];
Run Code Online (Sandbox Code Playgroud)

你能帮我解决一下如何让这个按钮无效(button_non_active.png)并在点击后10分钟不可点击?

CSm*_*ith 5

// disable button
[_Button setEnabled:NO];

// run a selector after 10 minutes
[_Button performSelector:@selector(onEnableButton:) withObject:_Button afterDelay:(10.0 * 60.0)]


- (void) onEnableButton:(UIButton *)sender
{
 [sender setEnabled:YES];
}
Run Code Online (Sandbox Code Playgroud)