Git Product home page Git Product logo

Comments (10)

christoff-1992 avatar christoff-1992 commented on September 26, 2024 8

Im not sure if its a bug, I would have thought that setting the layers contents to nil should in theory remove the image however setting the layers contents to a CALayer works fine. e.g.

if #available(iOS 13, *) {
   self.layer.contents = CALayer()
} else if #available(iOS 11, *) {
   super.image = nil
} else {
   layer.contents = nil
}

from uiimageviewalignedswift.

skyparentile avatar skyparentile commented on September 26, 2024 3

Fixed removing
if #available(iOS 11, *) { super.image = nil }

everywhere (didMoveToSuperview,didMoveToWindow,updatelayout, etc)

This fix also for iOS11.

You need only to invalidate layer:
layer.contents = nil

from uiimageviewalignedswift.

awedeebawe avatar awedeebawe commented on September 26, 2024

Instead of complaining, try to fix it yourself ;)

from uiimageviewalignedswift.

yuriandryu avatar yuriandryu commented on September 26, 2024

I tried, it didn’t work. I don’t have one problem, please solve this problem as soon as possible.

from uiimageviewalignedswift.

awedeebawe avatar awedeebawe commented on September 26, 2024

@yuriandryu I forked the repo, then replaced the superclass to UIView. Removed the override-s and the calls for super.image and basically fixed the errors in the class. Yes, I lost the ability to attach Kingfisher to that UIImageView, or the RxCocoa .rx.image property, but still, it works now.

from uiimageviewalignedswift.

yuriandryu avatar yuriandryu commented on September 26, 2024

I respect. did as you said, everything works now! Thanks bro

from uiimageviewalignedswift.

neilkachu avatar neilkachu commented on September 26, 2024

Rather than remove kf etc UIImageView support I worked around this by ensuring the super image wasn't one that can be seen.
So I updated updateLayout to set the super image to a transparent image like so; works fine for now.

if #available(iOS 11, *) { super.image = UIImage(named: "transparent_image") }

from uiimageviewalignedswift.

CRoig avatar CRoig commented on September 26, 2024

@neilkachu Tried your solution unsuccessfully 😢. Is transparent_image just a place holder, or it is an actual existing transparent image? this is suppose to replace the = nil.

from uiimageviewalignedswift.

tomspee avatar tomspee commented on September 26, 2024

@neilkachu Your solution doesn't work for me unfortunately. I have a transparent asset but still double images.

from uiimageviewalignedswift.

neilkachu avatar neilkachu commented on September 26, 2024

@neilkachu Tried your solution unsuccessfully 😢. Is transparent_image just a place holder, or it is an actual existing transparent image? this is suppose to replace the = nil.

Yes, just a 1px transparent image in the Assets lib so not sure why it's not working your end, that was the only change I ended up with.,
@christoff-1992 's solution looks cleaner, I'd re-try with that.

from uiimageviewalignedswift.

Related Issues (20)

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.