简体   繁体   English

如何在 xamarin iOS 项目故事板文件中将 LaunchScreen 图像宽度约束设置为超级视图?

[英]How to set LaunchScreen image width constraint to superview in xamarin iOS project storyboard file?

I am implementing a splash screen for my app.我正在为我的应用程序实现启动画面。 I just came to know about storyboard constraints to support multiple devices.我刚开始了解支持多种设备的故事板约束。 Basically, I feel it very difficult to understand it as a beginner in this, also I see there is no apt documentation in xamarin also.基本上,我觉得作为初学者很难理解它,而且我看到 xamarin 中也没有 apt 文档。 I want to know the steps to set an imageview width to its super view (View controller) .我想知道将图像视图宽度设置为其超级视图(视图控制器)的步骤

I see what I should do from here, Visual studio Xamarin iOS launchscreen storyboard layout .我知道我应该从这里做什么, Visual Studio Xamarin iOS 启动屏幕故事板布局 But, how do I add those constraints, totally no idea..?!但是,我如何添加这些约束,完全不知道..?! Particularly imageview width and height to superview, trailing and leading特别是图像视图的宽度和高度到超级视图、尾随和前导

Now, I can only know how to set the constraints in designer by dragging, I'v only learnt to center the image to super view in X and Y (Horizontally and vertically).现在,我只能知道如何通过拖动来设置设计器中的约束,我只学会了在 X 和 Y(水平和垂直)上将图像居中以超级视图。 There is no button to add constraints.没有添加约束的按钮。 How to add leading and trailing constraints?如何添加前导和尾随约束? I'm using Visual Studio 2017 for Windows我使用的是 Visual Studio 2017 for Windows

I got it working.我让它工作了。

Step 1: Open storyboard file with lowest screen resolution device set (iPhone 4s) and drag & drop an imageview to fill the view controller.步骤 1:使用最低屏幕分辨率设备集(iPhone 4s)打开故事板文件,然后拖放一个图像视图以填充视图控制器。

Step 2: Set the uiimageview source from resources/image assets.第 2 步:从资源/图像资产中设置 uiimageview 源。

Step 3: Click on the image -> Properties Tab -> Layouts section.第 3 步:单击图像 -> 属性选项卡 -> 布局部分。 You will see like this你会看到这样

在此处输入图片说明

Step 4 : Properties -> Layout -> Under View group, there is title called Arrange , there is a autosizing box and example box.第 4 步:属性 -> 布局 -> 在视图组下,有一个名为排列的标题,有一个自动调整示例框。

Step 5 : You should click all the I-bars and lines in the center to make it red like below to fill the width (you can see that reflecting in the example box as you click)第 5 步:您应该单击中心的所有 I-bars 和线条,使其像下图一样变成红色以填充宽度(您可以在单击时看到示例框中的反射)

在此处输入图片说明

Now, SAVE and then switch to other devices, you should have that UIImageview filling the device's height and width.现在,保存然后切换到其他设备,你应该让 UIImageview 填充设备的高度和宽度。

This will be very useful for important UI auto designs like splash screen.这对于重要的 UI 自动设计(如启动画面)非常有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 单个 Launchscreen.storyboard 启动画面未按比例显示在 Xamarin Z645024253191298AE688A3 中的各种 iOS 设备中 - Single Launchscreen.storyboard splash image not displaying proportionally in various iOS devices in Xamarin Forms LaunchScreen IOS Xamarin 表单未显示 - LaunchScreen IOS Xamarin Forms Not Showing 如果我使用 Xamarin.Essentials Preferences 存储数据,我可以检索该数据以修改 iOS LaunchScreen.Storyboard 上的文本颜色吗? - If I store data using Xamarin.Essentials Preferences, can I retrieve that data to modify text color on an iOS LaunchScreen.Storyboard? Xamarin.Forms中未显示iOS Launchscreen - iOS Launchscreen is not being displayed in Xamarin.Forms 如何在 xamarin iOS 中为 UIImageView 设置静态高度和宽度 - How to set a static height and width for a UIImageView in xamarin iOS Xamarin.Forms iOS storyboard文件未显示。 - Xamarin.Forms iOS storyboard not showing, even after being built and set in the Info.plist file 如何在 Xamarin.Forms xaml 中设置按钮内图像的宽度? - How to set width of image inside button in Xamarin.Forms xaml? 在Xamarin for iOS中为Imagebutton设置图像 - Set image for Imagebutton in Xamarin for iOS 如何将图像的相对布局x,y和高度约束设置为Xamarin形式中的平台依赖 - How to set relative layout x, y and height constraint for image as platform dependent in Xamarin forms 在Xamarin Form XAML页面中,如何设置图像的宽度等于屏幕宽度? - In Xamarin Form XAML page, how can I set the width of an Image equal to screen width?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM