The New Image Editor Is Here!



Right-click on the Assets List and select New Image Set: Select the new image set and the editor will be displayed: From here, drag in images for each of the different devices and resolutions required. Double-click the new image set's Name in the Assets List to edit it: When using an Image Set in the iOS Designer, simply select the set's name. Upload or drag and drop your photo into the editor. Crop or resize your photo to get the size you want. Change the mood of your photo with a filter. Adjust brightness, saturation and contrast. Download your edited photo! Mar 02, 2015 Collaboration between ViewNX-Movie Editor and ViewNX-i allows users to convert movies and to create new movies by combining multiple still images and movies. This allows not only those skilled at movie processing and editing, but those who are completely new to movie editing, to easily enjoy working with movies using easy-to-understand operations.


The image editor is where you can create your own sprites or edit those you have imported or created previously. If you have used any image tools previously then this should be familiar to you but there are a few things to note when using the GameMaker Studio 2 image editor which may not be immediately apparent:

  • When you create multiple frames, you can draw to them as they animate! So, if you press the play button on the Frame Control bar, and then select a brush and start to draw in the editor window, you'll see that the frames will animate in the editor and what you draw will be added to the corresponding frame in that moment. You can experiment with different frame rates until you get something you like, but once you've got the hang of how this works you'll be creating dynamic sprites and effects in no time.
  • You can pull the Image Editor tab off of the main workspace window into it's own window. This can be handy when using multiple monitors, for example.
  • When you use the copy functions to, for example, copy a selection of an image, then the selection copied gets added to your brush list. This means that you can select a part of an image and then use it in the rest of the paint tools to draw lines, polygons or just paint freely. The brush can be scaled and blended with a colour too. Note that the Paste functionality is not intended for use internally within the editor as anything you copy is added to the brush list and so can be selected for 'pasting' that way. Instead paste is simply for you to capture something from an external program and paste it into the Image Editor.
  • You can have multiple layers for each sprite thanks to the handy layer editor. These layers can ordered and even placed in folders to make creating more complex images easier.
  • You can quickly change between sub-images (frames) in the editor by using the '1' and '2' keys on the keyboard.

Those are just some of the more advanced features that the image editor offers. To find out the full feature range, please read the items below detailing the functions of every part of the editor:

This part of the window shows the frames in the order that they will be animated in. You can click the (+) button to the left to add further frames - or use the Image Menu - and you can also click and drag any of the frames to change its position along the time-line. In the top left of the Frame View you can switch on Onion Skinning , which means that in a single frame of any sprite animation, you can choose to see any of the preceding or succeeding frames as a semi-transparent layer under the image frame you are currently editing. The great thing about this is that each frame is drawn slightly lighter than the last so you can see how the animation has been progressing from frame to frame while drawing the next one. Enabling this will show some extra controls over the frames which you can click and drag to set the number of preceding frames to show as well as the number of following frames.

Beneath the Onion Skin button, you have the Loop Control button used to set whether the sprite loops (goes back to frame 1 when the last frame is reached) or ping-pongs (goes backwards through the frames when the last frame is reached). The Play button at the bottom is for starting/stopping the preview of the animation.

You can click on any frame to select it for editing, and a selected frame will have a Delete icon at the top corner which you can click to remove the frame from the sprite. You can also click / + on multiple frames to select them together, in which case clicking the Delete icon will delete all the selected frames.


This bar contains the Frame Controls. Here you can set the speed at which the animation frames should be played back using the input box on the left. The frame speed can either be based on 'Frames per second', or 'Frames per game frame'. The total number of frames available are shown to the right along with the current frame that has been selected, and you can collapse this bar (hide it) by clicking on the icon to the left. You can set this to always start open or always start closed from the Image Editor Preferences.

Note that the value used here for the animation speed will also set the way the sprite is animated when used in a game, either as a sprite asset on a layer or as a sprite assigned to an instance, although you can modify this at runtime using the appropriate functions and variables.


