//创建UIButton
let btn = UIButton()
btn.frame = CGRectMake(10, 5,90, 90
btn.setImage(UIImage (named:"icon1"), forState:.Normal)
btn.imageEdgeInsets = UIEdgeInsetsMake(0, (btn.bounds.size.width-btn.imageView!.bounds.size.width), 30, 30)
btn.setTitle("看日记",forState:.Normal)
btn.setTitleColor(UIColor.grayColor(), forState:.Normal)
btn.titleEdgeInsets = UIEdgeInsetsMake(btn.imageView!.bounds.size.height-5, (btn.bounds.size.width-btn.titleLabel!.bounds.size.width)*0.5-btn.imageView!.bounds.size.width-132, 0, 0)
你可以把这段代码拷到项目中去试试,根据需要自己调整 尺寸位置