gpt4 book ai didi

ios - IBAction 未作为选项出现

转载 作者:行者123 更新时间:2023-11-29 02:35:30 25 4
gpt4 key购买 nike

在 ViewController.h 中,

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController {
IBOutlet UILabel *scoreLabel;
IBOutlet UILabel *timerLabel;
}

- (IBAction)buttonPressed;

@end

在 ViewController.m 中,

#import "ViewController.h"

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (IBAction)buttonPressed {
NSLog(@"Pressed!");
}

@end

我尝试通过在按住 Ctrl 的同时单击按钮并将其拖动到后台来将 ViewController 中的按钮连接到 buttonPressed IBAction。我应该看到buttonPressed 作为一个选项,但我没有看到它。怎么会这样?

enter image description here

最佳答案

您可以在这里找到它(只需进入 IB 并在左侧栏中选择您的 Controller ,然后进入右侧栏的最后一个选项卡):

enter image description here

然后您可以将它拖到您的按钮上并选择要调用的事件。

关于ios - IBAction 未作为选项出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26417259/

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