imageView iOS Scale question

You must Login before you can answer or comment on any questions.

Hello, is aspectFill supported in any of the newest builds? It is supported within the iOS SDK, however not extended to Ti... This would allow images regardless of proportions to scale to the size (h, w) of the imageView.

4 Answers

Accepted Answer

I've written a module to support content mode and clipping in image views for iOS -- you can download the compiled version from Github here. Example usage:

var imageView = imageview_ex.createImageView({
  top: 20,
  left: 20,
  height: 80,
  width: 80,
  hires: true,
  contentMode: 'aspectfill',
  clipsToBounds: true,
  image: 'http://images2.wikia.nocookie.net/__cb20090714124530/firefly/images/1/11/Firefly_class_ship.jpg'
});
Full docs are here. The module is open source and Apache licensed, so feel free to use it any way you wish. Pull requests are always welcome.

Sorry but.... How can I instance the module? I have this file libcom.obscure.imageview_ex.a, when I import this file to Titanium and add this code on the app.js

var imageview_ex = require('com.obscure.imageview_ex');

The app crashes and show me this error: [ERROR] Script Error = Couldn't find module: com.obscure.imageview_ex.

Please I need help!!!

Thanks but when I´m trying to install the module (adding com.obscure.imageview_ex-iphone-1.0.zip to my resources folder, editing my TiApp.xml file adding this code:

<module platform="iphone" version="1.0">com.obscure.imageview_ex</module>
)

Titanium crashes when I´m trying to compile:

[INFO] One moment, building ...
[WARN] Could not find Titanium Module id: com.obscure.imageview_ex, version: 1.0, platform: iphone
[ERROR] Could not find the following required iOS modules:
[ERROR] id: com.obscure.imageview_ex    version: 1.0
[ERROR] Error: Traceback (most recent call last):
  File "/Users/MyUser/Library/Application Support/Titanium/mobilesdk/osx/2.1.3.GA/iphone/builder.py", line 771, in main
    exit(1)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 374, in __call__
SystemExit: 1

— answered 7 months ago by Fran Rodas
answer permalink
1 Comment
  • Did you clean your project after editing tiapp.xml? Try deleting the build directory. Also, the ImageViewEx module is old; try using the TiUIEx module instead, which contains the same functionality but is a more recent build.

    — commented 7 months ago by Paul Mietz Egli

Yeah!! it´s works!!! Thank you very much for your support!!!

I cleaned the project and everything works.

So, Do you know how can I do this (aspect fill) on Android?

Your Answer

Think you can help? Login to answer this question!