[TIMOB-2409] iOS: Expose method to set UIViewContentModes on views
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | core, parity |
Reporter | Guilherme Chapiewski |
Assignee | Unknown |
Created | 2011-04-15T03:18:55.000+0000 |
Updated | 2020-08-23T17:22:04.000+0000 |
Description
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.
Possibly something to discuss about layout. Should be handled by 'auto'?
Marked as a feature request instead of bug.
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.
[~mattapperson] Thank you. If you'd like to propose an API, I can bring it up for discussion.
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...
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.
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
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.
I see mpociot did a fork of my module and started on an android version: https://github.com/mpociot/NappImageView/commit/cc1235b77df327bf984cbc6b65b1f1e4190c4f87
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.
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