【问题标题】:to call a function in other one调用另一个函数
【发布时间】:2010-12-10 10:30:43
【问题描述】:

嗨 我在一个文件中有以下函数,我想在第二个相同类的另一个方法中调用它

  • (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { // 发出振动 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

    // 同时发出视觉警报 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"屏幕被触动了!" 消息:无 代表:无 取消按钮标题:无 otherButtonTitles:@"OK", nil]; [警报显示]; }

我想在同一个类的另一个方法中调用它第二个函数是用按钮调用第二个方法是

-(IBAction)resetBet:(id)sender { //这里调用函数...... //一些代码...... } 基本上我要做的是让设备在按钮单击时振动 请告诉我如何调用该函数。

【问题讨论】:

    标签: objective-c


    【解决方案1】:

    [self resetBet:nil];

    应该调用resetBet 方法.. 或者您可以使用像按钮这样的对象而不是“nil”。 希望这就是你的意思..

    【讨论】:

      【解决方案2】:

      按照 stackr 所说的做 :D 或使用选择器。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-03-07
        • 2023-02-06
        • 2019-04-24
        • 1970-01-01
        • 2019-09-17
        相关资源
        最近更新 更多