简体   繁体   English

如何在Xamarin iOS中将所有屏幕尺寸的元素居中对齐?

[英]How to align an element in the center in Xamarin iOS for all screen sizes?

I have been trying to keep a logo in the center on the screen for all apple screen sizes but it just doesn't seem to work when the logo is small. 我一直在尝试将徽标放置在所有苹果屏幕尺寸的屏幕中央,但是当徽标较小时,它似乎不起作用。 As I understand , its probably because the left, right, top, bottom margin constrains are absolute and not relative. 据我了解,这可能是因为左,右,上,下边距限制是绝对的而不是相对的。

在此处输入图片说明

在此处输入图片说明

UPDATE: 更新:

在此处输入图片说明 在此处输入图片说明

When I change Generic to iPhone 5s in simulator : 当我在模拟器中将通用更改为iPhone 5s时: 在此处输入图片说明 ] 5 ] 5

As @ Sami Kuhmonen mentioned, Add a constraint for center instead. 正如@ Sami Kuhmonen所述,请为center添加一个约束。

在此处输入图片说明

How to add? 如何添加?

Drag the pin(locate in the center) to the vertical and horizontal line. 将图钉(位于中心)拖到垂直线和水平线。 在此处输入图片说明

Click this button to update the frame: 单击此按钮以更新框架:

在此处输入图片说明

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

相关问题 如何在Xamarin iOS Native中将所有屏幕尺寸的图像水平居中 - How to center image horizontal for all screen size in xamarin ios native 如何创建适用于所有 iOS 屏幕尺寸的自适应框架? - How to create adaptive frames that work with all iOS screen sizes? 如何安排UI元素,使其适合iOS中的所有屏幕尺寸 - How to arrange UI elements so they fit in all screen sizes in iOS iOS可以拉伸以适合所有屏幕尺寸吗? - iOS stretching to fit all screen sizes? 在所有屏幕尺寸上设置iOS bg图像 - set iOS bg images all screen sizes Swift:以编程方式对齐不同IOS屏幕尺寸的标签 - Swift: programmatically align labels for different IOS screen sizes 如何将自定义Popover视图控制器与Xamarin.iOS中的ParentViewController中心对齐? - How can I align my custom Popover view controller to center of ParentViewController in Xamarin.iOS? 在 iOS Storyboard 水平 StackView 中心对齐元素并在所有元素上强加第一个元素的高度 - in iOS Storyboard horizontal StackView center align elements and impose height of first element on all elements CGAffineTransform - 如何在屏幕中心对齐视频 - CGAffineTransform -How to Align Video in Screen Center 如何使用 SwiftUI 将图像与屏幕中心对齐? - How to Align an image to the center of a screen using SwiftUI?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM