I have a UIButton which i add programmatically. No problems here, it stetches as it should and looks good. However, when I tilt the phone to landscape the button gets out of
One thing before I answer your question:
[_notMeButton setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
[_notMeButton setAutoresizingMask:UIViewAutoresizingFlexibleRightMargin];
The second sentence overwrites the first one, you should use the | operator so both resizing mask are applied:
[_notMeButton setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin];
To keep the element where it is when the view changes its size, you need to tell it not to use any resizing mask:
[_notMeButton setAutoresizingMask:UIViewAutoresizingNone];
And the equivalent in Interface Builder is this:

I hope it helps