Timeline for How can I change image tintColor in iOS and WatchKit
Current License: CC BY-SA 4.0
29 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 13, 2022 at 17:34 | comment | added | Brandon | Seems like this no longer works with iOS 16 - has anyone got this working there? | |
| S Apr 20, 2020 at 5:15 | history | suggested | PhillipJacobs | CC BY-SA 4.0 |
added that it's the solution for swift 5 as well
|
| Apr 19, 2020 at 14:52 | review | Suggested edits | |||
| S Apr 20, 2020 at 5:15 | |||||
| Feb 19, 2019 at 8:06 | history | edited | Duncan Babbage | CC BY-SA 4.0 |
Use optional chaining instead of force unwrapping.
|
| Dec 6, 2018 at 2:04 | comment | added | Anonymous-E | @DuncanBabbage I really don't know why it was like that, I've tried to change the colour to cyan, red, blue, green... it's working fine but when I tried the black colour, the image tint became white. so I tried fuzz method below that he's using the function as the extension and it's working right now. | |
| Dec 5, 2018 at 20:10 | comment | added | Duncan Babbage | Hmm. That doesn't sound right, @SopheakSok. When you say it's not working, what specifically are you seeing? | |
| Dec 4, 2018 at 2:56 | comment | added | Anonymous-E | it works with any colour but black? what is happening? @@ | |
| Oct 8, 2018 at 16:55 | comment | added | prolfe | I would just avoid the force unwrapping of the optional and just use optional chaining: theImageView.image = theImageView.image?.withRenderingMode(.alwaysTemplate) | |
| Apr 13, 2018 at 22:48 | history | edited | Duncan Babbage | CC BY-SA 3.0 |
added 5 characters in body
|
| Apr 10, 2018 at 9:27 | history | edited | LinusG. | CC BY-SA 3.0 |
edited body
|
| May 17, 2017 at 10:04 | comment | added | Duncan Babbage | @Bruno image does not need to be black, no. Works with any colour. | |
| Nov 25, 2016 at 15:04 | comment | added | duncanc4 | I had to set the image in Asset Catalog to render as template in order for it to work on iOS. | |
| S Oct 6, 2016 at 7:25 | history | suggested | alephao | CC BY-SA 3.0 |
Added swift 3 syntax
|
| Oct 6, 2016 at 4:01 | review | Suggested edits | |||
| S Oct 6, 2016 at 7:25 | |||||
| Jun 30, 2016 at 18:20 | comment | added | Bruno | is it better with image black ? | |
| Jun 6, 2016 at 13:25 | comment | added | Josep Escobar | Perfect, now i use this method based in your code: + (UIImageView ) tintImageView: (UIImageView *)imageView withColor: (UIColor) color{ imageView.image = [imageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; [imageView setTintColor:color]; return imageView; } | |
| Apr 4, 2016 at 20:24 | history | edited | Duncan Babbage | CC BY-SA 3.0 |
Remove reference to Xcode beta as this is now a permanent feature.
|
| Oct 16, 2015 at 9:28 | comment | added | Katerina | imageWithRenderingMode is too slow. In storyboard and image Assets. you can change this two also: Update the Render Mode to Template Image - thats a better solution | |
| Aug 29, 2015 at 0:04 | review | Suggested edits | |||
| Aug 29, 2015 at 1:42 | |||||
| Aug 27, 2015 at 5:43 | review | Suggested edits | |||
| Aug 27, 2015 at 6:12 | |||||
| Jan 26, 2015 at 21:15 | history | edited | Daniel Rinser | CC BY-SA 3.0 |
Fixed typo in code (BE "colour" vs. AE "color").
|
| Jan 19, 2015 at 16:49 | vote | accept | chewy | ||
| Jan 14, 2015 at 1:47 | history | edited | Duncan Babbage | CC BY-SA 3.0 |
added 231 characters in body
|
| Jan 14, 2015 at 1:40 | history | edited | Duncan Babbage | CC BY-SA 3.0 |
added 295 characters in body
|
| Jan 14, 2015 at 0:33 | history | edited | Duncan Babbage | CC BY-SA 3.0 |
added 40 characters in body
|
| Jan 13, 2015 at 20:58 | history | edited | Duncan Babbage | CC BY-SA 3.0 |
Added information about WatchKit.
|
| Jan 6, 2015 at 2:50 | history | edited | Duncan Babbage | CC BY-SA 3.0 |
Added Swift variant of the code presented in my original answer.
|
| Nov 17, 2014 at 4:28 | comment | added | Ankish Jain | this is the best and simple solution. | |
| Oct 18, 2014 at 18:45 | history | answered | Duncan Babbage | CC BY-SA 3.0 |