ボタンの横幅を大きくしたいのですが、指定したサイズより小さくなってしまいます。
セットした文字の大きさに合わせているようですが、固定で大きさを指定したい場合はどのようにすればいいのでしょうか。
初歩的な質問で申し訳有りません。
UIButton *nextViewButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; nextViewButton.frame = CGRectMake(0, 100, 250, 30.0f);
// [nextViewButton setBounds:rect];
// [nextViewButton setFrame:CGRectMake(0, 100, 500, 30.0f)];
// nextViewButton.frame = CGPointMake(self.view.bounds.size.width / 2, self.view.bounds.size.height / 2);
nextViewButton.backgroundColor = [UIColor blackColor];
[nextViewButton setTitle:@"次へ"
forState:UIControlStateNormal];
[nextViewButton sizeToFit];
[nextViewButton addTarget:self
action:@selector(button_Tapped:)
forControlEvents:UIControlEventTouchUpInside];
[scrollView addSubview:nextViewButton];
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/06/05 23:32