xichen744 / sppage Goto Github PK
View Code? Open in Web Editor NEWios PageController
License: MIT License
ios PageController
License: MIT License
SPPage Please do not add QQ. If you have questions, send my Email or create issues. Requirements iOS >= 7 Installation Copy codes or git specs. attention please set ContainerVc property automaticallyAdjustsScrollViewInsets NO Contact Email:[email protected] Version 1.0
我请求接口,拿到分类的id,我怎么通过分类这个数组去加载pagecontroller
bug太多!
UIView *oldSelectView = [self controllerAtIndex:oldSelectIndex].view;
CGFloat backgroundIndex = [self.scrollView calcIndexWithOffset:self.scrollView.contentOffset.x width:self.scrollView.frame.size.width];
UIView *backgroundView = nil;
if (oldSelectView.layer.animationKeys.count > 0 && lastView.layer.animationKeys.count > 0) {
UIView *tmpView = [self controllerAtIndex:backgroundIndex].view;
if (tmpView != currentView && tmpView != lastView) {
backgroundView = tmpView;
backgroundView.hidden = YES;
}
}
[self.scrollView.layer removeAllAnimations];
[oldSelectView.layer removeAllAnimations];
[lastView.layer removeAllAnimations];
[currentView.layer removeAllAnimations];
[self moveBackToOriginPositionIfNeeded:oldSelectView index:oldSelectIndex];
中根据backgroundIndex得来的backgroundView 和 oldSelectView 这些view的相关操作有什么作用?是你文章里面说
非交互切换,模拟切换的动画,这里需要考虑的一个复杂情况是第一次动画还未结束就开始第二次,这时候需要提前结束第一次动画
但是对于这段代码真的是完全茫然的,还希望作者能稍微解释一下
Bug太多了。。没有使用的先不要用了。换其他的或者自己写吧
swift版本的代码,个数与滑动都有问题。可以分享一下你的思路和布局结构吗?
如果CoverView 的高度比较高的话, 能滑动CoverView 的同时下方的View 整体滑动吗? 我该如何设置呢
导航条背景色变化的代码没有加进来啊???
KSTATUSBARHEIGHT和KNAVIGATIONANDSTATUSBARHEIGHT这两个宏最好不要这样写死,兼容性不好,
建议这样写:
`- (CGFloat)statusBarHeight{
return CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
}
(CGFloat)navigationBarHeight{
CGFloat height = 0;
height += CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
height += CGRectGetHeight(self.navigationController.navigationBar.frame);
return height;
}`
这样,无论导航栏和状态栏是否隐藏或者是iPhoneX或者更奇葩的屏幕都没问题。(请原谅我插入代码没效果)
导航栏如果隐藏然后上拉,标签栏就会被覆盖,标签栏应该跟随着至顶
比如推上去, 第一个页面滑动到第5行,切换到第2个页面,把cover拉下来点,第一个页面回到第0行了,以前第5行的状态没了,
这个效果在安卓上有实现,
如果要添加下拉刷新需要如何设置
demo里面,拖动黑色的部分,不能上下滚动,只能拖动红色的部分,体验不好
tableview的下拉刷新触发不了,刷新头添加到pageController.scrollView也不行.能不能加个可以添加下拉刷新的功能?急需~
在重新计算 offset 时可以改成
CGFloat gap = 0;
offset = preferTabOffset;
if ((tabContentWidth+2*preferTabOffset ) < self.frame.size.width) {
if ([self.tabDataSource respondsToSelector:@selector(numberOfTab)] && self.tabDataSource.numberOfTab > 1) {
gap = (self.frame.size.width-tabContentWidth - 2*preferTabOffset)/ (CGFloat)(self.tabDataSource.numberOfTab - 1);
}
else
{
offset = (self.frame.size.width-tabContentWidth)/2.0;
}
}
for (int i=0;i<[self.tabDataSource numberOfTab];i++) {
...
offset += tagWidth + gap;
}
offset -= gap;
或者 SPTabDataSource
加入获取自定义间距的方法。
下了跑起来随便点了两下就崩了 真的不能用
在demo中的TestCoverSubController中tableView初始化的时候给tableView设置tableHeaderView,会造成启动后子控件的偏移量不对。
override func numberOfControllers() -> NSInteger {
return 2
}
return个数与显示个数不相符
..
目前看来并不支持横屏,然而横屏的场景还是很多的
有时候会出现页面空白,查看后发现除了contentview什么view都没有。但是当你滑动屏幕的时候,空白的页面又会正常。请问如何解决??
KSTATUSBARHEIGHT 和KNAVIGATIONANDSTATUSBARHEIGHT这两个宏这样写兼容性太差了,建议这样写:
`- (CGFloat)statusBarHeight{
return CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
}
(CGFloat)navigationBarHeight{
CGFloat height = 0;
height += CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
height += CGRectGetHeight(self.navigationController.navigationBar.frame);
return height;
}
`
这样无论导航栏和状态栏是否隐藏还是iPhoneX或者更奇葩的屏幕,都可以兼容。(请原谅我插入代码没效果)
把demo中改成CoverScrollStyleHeight样式。。基本就乱了
SPTagBarScrollView类中的
SPPageTagView *nextTagView = self.tagViewsCache[index];
这样用有隐患的,if self.tagViewsCache是个空数组,然后index == 0
那就奔溃了
markViewToIndex:animatied:
中在两次获取 nextTagView
后计算新的 frame,
CGRect frame = CGRectMake(nextTagView.center.x - [self.tabDataSource markViewWidthForIndex:self.index]/2.0 , self.markView.frame.origin.y, [self.tabDataSource markViewWidthForIndex:self.index], self.markView.frame.size.height);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.