0

I have created a multi-tab page which on click changes view.

One tab includes an order form but I already have a separate order form in my storyboard so I tried to load that form inside the order tab view which I did by coding.

OrderViewController *we = [self.storyboard instantiateViewControllerWithIdentifier:@"OrderViewController"];


we.view.frame = CGRectMake(-8,10, 320, 500);
we.calc.frame = CGRectMake(0,1, 320, 45);

[order addSubview:we.view];
[self.view addSubview:order];

But when I click any button or item on the order form it goes to warning ... dont get it why any help.

Gabriel.Massana
  • 8,165
  • 6
  • 62
  • 81
Ramiz Girach
  • 169
  • 2
  • 10
  • goes to warning? what warning? – Lithu T.V Apr 18 '13 at 08:18
  • obj_msgsend and many other .. i dont think its possible to load another viewcontroller into a view and then access its all method and objects – Ramiz Girach Apr 18 '13 at 08:24
  • http://stackoverflow.com/questions/6797517/load-xib-into-a-uiview?rq=1 – Lithu T.V Apr 18 '13 at 08:29
  • @user1440164 As Lithu T.V pointed out, a viewcontroller can be loaded into a view. http://stackoverflow.com/a/12686417/352891; in particular, the post refers to the [Apple Docs](http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/AboutViewControllers/AboutViewControllers.html); which explains about container viewcontrollers. – user352891 Apr 18 '13 at 08:48

1 Answers1

0
[we retain];

Because, (correct me if i'm wrong) that VC will be freed (autoreleased) after a while.

khose
  • 743
  • 1
  • 6
  • 19
  • The UIView addSubview retains the view [Apple Docs](http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIView_Class/UIView/UIView.html) – user352891 Apr 18 '13 at 08:42