uibutton事件

时间:2009-05-22 05:05:02

标签: uibutton

// starting my code

int col=10;

UIButton*mbybutton = [UIButton buttonWithType:UIButtonTypeCustom];
[mbybutton setTitle:@"Click Here"  forState:UIControlStateNormal];

//-------------------    
[self performSelector:@selector(fullscreen:) 
  withObject:[NSNumber numberWithInt:col]
       afterDelay:0.2];
//----------------------------

-(void) displayvalue:(id)iid{

    int c=[iid intValue];


    printf("\n\n ======= %d========",c);
}
// end of code

int col=10; UIButton*mbybutton = [UIButton buttonWithType:UIButtonTypeCustom]; [mbybutton setTitle:@"Click Here" forState:UIControlStateNormal]; //------------------- [self performSelector:@selector(fullscreen:) withObject:[NSNumber numberWithInt:col] afterDelay:0.2]; //---------------------------- -(void) displayvalue:(id)iid{ int c=[iid intValue]; printf("\n\n ======= %d========",c); } // end of code

在这段代码中我的问题是 这些代码替换 afterDelay:0.2 by forControlEvents:UIControlEventTouchUpInside(在mybutton的偶数上)  并在touchupinside中获取显示值方法中col的值 请纠正这些错误..

1 个答案:

答案 0 :(得分:0)

您想要转到头文件,并首先声明IBAction。然后在IB中,将按钮绑定到IBAction。

然后,在你的.m文件中,你这样做

- (IBAction)yourActionName:(id)sender {

     [okbutton disabled:TRUE];

}