=======
让iPhone屏幕常亮不变暗的方法
http://www.cocoachina.com/iphonedev/sdk/2010/0604/1624.html
===========
可以把一个view 多次 addsubview 到同一父view上,不过父上只存在一个这样的view;
UIView* v1 = [[UIView alloc] init]; UILabel* lb = [[UILabel alloc] init]; [v1 addSubview:lb]; NSLog(@"%@", [v1 subviews]); [v1 addSubview:lb]; TTDPRINT(@"%@", [v1 subviews]); [lb release]; [v1 release];
可以把一个view先后加到不同的 父view上,不过该view只存在后一父view上:
UIView* v1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 30)]; UIView* v2 = [[UIView alloc] initWithFrame:CGRectMake(50, 0, 100, 30)]; [self.view addSubview:v1]; [self.view addSubview:v2]; UILabel* lb = [[UILabel alloc] init]; lb.text = @"12"; [lb sizeToFit]; [v1 addSubview:lb]; TTDPRINT(@"%@", [v1 subviews]); [v2 addSubview:lb]; TTDPRINT(@"%@", [v1 subviews]); TTDPRINT(@"%@", [v2 subviews]); [v1 release]; [v2 release];