bawn / shazam Goto Github PK
View Code? Open in Web Editor NEWA pure-Swift library for nested display of horizontal and vertical scrolling views
Home Page: https://bawn.github.io/#blog
License: MIT License
A pure-Swift library for nested display of horizontal and vertical scrolling views
Home Page: https://bawn.github.io/#blog
License: MIT License
1、将第一个childscrollView上滑到老远
2、点击Menu切换至另一个childscrollView,下滑childscrollView使header和Menu恢复至原状
3、点击Menu切回第一个childscrollView
此时触摸header往下滑,header不会跟着往下滑,只有下面的childscrollView会跟着下滑直到childscrollView偏移为0时 header才能正常滑动
不确定这个是不是我的姿势不正确,文章中提到在 child vc 分别实现下拉刷新,我使用了最简单的系统控件 UIRefreshControl
.
大致代码:
override func viewDidLoad() {
// ...
let refreshControl = UIRefreshControl()
tableView.refreshControl = refreshControl
refreshControl.addTarget(self, action: #selector(refresh), for: .valueChanged)
}
@objc private func refresh() {
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2)) {
self.tableView.refreshControl?.endRefreshing()
}
}
诡异效果:
图一:下拉滑动刷新过程中,左右拖拽 mainScrollView
图二:下拉滑动刷新未结束时,切换到其他 VC, 刷新完成后不会回弹
切换 keepChildScrollViewOffset
没有区别,效果还是一样。
滑动 SupermanViewController 到底部后,依次点击 Batman, WonderWoman,在点击到WonderWoman 时会突变将 HeaderView 显示出来
有两个controller 第一个有两屏幕内容高度的cell,第二个半屏幕内容高度的cell,当第一个滑动将menuview 置顶时,切换到第二个controller,此时第二个controller向上滑动到顶显示出header,再切回第一个controller,controller还是原来的offsety但是header会出现
`//
// ShazamTopView.swift
// Shazam
//
// Created by bawn on 2019/1/24.
// Copyright © 2019 bawn. All rights reserved.
//
import UIKit
public class ShazamTopView: UIView {
....// 省略若干
override public func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
...// 省略若干
var frames = [CGRect]()
userInteractionViews.forEach { (item) in
let frame = convert(item.frame, to: self)
frames.append(frame)
}
for item in frames {
let value = item.contains(point)
return value // 为什么这里第一个就直接 return 了,既然如此,传一个数组的意义是什么?为什么不直接传一个 UIView 对象?
}
return false
}
}
`
设置headerView高度为0, reloadData后,pageController会偏移一个屏幕的宽度,滑动到尾部再次滑动就会崩溃
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.