The canvas controls deal with various aspects of how the main draw canvas and its contents are displayed. The options are:

  • Toggle Canvas Grid : This will toggle on/off the canvas grid. This is a grid that GameMaker Studio 2 draws over the main canvas to divide it into sections, and by default is set to 1px in size. However if you click the Grid Menu icon you will open the grid options: These options permit you to set the grid colour and alpha, as well as the cell values for the grid along the X and Y axis. You also have an option to enable or disable grid snapping here (disabled by default).
  • Canvas Zoom Controls : These buttons control the current canvas zoom level. You can zoom in or out and clicking the button will reset the canvas to be 1:1 with the image being edited. Note that you can also zoom in and out using the / and the Mouse Wheel , and pressing + Enter will set the canvas to be 1:1 with the image. You can also click the Window Fit button to make the entire room canvas fit within the current editor workspace (this will zoom in/out as appropriate to make it fit).
  • Split Canvas : Clicking this will cycle between splitting the canvas horizontally, vertically keeping it a single a single canvas. When in split canvas view, each canvas will have its own set of Canvas controls so you can zoom one in and the other out, for example, and you can edit either canvas with the changes being reflected in the other canvas. To change the canvas view toggle, you can click the Split Options button and select the one you wish to use or simply click the SPlit View button until it cycles to the one you want.

Image editor download

This is the main editing window for your images. Here you can apply any of the tools on the right to paint on the currently selected layer. You can paint with either the left or the right mouse button (and assign a colour to each from the colour picker) and use any of the brushes defined from the top right of the editor. You can also use / and the Mouse Wheel to zoom in or out, and pressing / + Enter will set the canvas to be 1:1 with the image (or you can use the Canvas Controls as explained above). Note too that you can pan around the canvas using the middle mouse button or + .


This small bar at the bottom shows the different values for the mouse position and width and height of the selection tools in the editor.

Image Editor Online


Here you can select the brush to paint with. By default you have a selection of different sized square and round brushes to use, but you can easily create your own brush by painting on the image layer, and then selecting the part you wish to use for the new brush and using / + 'C' to copy it. The copied section will then be added to your brushes and you can paint with it as you would any other brush, and this includes using the different paint tools available like drawing a line. Note that the default blending colour for the new brush will be white, but if you change the colour with the colour picker and paint using the brush, it will be blended with this new colour. If you want to remove a brush from the list, simply click on it and press the key and it will be removed.


The top of this section has a number or predefined colour swatches that you can choose from, and they can be assigned to the left and right mouse buttons respectively by clicking on them with either button (you can also swap the colours between each button by clicking the arrow icon in beside the swatches). The colours selected will be shown below as swatches beside the image of the mouse, and you can then click these to open the Colour Picker window:

From this window you can define the colour using any of the available sliders and gadgets, or you can input values directly for the RGBA values or HVS values. Note that if you double click on any of the default colour swatches, you can also bring up the colour picker tool and edit the default palette for the sprite. Clicking 'Okay' in the colour picker in this case will set the palette to the new colour and save it along with the sprite resources. These colour palettes can then be swapped and applied to different sprites using the colour palette Options menu:

So, you can create a custom colour palette in a sprite image and then use that to set the palette for any other sprite in the resource tree, or you can open a sprite image and import the colour palette from any other sprite in the resource tree.


Below we list the tools that are available by default with GameMaker Studio 2 - note that all tools can be used with the left and right mouse button, and most of them have keyboard shortcuts associated with them (the important ones are listed here along with the tool, but for a full list please see the page on Shortcuts). Most tools will also have extra options that will be visible at the top of the image editor as shown below:

