Three20,320库真是好的不得了,都不知道该怎么夸它了,我在自己的佛历View中就使用了其中一个TTView,非常漂亮简单的风格。再也不用考虑是不是在UILabel下面放一个UIImageView等等… 而且还要自己弄图片的大小
在TTCatalog中展示了14种TTView的style,不知道你喜欢哪一个呢?
**我想我用的是第二个吧~
/*******************************************************************/
看看我的代码吧~
UIColor* blue = RGBCOLOR(191, 197, 208);
TTStyle *myStyle = [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:10]
next:[TTShadowStyle styleWithColor:RGBACOLOR(255,255,255,0.9) blur:1 offset:CGSizeMake(0, 1)
next:[TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(255, 255, 255)
color2:RGBCOLOR(216, 221, 231)
next:[TTSolidBorderStyle styleWithColor:blue width:1 next:nil]]]];
viewA = [[[TTView alloc] initWithFrame:CGRectMake(10, 220, 300, 40)] autorelease];
viewB = [[[TTView alloc] initWithFrame:CGRectMake(10, 263, 300, 40)] autorelease];
viewC = [[[TTView alloc] initWithFrame:CGRectMake(10, 306, 300, 100)] autorelease];
viewA.backgroundColor = self.view.backgroundColor;
viewB.backgroundColor = self.view.backgroundColor;
viewC.backgroundColor = self.view.backgroundColor;
viewA.style = myStyle;
viewB.style = myStyle;
viewC.style = myStyle;
[self.view addSubview:viewA];
[self.view addSubview:viewB];
[self.view addSubview:viewC];
我一共需要三个框子,而style那个部分其实是完全照抄TTCatalog的(人懒也不是罪过)
但是需要注意一下事项:
1,必须要设置self的backgroundColor, 然后再赋值给TTView, 否则缺省值会变成黑色…
2, 记得release掉那些TTView,我使用的autorelease,因为superView会retain那些对象的~
3,在使用UILabel的时候,如果想设置UILabel为透明,只需要设置UILabel.backgroundColor为[UIColor clearColor]就可以拉,这样就不会让UILabel弄出一个窟窿来咯~
快去下载320库来试试阿!