Image Scaling - IPhone

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

function createImage(img) {
    /*
     * Create the left Image
     */
    var left_image = Ti.UI.createImageView({
        left : 5,
        width : 100,
        height : 40,
        image : img
 
    });
    return left_image;
}
I am using this function to add a left image to a table view, but the images don't scale. Seems to work on Andriod.

I know labels can scale on iPhone. Can I use label with remote image? As 'img' is a remote image.

3 Answers

Images definitely scale on iOS. I've used ImageViews within a custom tableview row, and they scale. You don't really show exactly what you're doing with the imageview you get back from createImage().

— answered 10 months ago by Jason Priebe
answer permalink
2 Comments
  • function addRow(rows, title, counter, img) {
        var row = createRow(title);
        var row_label = createLabel(title, 100);
        row.add(row_label);
        var row_img = createImage(img);
        row.add(row_img);
        rows.push(row);
        return rows;
    }
    Once I get the set of rows back I can set the table view data.

    — commented 10 months ago by Steven Marshall

  • Can you post a screenshot that illustrates what's happening? And post the image you're trying to show?

    — commented 10 months ago by Jason Priebe

image scale codes may be useful to you.

   public static void ScaleImageDemo()
    {
        string fileName = "c:/Sample.png";

        REImage reImage = REFile.OpenImageFile(fileName);

        ImageProcessing.ApplyResize(reImage, 0.5f);

        REFile.SaveImageFile(reImage, "c:/reimage.png", new PNGEncoder());
    }

Hi steven, to answer your question Can I use label with remote image? so yes you can use label with remote imges. backgroundImage : String

Background image for the view, specified as a local file path or URL

Your Answer

Think you can help? Login to answer this question!