ios UIButton内边距理解

button设置内边距:
UIButton结构,  ImageView+ Lable   设置内边距EdgeInsets 以后会 压缩 在宽高,和前端中设置 div内边距一样

 backButton.imageEdgeInsets=UIEdgeInsetsMake(10, 0, 0, 0)   // 上边内边距10 ,设置ImageView内边距

backButton.titleEdgeInsets=UIEdgeInsetsMake(0, 0, 10, 0);   // 设置label内边距

backButton.contentEdgeInsets = UIEdgeInsetsMake(10,0, 0, 0);  // 设置button内边距

backButton.contentEdgeInsets = UIEdgeInsetsMake(-10,0, 0, 0);   如果设置负数效果,设置button内边距

xib  中设置内边距:

设置label 自动换行: 

 

猜你喜欢

转载自blog.csdn.net/dreams_deng/article/details/106877116