發現我的UIButton的字不在正中間
上網查到許多方法
參考link
參考link
參考link
最後我使用了最簡單的方法
yourButton.contentEdgeInsets = UIEdgeInsetsMake(5, 0, 0, 0);





NSLog(@"tt0001m_: %@",
[UIFont fontNamesForFamilyName:@"Swis721 Lt BT"]
);
Which gives the output:
2012-08-24 11:25:10.968 GenericKeychain[7260:c07] tt0001m_: (
"Swiss721BT-Light"
)
UIFont *swissLight = [UIFont
fontWithName:@"Swiss721BT-Light"
size:myLabel.font.pointSize];
[myLabel setFont:swissLight];






NSLog(@"vagrounded-bold.ttf is %@",
[UIFont fontNamesForFamilyName:@"VAGRounded-Bold"]
);
NSLog(@"vagrounded-thin.ttf is %@",
[UIFont fontNamesForFamilyName:@"VAGROUNDED-Thin"]
);
UILabel *lab = [UILabel new];
[lab setFrame:CGRectMake(50, 50, 100, 30)];
UIFont *swissLight = [UIFont
fontWithName:@"VAGRounded-Bold"
size:20.0f];
[lab setFont:swissLight];
[lab setText:@"GodCam"];
[self.view addSubview:lab];
UILabel *lab2 = [UILabel new];
[lab2 setFrame:CGRectMake(50, 100, 100, 30)];
UIFont *swissLight2 = [UIFont
fontWithName:@"VAGROUNDED-Thin"
size:20.0f];
[lab2 setFont:swissLight2];
[lab2 setText:@"GodCam"];
[self.view addSubview:lab2];
2013-04-17 13:48:20.635 UseTTF[787:c07] vagrounded-bold.ttf is (
"VAGRounded-Bold"
)
2013-04-17 13:48:20.636 UseTTF[787:c07] vagrounded-thin.ttf is (
"VAGROUNDED-Thin"
)
UIView *bgColorView = [[UIView alloc] init];
[bgColorView setBackgroundColor:[UIColor redColor]];
[cell setSelectedBackgroundView:bgColorView];
UIView *bgColorView = [[UIView alloc] init];
[bgColorView setBackgroundColor:[UIColor redColor]];
bgColorView.layer.cornerRadius = 10;
[cell setSelectedBackgroundView:bgColorView];
[bgColorView release];
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
UIImage *selectionBackground = [UIImage imageNamed:@"yellow_bar.png"];
UIImageView *iview=[[UIImageView alloc] initWithImage:selectionBackground];
self.selectedBackgroundView=iview;
}