juwencheng / ojnotificationdemo Goto Github PK
View Code? Open in Web Editor NEW模仿iOS10通知
模仿iOS10通知
现在 UIVisualEffectView
的约束规则是 top left bottom right
和 content
一样的。如果更新 content
的约束处理滑动位移,UIVisualEffectView
也会跟着移动。不是预期效果。
UIVisualEffectView
的修改由于这个视图创建之后不需要左右移动,只需跟随 content
上下移动,因此把 left right
约束条件修改为和 self
即 window
的 left right
保持一致即可
content
修改两种方法解决,
修改 content
左右的约束条件为 left width
的条件,即约束 content
的左边或者右边,并且指定宽度,可以做出和现在一样的效果。滑动时,修改左或右的约束值,即可实现滑动效果。缺点是屏幕旋转之后,需要重新计算 width
,更新约束值。
保持 content
左右的约束条件,滑动时,同时修改左右的约束值实现滑动效果。
遇到个很奇怪的问题,死活没法把滑动事件绑定到 content
上。
找了很久才发现是 UIWindow
的 rootViewController
导致的问题。默认情况下 UIWindow
会显示 rootViewController
的 view
,并且是置顶的。所以事件始终无法传递到 content
。只能绑定到 window
上。
把 view
隐藏即可解决。
这里提供了另外一种思路,即把 content
添加到 rootViewController.view
上。
创建CocoaPods 软件库。每次弄的时候都不顺利,这次把详细步骤记录下来,希望以后就不要这么麻烦了。
if 标题存在
展示标题
else
隐藏标题,更新约束
为什么屏幕旋转后没有自动更新样式,监听屏幕旋转后也手动执行 layoutIfNeed
也没有效果
设计可扩展的滑动处理事件
添加 readme 说明
现在使用的 SwipeGesture ,后面改成 PanGesture 增加滑动过程中的体验,更细粒度的控制滑动效果
为了引起用户注意,提醒时增加振动效果。
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.