XBbtn *btn = [[XBbtn alloc] init];
btn.frame = CGRectMake(100 , 100, 60, 60);
[btn setTitle:@"btn1" forState:UIControlStateNormal];
btn.backgroundColor = [UIColor redColor];
[self.view addSubview:btn];
/*
1. 从storyboard与xib中加载uiview控件调用方法顺序:
2015-08-19 09:32:33.494 NSOperation和queue的基本使用[2495:82481] +[XBbtn allocWithZone:] --1
2015-08-19 09:32:33.495 NSOperation和queue的基本使用[2495:82481] -[XBbtn initWithCoder:] --2
2015-08-19 09:32:33.500 NSOperation和queue的基本使用[2495:82481] -[XBbtn awakeFromNib] --3
2015-08-19 09:32:33.520 NSOperation和queue的基本使用[2495:82481] -[XBbtn layoutSubviews] --4
2015-08-19 09:32:33.520 NSOperation和queue的基本使用[2495:82481] -[XBbtn layoutSubviews] --5
*/
/*
2. 通过代码创建调用方法顺序:
2015-08-19 09:35:10.735 NSOperation和queue的基本使用[2533:83738] +[XBbtn allocWithZone:]--1
2015-08-19 09:35:13.734 NSOperation和queue的基本使用[2533:83738] -[XBbtn init] --2
// 注意:init 方法内部会调用 initWithFrame方法
2015-08-19 09:35:14.503 NSOperation和queue的基本使用[2533:83738] -[XBbtn initWithFrame:]--3
// [self.view addSubview:btn]添加到父view中的时候这个方法才会被调用
2015-08-19 09:42:31.768 NSOperation和queue的基本使用[2827:89698] -[XBbtn layoutSubviews]--4
2015-08-19 09:42:31.774 NSOperation和queue的基本使用[2827:89698] -[XBbtn layoutSubviews]--5
*/