This is the pencil tool. It uses the selected brush to paint in the selected colour for the mouse button, and you can set the size from the top bar of the image editor as well as enable/disable smoothing (interpolation). Note that you can also resize and scale any brush by holding down + Z then clicking and dragging the mouse to change the proportions of the brush, or alternatively select one of the predefined brushes from the top right.
This is the eraser tool. It uses the selected brush to erase an area on click from either mouse button. Selecting this will also add extra tools to the top bar of the editor to permit you to scale the brush or enable/disable smoothing (interpolation).
This is the paint bucket tool. This will fill in an area of the image based on the chosen alpha tolerance setting, which you can change using the slider shown in the top bar of the editor.
This is the colour remove tool. When you select it, you can then click or on any pixel in the image and all pixels that are of the same colour will be removed (they are technically replaced with the colour black at an alpha of 0). The top bar has a tolerance slider where you can set the pixel colour tolerance - the lower this value the more exact a colour has to match the one that was clicked, while a higher value will expand this to include those colours that are similar to the one clicked. If you have previously made a selection using any of the selection tools, then only clicking on pixels within the selection will have an effect, and only the pixels within the selection will be removed.
This is the colour replace tool. When you select it, you can then click or on any pixel in the image and all pixels that are of the same colour will be replaced by the colour assigned to the mouse button used. The top bar has a tolerance slider where you can set the pixel colour tolerance - the lower this value the more exact a colour has to match the one that was clicked, while a higher value will expand this to include those colours that are similar to the one clicked. If you have previously made a selection using any of the selection tools, then only clicking on pixels within the selection will have an effect, and only the pixels within the selection will be affected by the colour change.
This tool will draw a line between two points. Click once with either button to create the first point and then click again elsewhere create another point and join them. The line will be drawn using the selected brush to create the outline, and you can edit some of the brush properties using the top bar of the editor (size, smoothing (interpolation), etc...).
This tool will draw either a filled or an outlined rectangle. If you click in the top left of the icon, it will be outlined, while clicking the bottom right will be filled and if you require both then you can select that option from the top bar of the image editor (or use + to select one then the other on the toolbox icon), as well as set the size and smoothing (interpolation) of the brush being used. The rectangle will then be drawn using the selected brush. Note that while drawing you can hold down and click to draw from the centre of the mouse position.
This tool will draw either a filled or an outlined ellipse. If you click in the top left of the icon, it will be outlined, while clicking the bottom right will be filled and if you require both then you can select that option from the top bar of the image editor (or use + to select one then the other on the toolbox icon), as well as set the size and smoothing (interpolation) of the brush being used. The ellipse will be drawn using the selected brush to create the outline. Note that while drawing you can hold down and click to draw from the centre of the mouse position.
This tool will draw either a filled or an outlined polygon. If you click in the top left of the icon, it will be outlined, while clicking the bottom right will be filled and if you require both then you can select that option from the top bar of the image editor (or use + to select one then the other on the toolbox icon), as well as set the size and smoothing (interpolation) of the brush being used. You click to add points to the polygon and when you are happy with the results you should select a different tool to commit the changes and generate the image. The polygon will be drawn using the selected brush.
This is the spline tool. It uses the selected brush to create a spline. You click and hold the mouse button to set a point and then drag the mouse to generate the spline, releasing the mouse and repeating to add further points and curves. The spline will be drawn using the selected brush, which can be edited using the top bar of the editor to set size and smoothing (interpolation). The top bar also has a setting for Iterations which will define how smooth the resulting spline is (lover values will be rougher, higher smoother, and the default value is 10).
This is the text input tool. It creates a new text layer where you can type anything you need. You can set the font to use as well as the formatting from the top bar of the image editor.
The eye-dropper tool permits you to sample a colour from the image currently being edited.
With this tool you can generate a rectangular selection. You can cancel a selection from the Image menu or pressing .
With this tool you can 'paint' a selected area using any of the brushes, including custom brushes. All the same keyboard shortcuts apply as for the Pencil tool.
The magic wand selection tool will select areas of the same colour based on the tolerance value set. If you tick 'Colour only' then alpha value will not be taken into consideration. You can cancel a selection from the Image menu or pressing .
This is the rotate tool. If you have an area selected using the Selection tool, then clicking this will permit you to rotate the selected area by an arbitrary amount from 0° to 360°. If you do not have an area of the image selected then this will permit you tyo rotate the current brush. To rotate, simply hold down the left mouse button and drag left or right or set the value directly in the top bar. To accept the changes you can press either or Enter or select another tool. Note that accepting the change will not change the source material, but rather create a new Brush resource for you to use with the selected image or brush rotated by the amount you set. Also note that the keyboard shortcut Z can be used to rotate any selection or brush by 90° and that this option does not create a new brush and will only affect how the current brush is drawn.
This is the mirror tool. Selecting this will mirror the current brush along the vertical axis. This option does not create a new brush and will only affect how the current brush is drawn.
This is the flip tool. Selecting this will mirror the current brush along the horizontal axis. This option does not create a new brush and will only affect how the current brush is drawn.
This is the pan tool. When you select this, you can then click and drag the mouse to pan the layer contents around within the layer. Note that any pixels outside of the draw canvas will not be visible and the image will be cropped to the draw canvas size when you change tool again. Note that if you have made a selection then the selected pixels will be moved rather than the contents of the layer.

