I am developing an iOS app using Rubymotion. I need to access a child label of a view to change it´s text.
How can I access child views (and their attributes) to modify them?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are using Xcode (Interface Builder) to design your views, then you’ll want to use tagging to access your subviews. There are no
propertiesin RubyMotion. It is possible to useattr_accessorto define the setter/getter for a property, but then there is no way to tell Interface Builder how to associate the control with the property name since Xcode doesn’t understand the Ruby code. I have had success taking a project that was first written in Objective-C and using the.xiband.storyboardfiles in a RubyMotion project. In that case, if you createivarswith the same names as the properties in Objective-C, then everything will work.If you are creating your
UIViews programmatically, then you can store each subview in anivarbefore adding the subview to the view.