我正在尝试将 TTButton 设置为如下所示:
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
]]]]]];
}