如果是在self.view上添加子视图的话,下面两种写法会不一样
self.view.backgroundColor = [UIColor whiteColor];
self.view.alpha = 0.5;
这种写法,父视图的透明度会影响到它上面的子视图。跟着一起变得半透明
self.view.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.5];
这种写法,父视图的透明度不会影响到它上面的子视图。子视图的透明度是独立的,默认alpha为1