在UISclickView UIScrollView上的UIButton

问题描述:

我有一个UIScrollView(类似于在App Store上显示的特色项目),它有3个视图,其中加载了xibs。一切都可以找到,除非我可以获得我在xib上启动的UIButton。我想我错过了一些显而易见的东西,就是看不到它。我在这里和其他地方尝试了各种答案,无济于事。在UISclickView UIScrollView上的UIButton

预先感谢

从viewDidLoad中代码上的ViewController含有滚动视图

LSCWInfoView *view1 = [[[NSBundle mainBundle] 
         loadNibNamed:@"LSCW-InfoView" 
         owner:self options:nil] 
         firstObject]; 

CGRect frame; 
frame.origin.x = 0; 
frame.origin.y = 0; 
frame.size = self.activityPageControl.frame.size; 

[view1 setFrame:frame]; 

[self.activityScrollView addSubview:view1]; 

ScrambledInfoView *view2 = [[[NSBundle mainBundle] 
          loadNibNamed:@"Scrambled-InfoView" 
          owner:self options:nil] 
          firstObject]; 

CGRect frame2; 
frame2.origin.x = 320; 
frame2.origin.y = 0; 
frame2.size = self.activityPageControl.frame.size; 

[view2 setFrame:frame2]; 

[self.activityScrollView addSubview:view2]; 


TestInfoView *view3 = [[[NSBundle mainBundle] 
         loadNibNamed:@"Test-InfoView" 
         owner:self options:nil] 
         firstObject]; 

CGRect frame3; 
frame3.origin.x = 640; 
frame3.origin.y = 0; 
frame3.size = self.activityPageControl.frame.size; 

[view3 setFrame:frame3]; 

[self.activityScrollView addSubview:view3]; 

_activityScrollView.contentSize = CGSizeMake(_activityScrollView.frame.size.width * 3, _activityScrollView.frame.size.height); 

编辑 - 代码的加载到滚动视图的视图之一(其它2是相同的)

#import "LSCWInfoView.h" 

@implementation LSCWInfoView 

- (id)initWithFrame:(CGRect)frame 
{ 
    self = [super initWithFrame:frame]; 
    if (self) { 
     // Initialization code 
    } 
    return self; 
} 

/* 
// Only override drawRect: if you perform custom drawing. 
// An empty implementation adversely affects performance during animation. 
- (void)drawRect:(CGRect)rect 
{ 
    // Drawing code 
} 
*/ 

- (IBAction)lscwPlayButtonPressed:(id)sender 
{ 
    NSLog(@"YEP"); 
} 

@end 

屏幕截图 Showing view controller w/ scrollview

Showing view which is loaded into scrollview

+1

并ü分配任何出口采取行动,将acutal视图 – CoolMonster

+0

设置视图的帧大小是的,我有在属于意见IBActions加载到滚动视图中。目前不工作。 – nicktones

+0

你的视图代码如何?它上面没有提供试图发布代码中涉及的代码。 – CoolMonster

该固定通过之前将其加入到所述滚动视图