views:

193

answers:

0

I have a UITableViewController subclass that has a container UIView which has 1 of 2 subviews: the tableview, or a UIScroll depending on whether or not the view is "flipped".

my viewDidLoad() method adds the tableview to the container:

[kContainerView addSubview: self.tableView];
self.view = kContainerView;

and initializes the UIScrollview with an 900x600 image and sets itself as the delegate:

kSBCanvasScrollView = [[UIScrollView alloc] initWithFrame:bounds];  
[kSBCanvasScrollView setDelegate: self];
kSBImage = [[UIImageView alloc] initWithImage:img];
[kSBCanvasScrollView addSubview:kSBImage];
[kSBCanvasScrollView setContentSize:[img size]];    
[kSBCanvasScrollView setMinimumZoomScale:0.5];

The the front "Table side" of the view works fine. I then flip the view when the user selects a button on the toolbar by doing the following:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0f];
[UIView setAnimationDelegate:self];

if (kSBCanvasIsVisible==NO) {
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:kContainerView cache:YES];
    [self.tableView removeFromSuperview];
    [kContainerView addSubview:kSBCanvasScrollView];
    kSBCanvasIsVisible = YES;
} else {
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:kContainerView cache:YES];
    [kSBCanvasScrollView removeFromSuperview];
    [kContainerView addSubview:self.tableView];
    kSBCanvasIsVisible = NO;
}
[UIView commitAnimations];

It flips just like I want, but the kSBCanvasScrollView does not scroll. The pinch gesture works. Why won't the view scroll? Perhaps it relates to the fact this is a TableViewController?