Closed jniosdeveloper closed 6 years ago
// you can custom tabBar orignY and height. @property (nonatomic, assign) CGFloat tabBarOrignY; @property (nonatomic, assign) CGFloat tabBarHeight;
tabBarOrignY=0;
你好,刚刚我设置了tabBarOrignY为0效果是对的,后来仔细看了一下,原因是因为push之前的控制器的第一个视图是tableView,所以系统因为automaticallyAdjustsScrollViewInsets的原因就给我自动调了64的高度,然后我push过去的时候高度不再是667而变成了603,并且(fixedTabBarOriginY)这个方法返回的还是64,这个我在想有没有比较好的方法去判断如果根控制器的第一个视图是tableView或者collectionView这些会被系统自动减少64的高度的,直接(fixedTabBarOriginY)方法返回0,而不是64,就不用调用tabBarOrignY这个属性了呢?
你可以断点看看 我那个地方判断不全面
👌,我还想请教一下,就是在
//设置子控制器
- (UIViewController *)tabPagerController:(TYTabPagerController *)tabPagerController controllerForIndex:(NSInteger)index prefetching:(BOOL)prefetching {
NSLog(@"index:%ld,prefetching:%d",index,prefetching);
if (index == 0) {
CustomViewController *VC = [[CustomViewController alloc]init];
VC.text = [@(index) stringValue];
return VC;
}else if (index == 1) {
ListViewController *VC = [[ListViewController alloc]init];
VC.text = [@(index) stringValue];
return VC;
}else if (index == 2) {
CollectionViewController *VC = [[CollectionViewController alloc]init];
VC.text = [@(index) stringValue];
return VC;
}else{
JNTYTestOneVC *oneVC = [[JNTYTestOneVC alloc] init];
return oneVC;
}
}
打印这个index和prefetching,打印的结果是:index:0,prefetching:0 index:1,prefetching:1,只有这两个打印(是懒加载的原因吗?),我搞不懂的是,index只打印到了1,但是我代码里面的这个index == 2怎么判断上的(展示效果还就是我想要的效果),还有这个prefetching属性也有点懵逼,这个属性又是是怎么回事儿呢?感觉这个功能很强大,但就是没有注释,有些地方使用有点搞不懂😓
prefetching = 1 表示提前加载
你好,我在使用你的这个三方库的时候,我push到TabPagerControllerDemo样式的控制器,发现这个tabbar和底部的view整体往下偏移了差不多64的位置,为啥你的Demo中没有偏,很奇怪,找了很久原因还没找到