标签:居中 btn imageview uikit sharp center har pre highlight
1、应用场景,文字居左,图片居中
//设置图片间距,使其居右对齐 btn.imageEdgeInsets = UIEdgeInsetsMake(0,btn.size.width - 12 - btn.imageView.image.size.width, 0, 0); //文字居左对齐 btn.titleEdgeInsets = UIEdgeInsetsMake(0, -(btn.imageView.image.size.width), 0, 0); //设置文字居左且中心对齐 [btn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; [btn setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
标签:居中 btn imageview uikit sharp center har pre highlight
原文地址:http://www.cnblogs.com/TheYouth/p/6959238.html