You can create layers in the image editor for different parts of your image, and these layers can be manipulated and drawn to using the various brushes and tools. To create a new layer, simply click the icon, and to remove it again the icon. Layers can also be ordered by clicking on a layer and then dragging the layer up or down to the position you require, and you can further organise the layers by creating folders using the button and then dragging layers into them. If you double click on a layer (or use and select Edit Layer Properties) you'll get access to the Layer Properties window:

Here you can name the layer as well as set the blend mode (the way that it should be 'mixed' with the layers beneath), choosing from normal, additive, subtractive or multiply blends. Finally you can set the opacity (transparency) of the layer with a slider, but note that this is cumulative with the actual alpha value of individual pixels - for example, if you have pixels that are 50% opaque and set the layer opacity to 50%, the final pixels will be drawn at 25% opacity.


Context Menu

Apart from those tools within the image editor itself, there are also a number of extra tools available to you from the Menu Bar at the top of the IDE:

These menus are explained below:

The Image menu has the following options:

  • Cut Frame / Selection - Cut the frame or selection from the image (depending on Editor focus). If cutting a selection, this will add it to the brushes.
  • Copy Frame / Selection - Copy the frame or the selection from the image (depending on Editor focus). If copying a selection, this will add it to the brushes.
  • Paste Frame / Selection - Paste the frame from the clipboard, or paste the selection from the clipboard to the image (depending on the current focus of the IDE). When pasting into an image, you should note that this option is designed only for use with clipboard data from external programs. When you cut or copy to the clipboard from an image in the Image Editor, this is added to the brushes in the top right of the editor, and you should select a brush to draw with the cut/copied selection rather than try to paste it into the image. Also note that a number of programs will have issues pasting transparencies from the clipboard into GameMaker Studio 2 image editor due to the format used by the clipboard.
  • Select All - Select the full image.
  • Cancel Selection - Clear any selection from the image.
  • Invert Selection - Invert the current selection.
  • Add Frame - Add a new frame to the sprite.
  • Insert Frame - Insert a new frame after the one currently showing.
  • Delete Selected Fames - Remove the selected frame from the sprite (you can use + and/or + to select multiple frames).
  • Import Image(s) - Load an image to be used as a frame from disk. Note that you can load multiple frames at once by selecting multiple individual files to import in the explorer window. Once you have selected your file or files you will be shown the following Import window: Here you can choose how the imported image should be added to the current sprite, permitting you to resize the entire draw canvas, crop or pad it, and also set the 'anchor' position for placing the new image(s).
  • Convert to Frames - This option will convert a single image into a number of separate frames. You must first have created a single frame with all the parts of the animation in it (or imported a single strip image) like the one shown below: Since this is a single image and we want to convert it into individual frames, we can use this option which will then open the following window: Here you can set how the single image should be split to create the frames, setting the number of frames, the width and height of the frames and any including any offset values.
  • Import Strip Image - This option will open a file explorer and prompt you to look for a single strip image file to be used to create frames from. Once selected an image the Import strip window will open, exactly the same as for the Convert To Frames option shown above.
  • Export to PNG - Selecting this option will export the sprite as a single PNG image. If the sprite has more than a single image, then a 'strip' sprite will be created with all the images, one after another, and the save file name will automatically be appended with '_stripX', where 'X' is the number of frames exported. For example, a five frame sprite will be exported as 'sprite_name_strip5.png'.
  • Resize All Frames - When you select this option it will open the following window where you can set the way that you want to resize all the animation frames that comprise the sprite: You can choose to either Scale the image, or to Resize canvas. If you choose to scale theimage then you simply select the new width and/or height for each frame, whether to scale using the same aspect ratio, and also whether to scale in pixels or percent. Note that when scaling you can enable interpolation on or off, where having it on will case the pixels to blur or 'smear' as the image is scaled (in general, for hi resolution art you want this on, but for pixel art you want this off).
    The option to resize the canvas will not alter the pixels within the image but instead increase or decrease the size of the canvas that the images are being drawn on. You can set where the 'anchor' for the resize should be using the arrow icons, then set the new size (in pixels or as a percentage) as well as set whether to maintain the aspect ratio of the original frames. Note that making the frame smaller than the original sprite images will crop the pixels.
  • Crop All Frames To Selection - This option will only be available when you have an area of the image selected in the main draw canvas. When you then choose this option, the image being edited (and all other frames in the animation) will be cropped to the boundaries of the selection.
  • Auto Trim All Frames - This option permits you to trim all the zero-alpha pixels from around the edges of a sprite. This will take into consideration all image frames within the sprite, so each side will crop to the edge of whichever frame has the furthest non-zero alpha pixel.
  • Reverse Frames - Selecting this will simply reverse the frame order for the sprite.
  • Mirror - This option permits you to mirror either the current frame all all the frames that comprise the sprite along the vertical axis.
  • Flip - This option permits you to flip either the current frame all all the frames that comprise the sprite along the horizontal axis.
  • Rotate all Frames (clockwise 90°) - This option will rotate all the frames of the animation 90° clockwise.
  • Rotate all Frames (anti-clockwise 90°) - This option will rotate all the frames of the animation 90° anti-clockwise.

