Search code examples
iphonexcodeuiscrollviewaddsubview

Scroll of previous view in iphone App doesnt get disabled in the next view


i have two views say A & B. Both are the subclass of UIViewController class..View A is not a Table View but it is a scroll enabled view as it is more than the iphone dimensions 320*460. View B is not a scroll View. I am calling view B while clicking some button in View A like,

-(IBAction)bt:id(Sender)
    {
        B *mB=[[B alloc]initWithNib:@"B" bundle:nil];
        [self.view addSubView:mB.view];
    }

the problem is, As View A is larger, therefore when B is loaded over View A, even View A is partially visible in View B.please help me in overcome this problem??


Solution

  • Thanks for the suggestions but I have founda different solution to my problem.

    When adding another view i.e. View B over Scroll View A, I reset the scroll view dimensions of A accordingly so that it is not visible. Also, when I press the Back button in View B, I again set the scroll View dimensions of View A to its previous value. Also, I made View A the delegate of View B since on pressing Back Button in B, I need to call a function which is defined in View A and is a part of View B protocol.