Hello,

You could extend your control and put the field in it you need. Try this:

public class MyLabel : UILabel {

     public int Id { get; set; }

}

And in your loop you do:

foreach (var control in this.View.Subviews) {
     if (control is MyLabel) control.Text =
NSBundle.MainBundle.LocalizedString(control.Id, "");
}

Hope this helps.

Mikkel

On Fri, Sep 16, 2011 at 07:07, Karl Heinz Brehme Arredondo <
k...@e-magesolutions.com> wrote:

> Hi,
>
> Is there a way to get the ID (aka name of the variable or Outlet name) of a
> control?
>
> I need to loop for all controls and then do something like that:
>
> foreach (UIView view in this.View.Subviews)
> {
> If (view.GetType().Name == "UILabel")
> {
> view.Text = NSBundle.MainBundle.LocalizedString(*view.ID*, "");
> }
> }
>
> So all controls that has a corresponding Localizable.srings file with it ID
> as key for localization can be translated automatically depending
> on Localizable.srings.
>
> Thanks,
>
> Karl
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to