ios - Setting outlet/action for view controller -


i have uibutton in view controller not root view controller in app. cannot drag , create outlet or action in header file. can root view controller.

is there simple reason this?

when using storyboard, xcode creates .h , .m file first view controller (named viewcontroller.h , viewcontroller.m).

for each additional view controller add via interface builder, should manually add additional custom class files in order customize view controller.

once add view controller story board via interface builder, follow these instructions:

  1. from main xcode menu, select file, new, file, pick objective-c class , click next. name custom class, , pick proper type view controller you've added (i.e. select uitableviewcontroller table view controller).
  2. from within xcode's interface builder, select new view controller , identity inspector tab, set class new class created.

you should able ctrl-click drag uibuttons or other ui elements onto new .h or .m file , implement custom behavior view there.

if don't create files implement custom classes, stuck default ui classes uiviewcontroller, have default behaviors unless extend them custom classes.

you want 1 .m , .h file per view controller.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -