Your comment to Art's answer pretty much explains the problem. You have a button which is outside the visible area of its parent; it's irrelevant if the parent is positioned such that the button would be visible higher up on the stack. The button is getting clipped and not painted.
You have two choices.
1) Make myView's frame bigger and adjust all your coordinates appropriately. myView will always have some of its content offscreen and some onscreen and you can simply position it where you want. When the button is onscreen it will be visible. (E.g., in your code above the initial frame for myView would start at some negative value for x and extend to much wider than the iPhone screen, whereas your btn would be positioned at some positive x,y position relative to the top left of myView. Then you move myView so that, for example, it moves to 0,0, pushing some of its content offscreen while moving btn onscreen.)
2) Don't put button on myView; put it on a new view that you animate in while you are animating myView out.
Simple code for #1:
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(-100, 0, 420, 480)]; // start 100 pixels to the left
UIButton *btn = [UIButton buttonWithType:UIButtonTypeContactAdd];
btn.frame = CGRectMake(0, 10, btn.bounds.size.width, btn.bounds.size.height);
[myView addSubview:btn];
UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[btn1 setTitle:@"DoIt" forState:UIControlStateNormal];
btn1.frame = CGRectMake(100, 100, 50, 50);
[btn1 addTarget:self action:@selector(doit:) forControlEvents:UIControlEventTouchUpInside];
[myView addSubview:btn1];
self.view = myView;
}
- (void) doit: (id) bt {
[UIView beginAnimations:nil context:NULL];
self.view.frame = CGRectMake(100, 0, 420, 480);
[UIView commitAnimations];
}