gpt4 book ai didi

objective-c - 对按钮xcode视而不见的函数

转载 作者:行者123 更新时间:2023-12-01 19:28:50 26 4
gpt4 key购买 nike

嗨,我有一个问题,我无法发送函数参数

-(IBAction)ukazObrat:(NSInteger *)cis {     
stvrtyViewController *screen = [[stvrtyViewController alloc] initWithNibName:nil bundle:nil];
screen.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:screen animated:YES];
screen.obratLabel.font = [UIFont systemFontOfSize: 12];
screen.obratLabel.numberOfLines = 0;
screen.obratLabel.text = [array objectAtIndex:cis];
[screen release];
}

我将此功能设置为按钮单击,但是当我向其添加参数时无法编译它。
button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button.titleLabel setLineBreakMode:UILineBreakModeWordWrap];
[button.titleLabel setTextAlignment:UITextAlignmentLeft];
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
[button setTitle:obratLable forState:UIControlStateNormal];
[button addTarget:self
action:@selector([self ukazObrat:minus]
forControlEvents:UIControlEventTouchDown];
button.frame = CGRectMake(0.0, 0.0, 250.0, 60.0);

它一直在工作,直到我在那里添加变量。
请帮忙

最佳答案

[button addTarget:self action:@selector(buttonHandler) forControlEvents:UIControlEventTouchDown];  

然后将 buttonHandler 定义为:
- (void)buttonHandler {
[self ukazObrat:minus];
}

管理 minus然而是必要的。

关于objective-c - 对按钮xcode视而不见的函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4724020/

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