How to addsubview without storyboard and make it key and visible

I found a direction from another post below: