xiaozhuxiong121 / pgimagepicker Goto Github PK
View Code? Open in Web Editor NEW类似于微博、微信的多图浏览/查看
License: MIT License
类似于微博、微信的多图浏览/查看
License: MIT License
如果有一个很长的tableView/collectionView,每个cell/item里有一张图片.
这种情况下是获取不了未展示的图片的frame的.
会导致一个崩溃:
▿ 21 elements
- 0 : "0 ??? 0x0000000123b6aba7 0x0 + 4894141351"
- 1 : "1 ??? 0x0000000123b6ac95 0x0 + 4894141589"
- 2 : "2 Coll 0x000000010a7ac7c0 main + 0"
- 3 : "3 PGImagePicker 0x000000010ac36300 _T013PGImagePicker12PGScrollViewC11convertRect33_47910DC33138F0D90388FDFB1D47CA6DLLSQySC6CGRectVGSo6UIViewC3for_tF + 1040"
- 4 : "4 PGImagePicker 0x000000010ac389f8 _T013PGImagePicker12PGScrollViewC10tapHandler33_47910DC33138F0D90388FDFB1D47CA6DLLySo7UITouchCFyycfU_ + 312"
- 5 : "5 PGImagePicker 0x000000010ac39ae2 _T013PGImagePicker12PGScrollViewC10tapHandler33_47910DC33138F0D90388FDFB1D47CA6DLLySo7UITouchCFyycfU_TA + 50"
- 6 : "6 PGImagePicker 0x000000010ac27ca9 _T0Ix_IyB_TR + 41"
- 7 : "7 UIKit 0x000000010b9209ec +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 560"
- 8 : "8 UIKit 0x000000010b920f38 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:animations:completion:] + 86"
- 9 : "9 PGImagePicker 0x000000010ac38884 _T013PGImagePicker12PGScrollViewC10tapHandler33_47910DC33138F0D90388FDFB1D47CA6DLLySo7UITouchCF + 1028"
- 10 : "10 PGImagePicker 0x000000010ac38e3c _T013PGImagePicker12PGScrollViewC10tapHandler33_47910DC33138F0D90388FDFB1D47CA6DLLySo7UITouchCFTo + 60"
- 11 : "11 Foundation 0x000000010ace6609 __NSFireDelayedPerform + 409"
- 12 : "12 CoreFoundation 0x000000010ec07374 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20"
- 13 : "13 CoreFoundation 0x000000010ec07032 __CFRunLoopDoTimer + 1026"
- 14 : "14 CoreFoundation 0x000000010ec06bea __CFRunLoopDoTimers + 266"
- 15 : "15 CoreFoundation 0x000000010ebfe604 __CFRunLoopRun + 2308"
- 16 : "16 CoreFoundation 0x000000010ebfda89 CFRunLoopRunSpecific + 409"
- 17 : "17 GraphicsServices 0x0000000113c679c6 GSEventRunModal + 62"
- 18 : "18 UIKit 0x000000010b85ed30 UIApplicationMain + 159"
- 19 : "19 Coll 0x000000010a7ac7f7 main + 55"
- 20 : "20 libdyld.dylib 0x00000001113ebd81 start + 1"
崩溃原因:
因为没有设置frame, rect为nil, 强制解包失败!
fileprivate func convertRect(for view: UIView) -> CGRect! {
let rootView = UIApplication.shared.keyWindow?.rootViewController?.view
let rect = view.superview?.convert(view.frame, to: rootView)
return rect!
}
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.