0

我可能有一个棘手的问题,希望你能理解这一点:

我有一个带有选择器的 UIButton:

- (void)ButtonPressed:(id)sender{
    UIButton *button = (UIButton*) sender;
    int tag = -1;

    if (iniciat == 0){
        if(button.tag == START) {
            tag = 0;
            iniciat = 1;
            [self TimeControl];
        }
    }else{
        switch (button.tag) {
            case START: //Start
                break;
            case LEFT://LEFT  
                //Do sth
                break;
            case RIGHT://RIGHT
                //Do sth
                break;
            default:
                break;
        }

    [super viewDidLoad];

    }
}

但是除了 UIButton 的触摸操作之外,我还想在完成某些操作时使用/调用此选择器。我要做的是:

-(void) checkNXT{
    if (iniciat) {

        aux1 = [NSString stringWithFormat:@"%@", newString];
        bool pressed=[aux1 isEqualToString:@"30a0a00\n"];
        bool pressed2=[aux1 isEqualToString:@"30d0d00\n"];

        if(pressed == TRUE){ //Esquerre
            [self ButtonPressed:buttonLeft];

        }else if(pressed2 == TRUE){
            [self ButtonPressed:buttonRight];

        }

        aux3 = [NSString stringWithFormat:@"%d",count];
    }
    [super viewDidLoad];
}

但不知何故,它不能正常工作--> 它没有调用函数 ButtonPressed。

谢谢!

4

0 回答 0