gpt4 book ai didi

iphone - 如何设置按钮Action Nil

转载 作者:行者123 更新时间:2023-12-03 20:25:33 25 4
gpt4 key购买 nike

我是 Objective-C 的新手,我正在开发 iPad 应用程序,我想在其中取消按钮操作。我希望操作只执行一次,执行操作后按钮的操作应该为零​​。我正在按钮操作上编写代码:

#pragma mark AddCollectors Button Action here

-(void)addCollectors:(id)sender {
[addCollectors actionsForTarget:nil forControlEvent:UIControlStateNormal];
myTableView.hidden = YES;
myTableViewForAddCollectors.hidden = NO;
[self addTableViewForAddCollectors];
addCollectors = nil;
}

表示添加 tableview 按钮操作后应该为零。

最佳答案

使用这个方法

- (void)removeTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents

来自文档:

Removes a target and action for a particular event (or events) from an internal dispatch table.

关于iphone - 如何设置按钮Action Nil,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9062292/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com