You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- (void)didPanOnScrollViewChanged:(NSDictionary<NSKeyValueChangeKey, id> *)change {
UIScrollView *scrollView = [[self presentable] panScrollable];
if (!scrollView) return;
if ((![self isBeingDismissed] && ![self isBeingPresented]) ||
([self isBeingDismissed] && [self isPresentedViewControllerInteractive])) {
if (![self isPresentedViewAnchored] && scrollView.contentOffset.y > 0) {
[self haltScrolling:scrollView]; //isPresentedViewAnchored 为no 卡在这里 ,tableview不能滑动
} else if ([scrollView isScrolling] || [self isPresentedViewAnimating]) {
// While we're scrolling upwards on the scrollView, store the last content offset position
if ([self isPresentedViewAnchored]) {
[self trackScrolling:scrollView];
} else {
/**
* Keep scroll view in place while we're panning on main view
*/
[self haltScrolling:scrollView];
}
} else {
[self trackScrolling:scrollView];
}
} else {
/**
* 当present Controller,而且动画没有结束的时候,用户可能会对scrollView设置contentOffset
* 首次用户滑动scrollView时,会因为scrollViewYOffset = 0而出现错位
*/
if ([self isBeingPresented]) {
[self setScrollableContentOffset:scrollView.contentOffset animated:YES];
}
}
}
如上面, push子控制器后,tableview就不能再滑动了,现在的做法是
- (BOOL)allowsExtendedPanScrolling {
if ([self panScrollable]) {
UIScrollView *scrollable = [self panScrollable];
/*
[TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window.
*/
//if (!scrollable.superview || !scrollable.window) return NO; // 这里去掉这个条件 !scrollable.window
if (!scrollable.superview ) return NO;
[scrollable layoutIfNeeded];
return scrollable.contentSize.height > (scrollable.frame.size.height - self.bottomLayoutOffset);
}
return NO;
}
有什么更好的解决方法或者demo吗?
The text was updated successfully, but these errors were encountered:
参考demo写法在HWFullScreenNavController中编写:
使用HWFullScreenNavController例子,如果子控制器是一个tableview,再次点击push新的子控制器之后,tableview的滑动不生效
发现是scrollable.window这个为nil了导致
导致下面逻辑卡住不能滑动tableview
如上面, push子控制器后,tableview就不能再滑动了,现在的做法是
有什么更好的解决方法或者demo吗?
The text was updated successfully, but these errors were encountered: