我想要一个图像和文本"查看详细信息"在我的按钮(红色按钮)编程...图像在按钮的左侧和右侧的文本..
UIImage *img = [UIImage imageNamed:@"image.png"];
[aButton setImage:img forState:UIControlStateNormal];
aButton.backgroundColor=[UIColor redColor];
//[img release]; i am not sure i release it or not
//[testBtn setTitleEdgeInsets:UIEdgeInsetsMake(70.0, -150.0, 5.0, 5.0)];
// what the above lines line work?
[aButton setTitle:@"View Details" forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)
我看到按钮但没有,红色按钮......只有红色的角落......
你制作了带有红色和文字的按钮图像......然后在上面设置图像......
这是在按钮上设置图像的代码.
[but1 setImage:[UIImage imageNamed:@"LeftBack.png"] forState:UIControlStateNormal]; //在按钮上设置图像.
| 归档时间: |
|
| 查看次数: |
10213 次 |
| 最近记录: |