用iOS的UI知識編出霓虹燈效果(經典小題) – iPhone手機開發技術文章 iPhone軟體開發教學課程

for (int i =0 ; i <
7; i++) {

UIView *view = [[UIViewalloc]
initWithFrame:CGRectMake(0 + i *20,
0 + i *20,320 –
40 * i ,568 – i *
40)];

CGFloat color = (arc4random() %256 /255.0 );

CGFloat saturation = (
arc4random() % 128 /
256.0 ) + 0.5;

CGFloat brightness = (
arc4random() % 128 /
256.0 ) + 0.5;

view.backgroundColor = [UIColorcolorWithHue:color
saturation:saturation
brightness:brightnessalpha:1];

[self.windowaddSubview:view];

[view release];

}

發佈留言