设置uibutton 中文字大小和位置

来源:互联网 发布:mysql 连接指定数据库 编辑:程序博客网 时间:2024/05/20 03:42

 UIButton* button=[UIButtonbuttonWithType:UIButtonTypeCustom];

       button.frame=CGRectMake(5, 8, 50, 29);

        [buttonsetBackgroundColor:[UIColorclearColor]];

        [buttonsetBackgroundImage:[UIImageimageNamed:@"button_back.png"]forState:UIControlStateNormal];

        [buttonsetBackgroundImage:[UIImageimageNamed:@"button_back_2.png"]forState:UIControlStateHighlighted];

        [buttonsetTitle:@"返回"forState:UIControlStateNormal];

 

        button.titleEdgeInsets =UIEdgeInsetsMake(1,5, 0, 0);    // 4个参数分别是距离上,左,下,右的数据

        button.titleLabel.font=[UIFontfontWithName:@"Helvetica-Bold"size:14];

0 0
原创粉丝点击