@interface ViewController : UIViewController<UIScrollViewDelegate>
@end
//
// ViewController.m
// quma_sslx
//
// Created by apple on 15/6/10.
// Copyright (c) 2015年 quma. All rights reserved.
//
#import "ViewController.h"
#import "Utils.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self.view setBackgroundColor:[UIColor whiteColor]];
UIScrollView* scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, [Utils getScreenWidth], [Utils getScreenHeight])];
[self.view addSubview:scrollView];
scrollView.showsHorizontalScrollIndicator=NO; //不显示水平滑动线
scrollView.showsVerticalScrollIndicator=NO;//不显示垂直滑动线
scrollView.pagingEnabled=YES;//scrollView不会停在页面之间,即只会显示第一页或者第二页,不会各一半显示
scrollView.delegate = self;
UIView* view1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [Utils getScreenWidth], [Utils getScreenHeight])];
[view1 setBackgroundColor:[UIColor yellowColor]];
[scrollView addSubview:view1];
UIView* view2 = [[UIView alloc] initWithFrame:CGRectMake([Utils getScreenWidth], 0, [Utils getScreenWidth], [Utils getScreenHeight])];
[view2 setBackgroundColor:[UIColor greenColor]];
[scrollView addSubview:view2];
//设置scrollview的属性
scrollView.contentSize = CGSizeMake(self.view.bounds.size.width*2, scrollView.bounds.size.height);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
CGPoint offset = scrollView.contentOffset;
[scrollView setContentOffset:CGPointMake(self.view.bounds.size.width*(offset.x / (self.view.bounds.size.width)),scrollView.contentOffset.y) animated:YES];
}
@end
分享到:
相关推荐
iOS使用UIScrollView实现左右滑动UITableView和UICollectionView
翻页过程中(scrollViewDidScroll),进行必要的即时更新,但这个更新操作必须尽量少,以免影响划动的平滑体验,如加载较小的缩略图。而在翻页后,再通过延时操作载入全部内容进行更新。这样处理后的体验就跟iOS设备...
根据网上的资料,修改为ios5.0以后都能用的,资源分主要是自己下载别人的应用的时候扣的分,见谅
IOS UIScrollView复用加载数据 ,并且有分页。
一个列表demo,底部是个scrollView,上面放了四个tableView, 可通过上方四个Button控制显示那个按钮;也可以左右滑动切换tableView,上方红线联动。
少scrollview版的自动轮播图,同时可以手动滑动,左右循环滚动。
git地址:https://github.com/ifdw702553634/DWScrollShowView.git
支持上下滑动、左右滑动,手势返回等。支持如UITableView的sectionView的悬停效果。支持多种分页控件,如JXCategoryView,WMPageController,VTMagic等。可实现导航栏颜色渐变、头图下拉放大等效果。支持主页、列表页...
前几天一个学妹找我,公司让做一个介绍公司背景的视图,必须用原生的。好吧,客串一下帮帮忙。另外请大神指点下,喜欢的朋友github记得star https://github.com/WintonTalks/SendInfoTableView
github: https://github.com/ArchLL/PersonalCenter-Extend 欢迎star主要内容:1.适配iphoneX;2.解决外层和内层滚动视图...3.解决外层tableView的子视图左右滚动不能和外层tableView上下滑动互斥的问题;4.优化菜单栏;
UIScrollView横向移动, 可实现左右滑动查看信息
主要介绍了iOS应用开发中UIScrollView滚动视图的基本用法总结,作者还介绍了重写UIScrollView中的hitTest方法来解决长按的事件问题,需要的朋友可以参考下
CLTableWithFooterViewController:到达UIScrollView或UITableView的底部时,轻松添加固定的页脚图像
iOS图片点击放大,左右滑动浏览,类似于微信朋友圈图片浏览
实现左右滑动屏幕功能切换栏目,可以动态加载内容,可以直接移植到项目中。
Unity NGUI 滑动列表渐变缩放,偏移,渐变 Demo 博客地址:https://blog.csdn.net/qq_30259857/article/details/79562652
左右滑动按钮 底部的scrollview随着更改,可以直接应用到项目中,能较好的自定义。
网易新闻手机端首页,添加,删除标签,滑动标签动态下标效果,图片循环自动切换,手动左右循环切换UIScrollView图片
支持上下滑动、左右滑动,手势返回等 支持如UITableView的sectionView的悬停效果 支持多种分页控件,如,,等 可实现导航栏颜色渐变、头图下拉放大等效果 支持主页、列表页下拉刷新,列表页上拉加载 支持列表懒加载...