Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Entendendo o básico de Auto Layout com XCode 6

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →
Avatar for Andre Andre
November 05, 2014

Entendendo o básico de Auto Layout com XCode 6

Lightning talk sobre o básico de Auto Layout no XCode 6 no evento CocoaHeads RJ sediado no escritório do Hotel Urbano.

Código dos exemplos: https://github.com/cytryn/AutoLayoutExample

--

Lightning talk about the basics of Auto Layout on Xcode 6 at the CocoaHeads RJ event headquartered in the office of the Hotel Urbano.

Examples found at: https://github.com/cytryn/AutoLayoutExample

Avatar for Andre

Andre

November 05, 2014

Other Decks in Technology

Transcript

  1. Entendendo  Auto  Layout • Possibilidades  de  layout;   • Gerando

     suas  constraints;   • Resolvendo  ambiguidades;   • Animando  com  Auto  Layout.
  2. • O  Xcode  deve  ser  capaz  de   calcular  como

     uma   equação;   • Existem  prioridades;   • Não  tenha  medo  de  criar   muitas  constraints.
  3. Constraint  to  Margin   • Nova  opção  para  iOS  8;

      • DeTinir  uma  constraint   relativa  a  uma  margem   predeTinida  em  sua   superview.
  4. @interface PlantZombieViewController : UIViewController @property (nonatomic, weak) IBOutlet NSLayoutConstraint *plantTopConstraint;

    @property (nonatomic, weak) IBOutlet UIImageView *plantImageView; @end @implementation PlantZombieViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. } - (IBAction)smashButtonTapped:(UIButton *)button { if (self.plantTopConstraint.constant == 0) { button.titleLabel.text = @"SMASH"; [UIView animateWithDuration:1.0 animations:^{ self.plantTopConstraint.constant = self.view.frame.size.height - self.plantImageView.frame.size.height; [self.view layoutIfNeeded]; }]; } else { button.titleLabel.text = @"RESET"; self.plantTopConstraint.constant = 0; } } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end