Search code examples
rubyrubymotion

add icon to UITextField with rubymotionquery


Is it possible to add an icon to to a uitextfield in rmq. If so how can we implement it.

I want to achieve something like this

enter image description here

The documentation for rmq has not mentioned about images in for UITextFieldStylers.

Update : For those who might find this useful, I have implemented it as follows with jamon's recommendation.

Screen

    @email = rmq.append(UITextField, :email_field) do |q|
         q.append(UIImageView, :password_image)
    end

Stylesheet

    def password_image(st)
        st.image =  image.resource('image-name')
        //add margin etc inside frame
    end

Solution

  • I would recommend just adding a UIImageView to the left of the UITextField and positioning it there. Keep it simple.