UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"Button" forState:UIControlStateNormal];
That's it. Two lines for a basic button.Of course, if you want to display the button:
button.frame = CGRectMake(10, 10, 80, 20);
[view addSubview:button];
...which is a big part of why Interface Builder is handy, because it saves you from trying to figure out exactly how large you want the button to be and where to put it.Now, when you put together all the objects in a moderately complicated UI, you will end up with hundreds of lines of code. Some people find it easier to work with this visually in Interface Builder. Others find it easier to manually construct the UI in code. Either method works perfectly well. I generally use a mix of both, depending on the nature of the UI element I'm working with.