The View menu has the following options:

Image Resizer

  • 1:1 - Scale the image to be 1:1 with the resolution (ie: actual size) and center it in the image edit window.
  • Fit Screen - Scale the image to fill the image edit window.
  • Toggle grid - Toggle the pixel grid. This is the same as the grid button found in the Canvas COntrols (explained further up this page).
  • Onion Skin Settings - Change the onion skin settings. This will open the following window where you can set the frames shown by the onion skin button, as well as the opacity and colour of the skinned frames.

The Effects menu is where you can add your own custom effects plugins, and has the following effects by default:

  • Blur - Apply a blur effect to the image. You can set the intensity as well as the type of blur to use (box or gaussian) and set whether to only blur along the horizontal or vertical axis, or along both. You can then choose to apply this to only the current layer, visible layers or all layers.
  • Greyscale - Desaturate the image by a determined amount. You can choose to apply this to only the current layer, visible layers or all layers.


-->

This article covers including an image asset in a Xamarin.iOS app and displaying that image either by using C# code or by assigning it to a control in the iOS Designer.

Adding and organizing images in a Xamarin.iOS app

When adding an image for use in a Xamarin.iOS app, the developer will use an Asset Catalog to support every iOS device and resolution required by an app.

Added in iOS 7, Asset Catalogs Image Sets contain all the versions or representations of an image that are necessary to support various devices and scale factors for an app. Instead of relying on the image assets filename, Image Sets use a Json file to specify which image belongs to which device and/or resolution. This is the preferred way to manage and support images in iOS (from iOS 9 or greater).

