UIButton * cityBtn=[UIButtonbuttonWithType:UIButtonTypeCustom];
[cityBtn setTitle:@"上海"forState:UIControlStateNormal];
[cityBtn setImage:[UIImageimageNamed:@"icon"]forState:UIControlStateNormal];
//最重要是下面两行设置图片与文字的间距
cityBtn.titleEdgeInsets=UIEdgeInsetsMake(0, -70,0, 0);//上左下右
cityBtn.imageEdgeInsets=UIEdgeInsetsMake(13,30, 13, 30);
cityBtn.frame=CGRectMake(60,0, 80, 40);
[self.view addSubview:cityBtn];