This post deals with adding a button in UIView by coding…
Create a button
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button1.frame = CGRectMake(x, y, width, height);
where x and y are coordinates
width is width of the button,height is height of the button
[button1 setTitle:@"Hello" forState:UIControlStateNormal];
Add the button to parent view
[[self view] addSubview:button1];