Adding images to an asset catalog image set

As stated above, an Asset Catalogs Image Sets contain all the versions or representations of an image that are necessary to support various devices and scale factors for an app. Instead of relying on the image assets filename, Image Sets use a Json file to specify which image belongs to which device and/or resolution.

To create a new image set and add images to it, do the following:

  1. In the Solution Explorer, double-click the Assets.xcassets file to open it for editing:

  2. Right-click on the Assets List and select New Image Set:

  3. Select the new image set and the editor will be displayed:

  4. From here, drag in images for each of the different devices and resolutions required.

  5. Double-click the new image set's Name in the Assets List to edit it:

When using an Image Set in the iOS Designer, simply select the set's name from the dropdown list in the Property Editor:

  1. Open the Asset Catalog from the Solution Explorer, and in the top left corner, click the Plus button:

  2. Select Add Image Set and the Image Set editor will be displayed for the new image set. From here, drag in images for each of the different devices and resolutions required.

Renaming an image set

To rename an Image Set, do the following:

  1. In the Solution Explorer, double-click the Asset Catalog file to open it for editing:

  2. Select the Image Set to rename:

  3. In the Properties Explorer, scroll to the bottom and select Name(under the Misc section):

  4. Enter a new Name for the Image Set and save the changes.

When using an Image Set in code, reference it by name by calling the FromBundle method of the UIImage class. For Example:

Important

If the images assigned to an Image Set are not showing up correctly, ensure that the correct filename is being used with the FromBundle method (the Image Set and not the parent Asset Catalog name). For PNG images, the .png extension can be omitted. For other image formats, the extension is required (eg. PurpleMonkey.jpg).

Using vector images in asset catalogs

As of iOS 8, special Vector class has been added to Image Sets that allows the developer to include a PDF formatted vector image in the cassette instead including individual bitmap files at the different resolutions. Using this method, supply a single vector file for the @1x resolution (formatted as a vector PDF file) and the @2x and @3x versions of the file will be generated at compile time and included in the application's bundle.

For example, if the developer includes a MonkeyIcon.pdf file as the vector of an Asset Catalog with a resolution of 150px x 150px, the following bitmap assets would be included in the final app bundle when it was compiled:

  • MonkeyIcon@1x.png - 150px x 150px resolution.
  • MonkeyIcon@2x.png - 300px x 300px resolution.
  • MonkeyIcon@3x.png - 450px x 450px resolution.

The following should be taken into consideration when using PDF vector images in Asset Catalogs:

  • This is not full vector support as the PDF will be rasterized to a bitmap at compile time and the bitmaps shipped in the final application.
  • The size of the image cannot be adjusted once it has been set in the Asset Catalog. If the developer attempts to resize the image (either in code or by using Auto Layout and Size Classes) the image will be distorted just like any other bitmap.
  • Asset Catalogs are only compatible with iOS 7 and greater, if an app need to support iOS 6 or lower, it cannot use Asset Catalogs.

Working with template images

Based on the design of an iOS app, there might be times when the developer needs to customize an icon or image inside of the User Interface to match a change in color scheme (for example, based on user preferences).

Photo editor

To easily achieve this effect, switch the Render Mode of the Image Asset to Template Image:

From the iOS Designer, assign the Image Asset to a UI control, then set the Tint to colorize the image:

Optionally, the Image Asset and Tint can be set directly in code:

To use a Template Image completely from code, do the following:

The New Image Editor Is Here!

Because the RenderMode property of a UIImage is read only, use the ImageWithRenderingMode method to create a new instance of the image with the desired Render Mode setting.

