TTView的简单使用

转自:http://c.gzl.name/archives/305

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库来试试阿!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值