在滚动视图里添加图像视图,在图像视图里添加按钮控件
<div class="postcontent"><div id="cnblogs_post_body">http://pic002.cnblogs.com/images/2012/266130/2012120421044378.jpg 》》点击按钮&ldquo;Button&rdquo;》》》》http://pic002.cnblogs.com/images/2012/266130/2012120420381685.jpg绿底的是一张图片(1.png),截自苹果文档。
第一个视图对应VC1:
VC1
<div class="cnblogs_code"> 1 @synthesize scrollView = _scrollView; 2 3 - (void)viewDidLoad 4 { 5 ; 6 7 // 配置 UIImageView 对象 8 UIImageView *imgView = [ initWithImage:@"1.png"]]; 9 imgView.userInteractionEnabled = YES;// UIImageView 的 userInteractionEnabled 属性默认 "NO",因此默认情况下,添加在 UIImageView 中的 UIButton 将不发生触摸事件10 11 // 配置并添加 UIButton 对象12 UIButton *button = ;13 button.frame = CGRectMake(100, 80, 50, 60);14 @"Button" forState:UIControlStateNormal];15 ;16 ;17 18 // 添加 UIImageView 对象19 ;20 21 // 配置 UIScrollView 对象22 self.scrollView.indicatorStyle = UIScrollViewIndicatorStyleBlack;23 self.scrollView.scrollEnabled = YES;24 self.scrollView.clipsToBounds = YES;25 self.scrollView.contentSize = CGSizeMake(imgView.frame.size.width, imgView.frame.size.height);26 27 }28 29 - (IBAction)button:(id)sender30 {31 @"SeguePush1" sender:self];32 }
页:
[1]