标签:
--------------- ViewController.m ---------------
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
UIButton *headBtn = [[UIButton alloc] init];
headBtn.frame = CGRectMake(85, 90, 100, 100); // 当一个控件的frame都是(0,0,0,0)它是不会显示的
UIImage *image = [UIImage imageNamed:@"btn_01"];
[headBtn setBackgroundImage:image forState:UIControlStateNormal];
[self.view addSubview:headBtn];
}
@end
标签:
原文地址:http://www.cnblogs.com/lixiang2015/p/4694082.html