草庐IT

ios - 在代码中为 UIButton 设置图像

如何在代码中为UIButton设置图像?我有这个:UIButton*btnTwo=[UIButtonbuttonWithType:UIButtonTypeRoundedRect];btnTwo.frame=CGRectMake(40,140,240,30);[btnTwosetTitle:@"vc2:v1"forState:UIControlStateNormal];[btnTwoaddTarget:selfaction:@selector(goToOne)forControlEvents:UIControlEventTouchUpInside];[self.viewaddSubvie

ios - 在代码中为 UIButton 设置图像

如何在代码中为UIButton设置图像?我有这个:UIButton*btnTwo=[UIButtonbuttonWithType:UIButtonTypeRoundedRect];btnTwo.frame=CGRectMake(40,140,240,30);[btnTwosetTitle:@"vc2:v1"forState:UIControlStateNormal];[btnTwoaddTarget:selfaction:@selector(goToOne)forControlEvents:UIControlEventTouchUpInside];[self.viewaddSubvie