Skip to content

July 10, 2009

UIButton setTitle issue in iPhone OS 3.0

I was working on a client project and come across a bizarre issue. I eventually solved it. Here is the issue, see if you can spot where the problem is.

The following few lines of code generates a button with label “Next” in SDK 2.2.1 but under 3.0, the label is gone.

UIButton *nextButton = [[UIButton buttonWithType: UIButtonTypeRoundedRect] initWithFrame:CGRectMake(183, 30, 65, 25)];
[nextButton addTarget:self action: @selector(nextSettings) forControlEvents: UIControlEventTouchUpInside];
[nextButton setTitle:@"Next" forState:UIControlStateNormal];
[nextButton setTitleColor:[UIColor blackColor] forState: UIControlStateNormal];
[self.view addSubview:nextButton];

Read more from Software Development

Share your thoughts, post a comment.

(required)
(required)

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments