scrollView no funciona a pesar de que contentSize es más grande que el marco y se agrega una subvista antes de configurar el tamaño del contenido

    - (void)viewDidLoad
{

[super viewDidLoad];




self.navigationController.navigationBar.translucent = YES;
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"sprites_0001_Rectangle-1.png"]  forBarMetrics:UIBarMetricsDefault];



self.navigationController.navigationBar.translucent = YES;

UIImageView *imageView = [[UIImageView alloc]init];
UIImage *image = [UIImage imageNamed:@"sprites_0000s_0008_1st-Page.png"];
imageView.image = image;


//imageView.translatesAutoresizingMaskIntoConstraints = NO;
imageView.backgroundColor = [UIColor clearColor];
self.view = imageView;



if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {

     //Write the code to set up view for iPad

   }else{

    UIScrollView *scrollView = [[UIScrollView alloc] init];
    scrollView.backgroundColor = [UIColor clearColor];
    scrollView.translatesAutoresizingMaskIntoConstraints = NO;

    [self.view addSubview:scrollView];
    [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-40-[scrollView(==240)]"
                                                                      options:0
                                                                      metrics:nil
                                                                        views:NSDictionaryOfVariableBindings(scrollView)]];
    [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-50-[scrollView(==468)]"
                                                                      options:0
                                                                      metrics:nil
                                                                        views:NSDictionaryOfVariableBindings(scrollView)]];

    UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"ParentsMock.png"]];
    imageView.translatesAutoresizingMaskIntoConstraints = NO;
    [scrollView addSubview:imageView];



    [scrollView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|[imageView(==1000)]|"
                                                                       options:0
                                                                       metrics:0
                                                                         views:NSDictionaryOfVariableBindings(imageView)]];
    [scrollView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[imageView(==2000)]|"
                                                                       options:0
                                                                       metrics:0
                                                                         views:NSDictionaryOfVariableBindings(imageView)]];

    }

Este es mi intento de crearUIScrollView programáticamente sin embargo no pude hacer elscrollView trabajar a pesar de que configuro elcontentSize después de agregar la subvista en elscrollView.

Como puede ver en esta imagen, uso UINavigationController para envolver un UIViewControllar y establecer UIImageView como su vista. Creé un scrollView y lo agregué encima de la vista. luego creo otra imageView1 y la inserto en scrollView.

tenga en cuenta que la vista de todo el controlador de vista es una imageView que es diferente de la imageView que inserto en scrollView.

Respuestas a la pregunta(6)

Su respuesta a la pregunta