点击事件不一定需要要通过添加button才能实现,其实只要是继承 uiview的空间,你都可以手动的添加一些点击事件,如下:
UIView myView = [[UIView alloc]init];
UITapGestureRecognizer*tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(click:)];
[myView addGestureRecognizer:tapGesture];
就是新建一个UITapGestureRecognizer,这个是点击事件,再将这个事件加到uiview中,继承uiview的一般都有addGestureRecognizer这个方法。addGestureRecognizer方法就是用于添加点击事件的。-(void)click:(id)sender
{
}