Saturday, 15 March 2014

ios - objective-C/Swift: add child view/controller into superview, but with controller included -



ios - objective-C/Swift: add child view/controller into superview, but with controller included -

till have worked in different rad ide's such c# , delphi, , xcode/objectivec/swift concepts still new me (also mixed in head right :))

here application:

storyboard 2 view controllers, both having classes associated. views/controllers not connected in way via interface builder one view controller started @ app start. let starting view empty, , on sec there 1 uibutton i have made iboutlet , ibaction button in controller , change, e.g alter color or else.

i want place 1 view (child super view), want maintain controller of kid view still in command of own view.

so, when kid view added new view/controller - still can click on button kid controller , action written in controller code.

i know how add together bare view view (via addview method), losing controller.

i not sure if possible @ all, maybe missing whole concept of mvc coding, maybe trivial.

i hope have explained well.

edit:

this solution:

let ingredientscontroller = ingredientscontroller(nibname: "ingredientscontroller", bundle: nil) addchildviewcontroller(ingredientscontroller) ingredientscontroller.view.frame = cgrect(x: 100, y: 100, width: 300, height: 200) scrollview.addsubview(ingredientscontroller.view)

ios objective-c uiview swift

No comments:

Post a Comment