自定义 UIButotn
来源:互联网 发布:淘宝网手风琴 编辑:程序博客网 时间:2024/04/29 19:31
@interface myButton : UIButton
{
}
//+(id)myButton;
@end
@implementation myButton
-(void)awakeFromNib
{
UIImage* image = [UIImageimageNamed:@"按钮-点击前.png"];
image = [image stretchableImageWithLeftCapWidth:image.size.width/2.0ftopCapHeight:image.size.height/2.0f];
[selfsetBackgroundImage:imageforState:UIControlStateNormal];
image = [UIImage imageNamed:@"按钮-点击后.png"];
image = [image stretchableImageWithLeftCapWidth:image.size.width/2.0ftopCapHeight:image.size.height/2.0f];
[selfsetBackgroundImage:imageforState:UIControlStateHighlighted];
[self.titleLabelsetFont:[UIFontsystemFontOfSize:12]];
[selfsetTitleShadowColor:[UIColorwhiteColor]forState:UIControlStateNormal];
[selfsetTitleShadowColor:[UIColorblackColor]forState:UIControlStateHighlighted];
[selfsetTitleColor:c_btn_grayforState:UIControlStateNormal];
[selfsetTitleColor:c_whiteforState:UIControlStateHighlighted];
}
- (id)initWithFrame:(CGRect)frame
{
self = [superinitWithFrame:frame];
if (self) {
UIImage* image = [UIImageimageNamed:@"按钮-点击前.png"];
image = [image stretchableImageWithLeftCapWidth:image.size.width/2.0ftopCapHeight:image.size.height/2.0f];
[selfsetBackgroundImage:imageforState:UIControlStateNormal];
image = [UIImage imageNamed:@"按钮-点击后.png"];
image = [image stretchableImageWithLeftCapWidth:image.size.width/2.0ftopCapHeight:image.size.height/2.0f];
[selfsetBackgroundImage:imageforState:UIControlStateHighlighted];
[self.titleLabelsetFont:[UIFontsystemFontOfSize:12]];
[self.titleLabelsetShadowColor:[UIColor whiteColor]];
[selfsetTitleColor:c_btn_grayforState:UIControlStateNormal];
[selfsetTitleColor:c_whiteforState:UIControlStateHighlighted];
[selfsetTitleShadowColor:[UIColorwhiteColor]forState:UIControlStateNormal];
[selfsetTitleShadowColor:[UIColorblackColor]forState:UIControlStateHighlighted];
}
returnself;
}
@end
- 自定义 UIButotn
- 自定义
- 自定义
- 自定义
- 自定义
- 自定义
- 自定义TexBox,自定义ComboBox
- 自定义View自定义属性
- 自定义View自定义属性
- 自定义View自定义属性
- 自定义View自定义属性
- 自定义一个自定义对话框
- 自定义控件-自定义吐司
- 自定义checkbox,自定义button
- 自定义控件--自定义对话框
- 自定义控件----自定义属性
- 自定义控件:自定义Toast
- 自定义View自定义属性
- Codeforces 461 B. Appleman and Tree
- Hibernate_@注解
- 帧间差
- 1065. A+B and C (64bit) (20)
- [微信公众平台开发]php开发环境搭建设置(一)
- 自定义 UIButotn
- cat access.2012010.log | awk '{a[$1]++} END {for(b in a) print b"\t"a[b]}' | sort -k2 -r | head -n 5
- ubuntu14.04创建超级用户root注意事项
- Codeforces 461C. Appleman and a Sheet of Paper
- POJ-3617
- 自动打包各种渠道的shell
- 解析code4app上自定义AlerView(开源学习)
- Oracle常用SQL
- 【MFC】第3课 MFC程序框架学习笔记