原理 如果我们的UI中有滑动列表,并且列表比较长,那么不知道你们是否有这样需求,每次页面打开时,列表的滑动状态都恢复到默认状态. 如果要复位,其实就是修改UIPanel 的属性到初始状态.此组件做的工作就是在初始化时把UIPanel的属性保存起来,在需要时还原初始值,达到复位效果. 组件代码 using UnityEngine; using System.Collections.Generic; /// <summary> /// 方便对UIPanel进行滚动复位 /// 用法: /// va…
需求 在每次打开界面滑动列表都是复位状态(未滑动). 分析 在制作滑动列表时常常会结合UIPanel和UIScrollView 要让滑动列表回到未滑动时的位置,那么就需要改变Panel的Clipping和transform的position 演示 以前做法 以前是保存Panel的初始信息,每时打开面板时再还原 public class CUIShopVIP : CUIController { private UIPanel GridPanel; private UIScrollView Grid…
一.基本知识 1.初始化 UIScrollView #import "ViewController.h" #define WIDTH[[UIScreen mainScreen]bounds].size.width #define HEIGHT[[UIScreen mainScreen]bounds].size.height@interface ViewController ()<UIScrollViewDelegate> @end UIScrollView *scroll…
//拖动返回选中的索引 当滚动视图停止时的时候 - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ CGFloat width = scrollView.frame.size.width; NSLog(@"%f",scrollView.contentOffset.x); int page = (scrollView.contentOffset.x + (0.5f * width)) / width; if(_…
#define HEIGHT  self.view.frame.size.height #define WIDTH    self.view.frame.size.width @interface ViewController : UIViewController<UIScrollViewDelegate> @property (strong,nonatomic) UIScrollView *myScorolV; @property (strong,nonatomic) UIPageContr…
转自:http://blog.csdn.net/iukey/article/details/7319314 UIScrollView 类负责所有基于 UIKit 的滚动操作. 一.创建 CGRect bounds = [ [ UIScreen mainScreen ] applicationFrame ] ; UIScrollView* scrollView = [ [UIScrollView alloc ] initWithFrame:bounds ]; 当你创建完滚动视图后,你可以将另一个视…
需求展示: 测试效果1 first uiscrollView  宽度 为屏幕宽度   滚动步长 为 scroll 宽度的1/3   分析: 这个是最普通版 无法使每一次滚动的结果子视图居中展示, WA second 测试效果2 uiscrollView 宽度 为 屏幕的 1/3  滚动步长 为 scroll 的宽度   分析:我优先想到居中 但是这样子 又无法像需求的那样 展示 两边即将过渡的子视图,WA third  测试效果3 uiscrollView 宽度 为 屏幕的 1/3  滚动步长…
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { NSLog(@"開始滚动"); int currentPostion = scrollView.contentOffset.y; if (currentPostion -   && currentPostion >) { _lastPosition = currentPostion; NSLog(@"ScrollUp now");…
生成一个滚动面板之后发现滚轮向上滚,界面向下:滚轮向下界面向上.在编辑窗口里发现这个选项 本来是-2,修改成正数就可以了. http://ju.outofmemory.cn/entry/146754…
[mScrollView setContentOffset:CGPointMake(0,200) animated:YES];…