私は次のコードを持っています:
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:@"My Title" forState:UIControlStateNormal];
button.frame = myCustomRect;
UIColor *fontColor = [UIColor colorWithRed:0.43 green:0.84 blue:0.86 alpha:0.9];
[button setTitleColor:fontColor forState:UIControlStateNormal];
button.backgroundColor = [UIColor whiteColor];
button.titleLabel.textAlignment = NSTextAlignmentCenter;
button.titleLabel.font = [UIFont fontWithName:@"Cooperplate" size:9];
[button addTarget:self
action:@selector(moreDetails:)
forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
プログラムでビューにボタンを追加しようとしています。MyCustomRectのパラメーターは(0,0,75,50)です。
2つのこと:a)どのフォントを入力しても、常にシステムフォントが表示されます。b)サイズもまったく変わりません。フォントサイズを大きくしてみましたが、変化しません。フォントサイズを小さくしてみましたが、どちらも変化しません。
私は何が間違っているのですか?