0
我想要的风格TTButton图像位于上面的文字中TTButton出现类似如下:Three20:使用TTStyles
http://tinypic.com/r/29c3oyh/6
你会发现,图像和文本都是中心对齐在TTButton中,图像位于文本上方。无论TTBoxStyle和订购的组合如何,我都无法同时获得图像和文本的正确对齐方式。
- (TTStyle*)happyfaceIcon:(UIControlState)state {
return [TTImageStyle styleWithImageURL:nil defaultImage:nil contentMode:UIViewContentModeCenter size:CGSizeMake(40, 40) next:
[TTBoxStyle styleWithMargin:UIEdgeInsetsMake(0, 20, 0, 0) next:nil]];
}
- (TTStyle*)happyfaceButton:(UIControlState)state {
return [TTShapeStyle styleWithShape:[TTRectangleShape shape] next:
[TTSolidBorderStyle styleWithColor:[UIColor blackColor] width:1 next:
[TTSolidFillStyle styleWithColor:[UIColor grayColor] next:
[TTBoxStyle styleWithMargin:UIEdgeInsetsMake(45, 2, 5, 2) next:
[TTTextStyle styleWithFont:[UIFont boldSystemFontOfSize:10]
color:[UIColor blackColor] textAlignment:UITextAlignmentCenter next:
[TTPartStyle styleWithName:@"image" style:TTSTYLESTATE(happyfaceIcon:, state) next: nil
]]]]]];
}