IBでボタンを作成し、タイプのみをカスタム、タイトル、フォントサイズに設定すると、見栄えがよくなります。プログラムで作成すると、フォントがぼやけてしまいます。ボタンを作成するコードは次のとおりです。
CGRectフレーム=self.sendButton.frame;
NSString *title = @"Read Disclosure";
UIFont *font = [UIFont boldSystemFontOfSize:17.0];
CGSize titleSize = [title sizeWithFont:font constrainedToSize:frame.size];
CGFloat xValue = (self.view.frame.size.width - titleSize.width) / 2;
CGFloat yValue = frame.origin.y - (titleSize.height / 2);
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setFrame:CGRectMake(xValue, yValue, titleSize.width, titleSize.height * 2)];
[button setTitle:@"Read Disclosure" forState:UIControlStateNormal];
[button.titleLabel setFont:font];
[button setTitleColor:[UIColor colorWithRed:50.0/255.0 green:79.0/255.0 blue:133.0/255.0 alpha:1.0] forState:UIControlStateNormal];
[button setTitleShadowColor:nil forState:UIControlStateNormal];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
[button addTarget:self action:@selector(disclosureButtonAction) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
私は考えられるすべての設定を試しましたが、何も違いはないようです。私がここで欠けているものについて何か考えはありますか?
ありがとう。