带有按钮图像的 Xcode 6 约束

Xcode 6 Constraints with button images(带有按钮图像的 Xcode 6 约束)

本文介绍了带有按钮图像的 Xcode 6 约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个应用程序,它有一个包含 11 个图像的仪表板..

I am creating an app that have a dashboard with 11 images..

1 是背景,1 是分隔按钮的线条,9 是带有图像的按钮.

1 is the background, 1 are the lines that divide the button and 9 are the button with images.

我尝试了几次自动约束分配,但我也手动尝试过,但我无法弄清楚如何正确设置约束.我也跟着很多教程.如果你看下面的图片,你会发现特别是 iPhone 4 中的按钮/图片很奇怪!

I tried several times with the automatic constraints assignment but I also tried manually and I can't figure it out how to setup the constraints correctly. I followed also a lot of tutorial. If you watch the image below, you can see that the button/images especially in the iPhone 4 are weird!

推荐答案

你必须采取一个包含按钮的视图....之后只需按照下图设置视图约束...您有 9 个图像...我刚刚给你演示了 7 个按钮

you have to take a view which contains a button....after that just follow the below image for set up view constraints...You have 9 images ...I just gave you demo with 7 buttons

对于按钮,只有 4 个约束...我设置了一个...您只需要遵循所有按钮...

and for button there is just 4 constraints...I setup for one...you just need to follow for all buttons...

这是结果图像...

这篇关于带有按钮图像的 Xcode 6 约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:带有按钮图像的 Xcode 6 约束

基础教程推荐