[TIMOB-2409] iOS: Expose method to set UIViewContentModes on views

GitHub Issuen/a
TypeNew Feature
Affected Version/sn/a
Fix Version/sn/a
Labelscore, parity
ReporterGuilherme Chapiewski


It should be possible to set ContentModes (http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIView_Class/UIView/UIView.html> on UIViews and ImageViews.


  1. Stephen Tramer 2011-04-15 Possibly something to discuss about layout. Should be handled by 'auto'?
  2. Junaid Younus 2012-08-23 Marked as a feature request instead of bug.
  3. me@gmail.com 2014-08-26 This feature is something that is honestly very basic, esp when it comes to imageViews. It would be great to not need to add the overhead to my app of multiple imagviews in order to clip images to fit a given size without stretching and distortion. This should be an API ticket though to also implement http://developer.android.com/reference/android/widget/ImageView.ScaleType.html for android image views I would be happy to do a PR if we can agree on an API for this.
  4. Ingo Muschenetz 2014-08-26 [~mattapperson] Thank you. If you'd like to propose an API, I can bring it up for discussion.
  5. me@gmail.com 2014-08-26 I think for API parity, we should keep the API on the ImageView where it is (IMHO at least) the most needed. I think it should be done via a property of scaleType, with values being constants. The constants I would think should be: CENTER, CENTER_CROP, CENTER_INSIDE, FIT_CENTER, FIT_XY With iOS also having: TOP_LEFT TOP_RIGHT BOTTOM_LEFT BOTTOM_RIGHT LEFT RIGHT TOP BOTTOM Think that should cover it... dont think I missed anything...
  6. Fokke Zandbergen 2015-06-01 For iOS there's a module that implements these: https://github.com/pegli/TiUIEx/blob/master/mobile/iphone/documentation/index.md#imageview This would be a really welcome feature.
  7. Fokke Zandbergen 2015-11-09 It would be good to do the for Android as well: http://developer.android.com/reference/android/widget/ImageView.ScaleType.html I'm sure there's something like this for Windows as wel
  8. Mads Moller 2015-11-10 I have support for all ContentModes on iOS in my module here: https://github.com/viezel/NappImageView/blob/master/iphone/Classes/DkNappImageviewModule.m#L83-L95 You are free to implement this in the SDK.
  9. Mads Moller 2015-11-10 I see mpociot did a fork of my module and started on an android version: https://github.com/mpociot/NappImageView/commit/cc1235b77df327bf984cbc6b65b1f1e4190c4f87
  10. Jong Eun Lee 2016-03-02 I thought that this is very important feature like a requirement. I'm hoping that next version of titanium SDK has this feature for iOS and Android.
  11. Ygor Lemos 2020-08-23 Andrea Vitale has a nice module for this, but it would be awesome to have this in native Ti ImageViews for both iOS and Android. https://github.com/AndreaVitale/av.imageview

JSON Source