我有一个将UIView作为子视图的scrollView.这有UIView子视图UIButton.只有scrollView连接到插座,其余全部都是代码.按钮不响应触摸,触摸时不变蓝.我能做些什么才能让它发挥作用? 
  
 
这是代码:
- (void)viewDidLoad
 {
       [super viewDidLoad];
      //......
      self.buttonHome = [UIButton buttonWithType:UIButtonTypeCustom];
      [self.buttonHome addTarget:self action:@selector(pressedHome:)
                                  forControlEvents:UIControlEventTouchUpInside];
      //....
      self.containerView =[[UIView alloc]initWithFrame:self.scrollView.frame];
      self.containerView.userInteractionEnabled=YES;
      [self.scrollView addSubview:self.containerView];
      [self.containerView addSubview:self.buttonHome];
  }
  -(void) pressedHome:(id)sender{
         //....
  }
解决方法
 您必须设置视图的内容大小.它必须大于或等于scrollView的内容大小. 
  
 
        因为您的视图的默认大小是320 * 480(3.5“视网膜)和320 * 568(4”视网膜).因此,增加视野的高度 –
self.view.frame = CGRectMake(0,320,700);
然后将其添加为scrollView的子视图.
将帮助您解决问题.