在项目中有的图片需要拉伸处理,常用的有两种方式:
1. 代码:
2. 在xcode中设置图片的Slices
有两种方式:
方式一

点击Slices后可以看到:

在这里我选择垂直拉伸:

Top,Bottom,Height是Xcode默认设置的最优参数,可以根据需要实际调整。
Tiles:填充
Stretches:拉伸
方式二
选中图片后大家会看到右下角有个Show Slicing
按钮,直接点击该按钮可以很直观的设置具体拉伸的部位。

点击Show Slicing
后:

点击Start Slicing
即可直观设置图片的拉伸了:

主题的拉伸大家可以点击上图的按钮直观查看。
网友评论