How to use ImageView and Labels in Xamarin iOS.

Xamarin.iOS
img_xamarin

It’s very easy to user ImageView and Label directly with storyboard at design time, but how to use this controls at runtime or change its property through coding. In this tutorial we are going to see how to use this controls at coding side.

After completion of this demo it’ll look like this:

4.3a

Create a new Solution in Xamarin studio and give it any name and select Single Screen Application.

c

Now just drag and drop a ImageView and Label Control on View hierarchy, now it looks like this:

4.3b

In ImageView name property write imageView and in Label name property write lbl_name.

Now go to your controller.cs file and in ViewDidload method write:

That’s it. With this you can write any text to label runtime with coding or select image runtime with imageview control.

If you like this tutorial then you can download full copy of the code from github

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">