【问题标题】:Why can't I create IBActions from storyboard为什么我不能从情节提要创建 IBAction
【发布时间】:2014-09-07 01:46:51
【问题描述】:

我有一个从 UINavigationController 继承的故事板视图控制器,但由于某种原因无法创建 IBAction,只能创建 IBOutlets。我已经更改了视图控制器的类以适合我试图在其中创建 IBAction 的类。为什么会发生这种情况?任何帮助将非常感激。 我在这里附上了问题的图片:Imgur link

【问题讨论】:

    标签: ios objective-c xcode storyboard xcode-storyboard


    【解决方案1】:

    您可以轻松地在头文件中制作 IBAction。

    //This is your header file
    @interface AppMain{
       //Outlets and others here   
    }
    
    //Actions, Voids, Properties and others here.
    

    你把动作放在哪里 -

    -(IBAction)[Name of action];
    

    在链接器的情节提要中,您可以将您的操作链接到按钮。

    【讨论】:

    • 你必须把它链接起来吗?你可以花点时间把它打出来。
    • 在 main 中使用它 -(IBAction)[Name of Action] { (code) }
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-02-12
    • 1970-01-01
    • 2017-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多