Coder Social home page Coder Social logo

pgimagepicker's Issues

发现一个bug

如果有一个很长的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!
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.