I have a method which loads the view of a view controller as a subview to scrollview.The view of view controller which i tried to add as a subview contained a tableview in it.

```
    -(void)addSubViewToScrollView{

        CGFloat x = 0;
        UIScrollView *scrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0,
        self.view.frame.size.width, self.view.frame.size.height)];
        NSInteger viewcount= 8;

            for(int i = 0; i< viewcount; i++) {
               self.opt = [[EliteQuestionScreen alloc]  
                initWithNibName:@"EliteQuestionScreen"
                bundle:[NSBundle mainBundle]];
                if (i == 0) {
                x = self.opt.view.frame.origin.x;
            } else {
                x = self.opt.view..frame.size.width + x;
            }

            UIView *viewMine = self.opt.view;
            viewMine.frame = CGRectMake(x, 0, self.opt.view.frame.size.width,
            self.opt.view.frame.size.height);
            [scrollview setPagingEnabled:YES];
            [scrollview addSubview:viewMine];

        }
        scrollview.contentSize = CGSizeMake(self.view.frame.size.width *viewcount, 
        self.view.frame.size.height);
        [self.view addSubview:scrollview];
    }

```

I have already reatined the object refrences of `EliteQuestionScreen` like this 

```
@property(strong,nonatomic)EliteQuestionScreen *opt;

```

but when this code exucute my app crashes and it is giving error

```
[EliteQuestionScreen tableView:numberOfRowsInSection:]: message sent to deallocated instance 0x716d6a0;

```

i don't able to undersatnd the behaviour?

But When i just closed the loop and add the view of a viewcontroller as a subview to scrollview it run well

```
-(void)addSubViewToScrollView{

        CGFloat x = 0;
        UIScrollView *scrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0,
        self.view.frame.size.width, self.view.frame.size.height)];
        NSInteger viewcount= 8;

               self.opt = [[EliteQuestionScreen alloc]  
                initWithNibName:@"EliteQuestionScreen"
                bundle:[NSBundle mainBundle]];

                x = self.opt.view.frame.origin.x;

               UIView *viewMine = self.opt.view;
               viewMine.frame = CGRectMake(x, 0, self.opt.view.frame.size.width,
               self.opt.view.frame.size.height);
               [scrollview setPagingEnabled:YES];
               [scrollview addSubview:viewMine];

        scrollview.contentSize = CGSizeMake(self.view.frame.size.width *viewcount, 
        self.view.frame.size.height);
        [self.view addSubview:scrollview];
       }

```

Why this is happening i am not able to figure out?