简体   繁体   English

在iOS上扩展谷歌登录按钮w / constraints

[英]Scale google signin button on iOS w/ constraints

I am trying to add google login to my iOS application. 我正在尝试将谷歌登录添加到我的iOS应用程序。 The app will go to my nodejs server (using passport to hit google to login). 该应用程序将转到我的nodejs服务器(使用护照点击谷歌登录)。 Long story short I do not need to use the Google iOS sdk for login as I am not going from my to directly to google. 长话短说我不需要使用谷歌iOS sdk登录,因为我不是从我直接去谷歌。

But I do need a correctly styled google signin button. 但我确实需要一个风格正确的谷歌登录按钮。 I found the branding guidelines here: https://developers.google.com/+/branding-guidelines?hl=en 我在此处找到了品牌指南: https//developers.google.com/+/branding-guidelines?hl = en

And they have a download for the iOS icons and a sketch file. 他们可以下载iOS图标和草图文件。 The problem I am running into how do I use that button image and have it scale correctly based on constraints? 我遇到的问题是如何使用该按钮图像并根据约束正确缩放? IE if I set the image as the background and size the button to be whatever size I want in my view the G+ will also stretch. IE如果我将图像设置为背景并将按钮的大小设置为我想要的任何尺寸,G +也将拉伸。

在此输入图像描述

But if I don't set as a background I cannot make the button the correct width. 但如果我没有设置为背景,我就无法使按钮的宽度正确。

Is there a way to make the button whatever width I want without stretching the G+ logo? 有没有办法在没有拉伸G +标志的情况下制作我想要的任何宽度的按钮?

Next up would be how to get Roboto Text in there as well... 接下来将是如何在那里获得Roboto Text ...

在此输入图像描述

Try Image Slicing . 尝试图像切片 Below is the steps: 以下是步骤:

  1. Select the image you add in the asset catalog. 选择您在资产目录中添加的图像。
  2. Choose Horizontel in Slicing section of the Attributes Inspecter. 在Attributes Inspecter的Slicing部分中选择Horizontel
  3. Input 35 for Left field, input 5 for Right field. 输入35表示左侧字段,输入5表示右侧字段。 Below is what the slicing looks like: 以下是切片的样子:

切片

  1. Set the image as a button background in Storyboard or nib. 将图像设置为Storyboard或nib中的按钮背景。

Now resize the button, the logo will not be streched. 现在调整按钮的大小,徽标将不会拉伸。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM