Note that there are some explanatory texts on larger screens.

plurals
  1. POUIButton hide when change position in scrollview
    primarykey
    data
    text
    <p>I've a scrollView with imageview and semi-transparent button over this image. The button and the imageview are added to scrollview with [addsubview]. Now I need to change the imageview and button position (changing the frame property)</p> <p>es:</p> <pre><code>button.frame = CGRectMake( x, y, w, h ); </code></pre> <p>after I do this the button hides. If I change only the button position it work perfectly.</p> <p>PS: I've just tried to use bringtofront.</p> <p>the scrollview content creation:</p> <pre><code> int index = 0; int x = OFFSETXCOPERTINA; int y = 0; int w = LARGHEZZACOPERTINA; int h = ALTEZZACOPERTINA; int riga = 0; int indexriga = 0; int testindex = 0; if (self.interfaceOrientation == UIInterfaceOrientationPortrait || self.interfaceOrientation ==UIInterfaceOrientationPortraitUpsideDown) { testindex = NRCopertineVerticale; } else { testindex = NRCopertineOrizzontale; } for (NSDictionary *rigaordine in ElencoOrdini) { if (indexriga &gt; 0) x = x + OFFSETXCOPERTINA + w; y = OFFSETYCOPERTINA + (riga * (h + OFFSETYCOPERTINA)); UIButton *buttonCopertina = [UIButton buttonWithType:UIButtonTypeCustom]; buttonCopertina.frame = CGRectMake(x, y, w, h); [buttonCopertina setBackgroundColor:[UIColor colorWithRed:(255/255.0) green:(255/255.0) blue:(0/255.0) alpha:0.3]]; UIImage *image = [[UIImage alloc] initWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: [NSString stringWithFormat: @"%@image.php?CODe=%@", URLXXX, [rigaordine objectForKey:@"cod_isb"]]]]]; UIImageView *copertina = [[UIImageView alloc] initWithImage: image]; [copertina setTag:TAGCopertine + index]; [copertina setFrame:CGRectMake(x, y, w, h)]; [buttonCopertina setTag:TAGButtonCopertine + index]; [buttonCopertina addTarget:self action:@selector(buttonCopertinaClicked:) forControlEvents:UIControlEventTouchUpInside]; [scrollView addSubview:copertina]; [scrollView addSubview:buttonCopertina]; index++; indexriga++; if (indexriga &gt;= testindex) { indexriga = 0; riga++; x = 10; } } </code></pre> <p>when I rotate the iPad:</p> <pre><code>- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { int index = 0; int x = OFFSETXCOPERTINA; int y = 0; int w = LARGHEZZACOPERTINA; int h = ALTEZZACOPERTINA; int riga = 0; int indexriga = 0; int testindex = 0; if (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation ==UIInterfaceOrientationPortraitUpsideDown) { testindex = NRCopertineVerticale; } else { testindex = NRCopertineOrizzontale; } for(int j = 0; j&lt; 999; j++) { if (indexriga &gt; 0) x = x + OFFSETXCOPERTINA + w; y = OFFSETYCOPERTINA + (riga * (h + OFFSETYCOPERTINA)); UIImageView *copertina = (UIImageView *)[self.scrollView viewWithTag:(TAGCopertine + j)]; if (copertina != nil) { copertina.frame = CGRectMake( x, y, LARGHEZZACOPERTINA, ALTEZZACOPERTINA ); } UIButton *button = (UIButton *)[self.scrollView viewWithTag:(TAGButtonCopertine + j)]; if (button != nil) { button.frame = CGRectMake( x, y, LARGHEZZACOPERTINA, ALTEZZACOPERTINA ); } index++; indexriga++; if (indexriga &gt;= testindex) { indexriga = 0; riga++; x = 10; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload