Guest User

Untitled

a guest
Apr 12th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (IBAction) leyenda: (id)sender
  2. {
  3.     fondo = [[UIControl alloc] initWithFrame: CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
  4.     [fondo setBackgroundColor: [UIColor blackColor]];
  5.     [fondo setAlpha: 0.5];
  6.     [fondo addTarget: self action: @selector(cerrarLeyenda:) forControlEvents: UIControlEventTouchUpInside];
  7.     [self.view addSubview: fondo];
  8.     [self.view bringSubviewToFront: fondo];
  9.     leyend = [[UIView alloc] initWithFrame: CGRectMake(60, 70, 200, 300)];
  10.     [leyend setBackgroundColor: [UIColor whiteColor]];
  11.     int yPosition2 = 0;
  12.     UILabel *cabecera = [[UILabel alloc] initWithFrame: CGRectMake(0, yPosition2, leyend.frame.size.width, 30)];
  13.     [cabecera setBackgroundColor: [UIColor colorWithRed: 255.0/255.0 green: 204.0/255.0 blue: 0.0/255.0 alpha: 1]];
  14.     [cabecera setText: @"Leyenda"];
  15.     [cabecera setTextAlignment: UITextAlignmentCenter];
  16.     [leyend addSubview: cabecera];
  17.     yPosition2 += cabecera.frame.size.height + 10;
  18.     UIImageView *iconoEvento = [[UIImageView alloc] initWithFrame: CGRectMake(10, yPosition2, 40, 40)];
  19.     [iconoEvento setImage: [UIImage imageNamed: @"evento_icono_verde.png"]];
  20.     [leyend addSubview: iconoEvento];
  21.     UILabel *iconoEventoTxt = [[UILabel alloc] initWithFrame: CGRectMake(50, yPosition2, leyend.frame.size.width - 100, 0)];
  22.     [iconoEventoTxt setText: @"Botón de acceso al evento"];
  23.     [iconoEventoTxt setBackgroundColor: [UIColor clearColor]];
  24.     [leyend addSubview: iconoEventoTxt];
  25.     yPosition2 += iconoEvento.frame.size.height + 5;
  26.     UILabel *eventoDesc = [[UILabel alloc] initWithFrame: CGRectMake(10, yPosition2, leyend.frame.size.width - 20, 0)];
  27.     [eventoDesc setText: @"Permite visualizar la información del evento y configurar sus rutas."];
  28.     [eventoDesc setBackgroundColor: [UIColor clearColor]];
  29.     [eventoDesc setNumberOfLines: 0];
  30.     [eventoDesc sizeToFit];
  31.     [leyend addSubview: eventoDesc];
  32.     // Animación para la aparición de la leyenda
  33.     [UIView beginAnimations: @"flipping view" context: nil];
  34.     [UIView setAnimationDuration: 0.5];
  35.     [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
  36.     [self.view addSubview: leyend];
  37.     [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView: leyend cache: YES];
  38.     [UIView commitAnimations];
  39.     [self.view bringSubviewToFront: leyend];
  40. }
Advertisement
Add Comment
Please, Sign In to add comment