There are three possibly settings for UIImage.RenderMode via the UIImageRenderingMode enum:

  • AlwaysOriginal - Forces the image to be rendered as the original source image file without any changes.
  • AlwaysTemplate - Forces the image to be rendered as a Template Image by colorizing the pixels with the specified Tint color.
  • Automatic - Either renders the image as a Template or Original based on the environment that it is used in. For example, if the image is used in a UIToolBar, UINavigationBar, UITabBar or UISegmentControl it will be treated as a Template.

Adding new assets collections

When working with images in Assets Catalogs there might be times when a new collection will be required, instead of adding all of the app's images to the Assets.xcassets collection. For example, when designing On-Demand Resources.

To add a new Assets Catalog to the project:

  1. Right-click on the Project Name in the Solution Explorer and select Add > New File...

  2. Select iOS > Asset Catalog, enter a Name for the collection and click the New button:

  1. In the Solution Explorer, right-click on Asset Catalogs folder, and select Add > New Asset Catalog.

  2. Give it a name and click Add:

From here, the collection can be worked with in the same way as the default Assets.xcassets collection automatically included in the project.

Using images with controls

In addition to using images to support an app, iOS also uses images with app control types such as tab bars, toolbars, navigation bars, tables, and buttons. A simple way to make an image appear on a control is to assign a UIImage instance to the control’s Image property.

FromBundle

The FromBundle method call is a synchronous (blocking) call that has a number of image loading and management features built-in, such as caching support and automatic handling of image files for various resolutions.

The following example shows how to set the image of a UITabBarItem on a UITabBar:

Assuming that MyImage is the name of an Image Asset added to an Asset Catalog above. When working Asset Catalog images, just specify the name of the Image Set in the FromBundle method for PNG formatted images:

For any other image format, include the extension with the name. For example:

For more information about icons and images, see the Apple documentation on Custom Icon and Image Creation Guidelines.

Displaying an image in a storyboard

New

Once an image has been added to a Xamarin.iOS Project using an Asset Catalogs, it can be easily displayed on a Storyboard using a UIImageView in the iOS Designer. For example, if the following Image Asset has been added:

Image editor online, free

Do the following to display it on a Storyboard:

  1. Double-click the Main.storyboard file in the Solution Explorer to open it for editing in the iOS Designer.

  2. Select an Image View from the Toolbox:

  3. Drag the Image View onto the design surface and position and size it as required:

  4. In the Widget section of the Property Explorer select the desired Image asset to be displayed:

  5. In the View section, use the Mode to control how the image will be resized when the Image View is resized.

  6. With the Image View selected, click it again to add Constraints:

  7. Drag the 'T' shaped handle on each edge of the Image View to the corresponding side of the screen to 'pin' the image to the sides. In this way, the Image View will shrink and grow as the screen is resized.

  8. Save the changes to the Storyboard.

Do the following to display it on a Storyboard:

  1. Double-click the Main.storyboard file in the Solution Explorer to open it for editing in the iOS Designer.

  2. Select an Image View from the Toolbox:

  3. Drag the Image View onto the design surface and position and size it as required:

  4. In the Widget section of the Property Explorer select the desired Image asset to be displayed:

  5. In the View section, use the Mode to control how the image will be resized when the Image View is resized.

  6. With the Image View selected, click it again to add Constraints:

  7. Drag the 'T' shaped handle on each edge of the Image View to the corresponding side of the screen to 'pin' the image to the sides. In this way, the Image View will shrink and grow as the screen is resized.

  8. Save the changes to the Storyboard.

Displaying an image in code

Just like displaying an image in a Storyboard, once an image has been added to a Xamarin.iOS Project using an Asset Catalogs, it can be easily displayed using C# code.

Take the following example:

This code creates a new UIImageView and gives it an initial size and position. Then it loads the image from an Image Asset added to the project and adds the UIImageView to the parent UIView to display it.

Related links