Few points here.
You are creating a new view controller passing nil
as a parameter of initWithNibName:bundle
method. If you pass nil
, as per the doc, the nibName
property is set to nil
. Is this that you want? Where the code is running into? Into another view controller? Into the app delegate?
Classes should start with a capital letter. e.g View2
, ViewController2
. Variable or properties with camel case notation. e.g. myProperty
, myView
.
view2
should renamed as ViewController2
(or whatever you want) since it's a controller and not a view.
Finally, what's your goal? When you ask a problem you should describe the context you are running in. On the contrary you should receive downvotes.