#import "ViewController.h"
#import "MainViewController.h"
#import "UIView+SDAutoLayout.h"
@interface ViewController ()<UIScrollViewDelegate>
@property(nonatomic,strong)UIScrollView *scrollView;
@end
@implementation ViewController
-(void)viewWillAppear:(BOOL)animated
{
self.navigationController.navigationBar.hidden = YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self scrollViewItem];
}
-(void)scrollViewItem
{
self.scrollView = [[UIScrollView alloc]initWithFrame:self.view.frame];
self.scrollView.delegate = self;
self.scrollView.contentSize = CGSizeMake(3 * self.view.frame.size.width, self.view.frame.size.height);
self.scrollView.bounces = NO;
self.scrollView.pagingEnabled = YES;
self.scrollView.showsVerticalScrollIndicator = NO;
for (int i = 0; i < 3; i++)
{
UIImageView *imgV = [[UIImageView alloc]initWithFrame:CGRectMake(i*self.view.frame.size.width, 0, self.view.frame.size.width, self.view.frame.size.height)];
NSArray *arr = @[@"1",@"2",@"3"];
imgV.image = [UIImage imageNamed:arr[i]];
if (i == 2)
{
UIButton *btn = [[UIButton alloc]init];
[imgV addSubview:btn];
btn.sd_layout.topSpaceToView(self, 20).leftSpaceToView(self, 300).widthIs(90).heightIs(30);
[btn setTitle:@"立即体验" forState:(UIControlStateNormal)];
[btn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
[btn addTarget:self action:@selector(btnClick) forControlEvents:(UIControlEventTouchUpInside)];
imgV.userInteractionEnabled = YES;
}
[ self.scrollView addSubview:imgV];
}
[self.view addSubview: self.scrollView];
}
-(void)btnClick
{
MainViewController *mainView = [[MainViewController alloc]init];
[self.navigationController pushViewController:mainView animated:YES];
}
@end
轮播图
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 网易轮播图: 案例素材及源码:链接:http://pan.baidu.com/s/1pLgzkVp 密码:9buw...
- 村上春树在《当我谈跑步时我谈些什么》中这样写道:“坚持跑步的理由不过一丝半点,中断跑步的理由却足够装满一辆大型载重...