2016-04-03 21 views
0
拉伸

我在导航栏中添加一个右栏按钮,然后分配图像到UIButton的,并设置大小为20px * 20px的图像中的iOS

的观点是在编辑好,但是当我在运行模拟器的应用程序,图像非常捉襟见肘,谁能帮助我,请

图像是这里

enter image description here

+0

你有没有在标签上自动布局约束? –

+0

正确的bar按钮不是UIButton(它是UIBarButtonItem)。也许你应该提供更多关于你在做什么的细节。 – matt

+0

@ATyshka否我没有使用自动布局 –

回答

0

在你UIButton,设置button.image.contentMode = UIViewContentModeScaleAspectFit

0

控制单击和按钮拖动到视图控制器作为IBOutlet中

override func viewDidLoad(){ 
yourButtonOutletName.image.contentMode = .ScaleAspectFit 

//   
}