可能重复:
Way to make a UIButton continuously fire during a press-and-hold situation?当我按下按钮的值会自动增加,怎么样?
我有在相机视图中的两个自定义按钮,一个是在变焦和另一种是缩小这两个按钮被按下值将增加1,2...
,但我想要当我按下放大或缩小按钮的值会自动增加和释放按钮值将停止,如何?请任何一个帮助我
我试过代码
zoomin=[UIButton buttonWithType:UIButtonTypeCustom];
zoomin.frame=CGRectMake(60, 410, 60, 60);
[zoomin setBackgroundImage:[UIImage imageNamed:@"zoomplus.png"] forState:UIControlStateNormal];
[zoomin addTarget:self action:@selector(CameraZoomIn) forControlEvents:UIControlEventTouchUpInside];
[buttonView addSubview:zoomin];
-(void)CameraZoomIn
{
x=x+0.090253;
y=y+0.090253;
NSLog(@"X : %f, Y : %f",x,y);
imgpicker.cameraViewTransform = CGAffineTransformMakeScale(x,y);
}