SlideShare a Scribd company logo
AUTO-L
Porque é im
AUTO-LAYOUT
Porque é importante
Autoresizing Mask
CONSTRAINTS
CONSTRAINTS
POSIÇÃO
TAMANHO
ACHO QUEVAI DARTUDO CERTO
HMM… ATÉ ROLA, MAS "DAQUELE JEITO"
OK, CAIU A CASA!
+♥
NSArray *yellow_constraint_H = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[yellowView(200)]"
                                                                options:0
                                                                metrics:nil
                                                                  views:viewsDictionary];
     
NSArray *yellow_constraint_V = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[yellowView(100)]"
                                                                       options:0
                                                                       metrics:nil
                                                                         views:viewsDictionary];
[self.yellowView addConstraints:yellow_constraint_H];
[self.yellowView addConstraints:yellow_constraint_V];
NSArray *yellow_constraint_H = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[yellowView(200)]"
                                                                options:0
                                                                metrics:nil
                                                                  views:viewsDictionary];
     
NSArray *yellow_constraint_V = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[yellowView(100)]"
                                                                       options:0
                                                                       metrics:nil
                                                                         views:viewsDictionary];
[self.yellowView addConstraints:yellow_constraint_H];
[self.yellowView addConstraints:yellow_constraint_V];
http://www.thinkandbuild.it/learn-to-love-auto-layout-programmatically/
SELF-SIZING CELLS
return 100
}
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
{
}
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
{
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 44.0
SCROLL-VIEW & AUTO-LAYOUT
“THE CONSTRAINTS ON THE SUBVIEWS OF THE SCROLL VIEW MUST
RESULT IN A SIZE TO FILL,WHICH IS THEN INTERPRETED AS THE CONTENT
SIZE OF THE SCROLL VIEW. (THIS SHOULD NOT BE CONFUSED WITH THE
INTRINSICCONTENTSIZE METHOD USED FOR AUTO LAYOUT.)”
[UIView animateWithDuration:1 animations:^{
myView.frame = newFrame;
}];
// update constraints
[UIView animateWithDuration:1 animations:^{
[myView layoutIfNeeded];
}];

More Related Content

Viewers also liked

A/B Testing in Mobile
A/B Testing in MobileA/B Testing in Mobile
A/B Testing in Mobile
Mauricio Tremea Zaquia
 
iOS 10 - What's New
iOS 10 - What's NewiOS 10 - What's New
iOS 10 - What's New
Mauricio Tremea Zaquia
 
Introducing Google Pixel XL
Introducing Google Pixel XLIntroducing Google Pixel XL
Introducing Google Pixel XL
JJ Wu
 
Introducing Apple iPhone 7
Introducing Apple iPhone 7Introducing Apple iPhone 7
Introducing Apple iPhone 7
JJ Wu
 
Alfabetización
AlfabetizaciónAlfabetización
Alfabetización
gaskun_98
 
Capitulo5
Capitulo5Capitulo5
Capitulo5
Sergio Ayup
 
FOTOS
FOTOSFOTOS
FOTOS
earp0002
 
Polinomios
PolinomiosPolinomios
Mètode suzuki
Mètode suzukiMètode suzuki
Mètode suzuki
Angel_Cobacho
 
About me
About meAbout me
About me
Dommts
 
CMAS - BBA
CMAS - BBACMAS - BBA
Clase Pastorado Juvenil 22 Nov. 2011
Clase Pastorado Juvenil 22  Nov. 2011Clase Pastorado Juvenil 22  Nov. 2011
Clase Pastorado Juvenil 22 Nov. 2011
Rosana McGuiness
 
Evaluacion de desempeño
Evaluacion de desempeñoEvaluacion de desempeño
Evaluacion de desempeño
Gaby Gabriela Mumenthey
 
Cy rp carlos tinoco
Cy rp carlos tinocoCy rp carlos tinoco
Cy rp carlos tinoco
eedgar
 
Luis aguilar
Luis aguilarLuis aguilar
Luis aguilar
skatemafiablogg
 
El Territorio Virtual de la Movilidad Urbana
El Territorio Virtual de la Movilidad UrbanaEl Territorio Virtual de la Movilidad Urbana
El Territorio Virtual de la Movilidad Urbana
Cesar Velandia
 
HAK_ANGKET_DAN_BYPASS_REZIM_JOKOWI[1]
HAK_ANGKET_DAN_BYPASS_REZIM_JOKOWI[1]HAK_ANGKET_DAN_BYPASS_REZIM_JOKOWI[1]
HAK_ANGKET_DAN_BYPASS_REZIM_JOKOWI[1]
Attock Suharto
 
La globalización
La globalización La globalización
La globalización
elizabethpresentacion
 
Lectura fortalecimiento
Lectura fortalecimientoLectura fortalecimiento
Lectura fortalecimiento
Lenny Johanna Castaño
 
Proyecto TIC en un centro educativo
Proyecto TIC en un centro educativoProyecto TIC en un centro educativo
Proyecto TIC en un centro educativo
avg28
 

Viewers also liked (20)

A/B Testing in Mobile
A/B Testing in MobileA/B Testing in Mobile
A/B Testing in Mobile
 
iOS 10 - What's New
iOS 10 - What's NewiOS 10 - What's New
iOS 10 - What's New
 
Introducing Google Pixel XL
Introducing Google Pixel XLIntroducing Google Pixel XL
Introducing Google Pixel XL
 
Introducing Apple iPhone 7
Introducing Apple iPhone 7Introducing Apple iPhone 7
Introducing Apple iPhone 7
 
Alfabetización
AlfabetizaciónAlfabetización
Alfabetización
 
Capitulo5
Capitulo5Capitulo5
Capitulo5
 
FOTOS
FOTOSFOTOS
FOTOS
 
Polinomios
PolinomiosPolinomios
Polinomios
 
Mètode suzuki
Mètode suzukiMètode suzuki
Mètode suzuki
 
About me
About meAbout me
About me
 
CMAS - BBA
CMAS - BBACMAS - BBA
CMAS - BBA
 
Clase Pastorado Juvenil 22 Nov. 2011
Clase Pastorado Juvenil 22  Nov. 2011Clase Pastorado Juvenil 22  Nov. 2011
Clase Pastorado Juvenil 22 Nov. 2011
 
Evaluacion de desempeño
Evaluacion de desempeñoEvaluacion de desempeño
Evaluacion de desempeño
 
Cy rp carlos tinoco
Cy rp carlos tinocoCy rp carlos tinoco
Cy rp carlos tinoco
 
Luis aguilar
Luis aguilarLuis aguilar
Luis aguilar
 
El Territorio Virtual de la Movilidad Urbana
El Territorio Virtual de la Movilidad UrbanaEl Territorio Virtual de la Movilidad Urbana
El Territorio Virtual de la Movilidad Urbana
 
HAK_ANGKET_DAN_BYPASS_REZIM_JOKOWI[1]
HAK_ANGKET_DAN_BYPASS_REZIM_JOKOWI[1]HAK_ANGKET_DAN_BYPASS_REZIM_JOKOWI[1]
HAK_ANGKET_DAN_BYPASS_REZIM_JOKOWI[1]
 
La globalización
La globalización La globalización
La globalización
 
Lectura fortalecimiento
Lectura fortalecimientoLectura fortalecimiento
Lectura fortalecimiento
 
Proyecto TIC en un centro educativo
Proyecto TIC en un centro educativoProyecto TIC en un centro educativo
Proyecto TIC en un centro educativo
 

Auto-layout

  • 4.
  • 5.
  • 9. ACHO QUEVAI DARTUDO CERTO HMM… ATÉ ROLA, MAS "DAQUELE JEITO" OK, CAIU A CASA!
  • 10. +♥
  • 11.
  • 12. NSArray *yellow_constraint_H = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[yellowView(200)]"                                                                 options:0                                                                 metrics:nil                                                                   views:viewsDictionary];       NSArray *yellow_constraint_V = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[yellowView(100)]"                                                                        options:0                                                                        metrics:nil                                                                          views:viewsDictionary]; [self.yellowView addConstraints:yellow_constraint_H]; [self.yellowView addConstraints:yellow_constraint_V];
  • 13. NSArray *yellow_constraint_H = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[yellowView(200)]"                                                                 options:0                                                                 metrics:nil                                                                   views:viewsDictionary];       NSArray *yellow_constraint_V = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[yellowView(100)]"                                                                        options:0                                                                        metrics:nil                                                                          views:viewsDictionary]; [self.yellowView addConstraints:yellow_constraint_H]; [self.yellowView addConstraints:yellow_constraint_V]; http://www.thinkandbuild.it/learn-to-love-auto-layout-programmatically/
  • 15. return 100 } func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
  • 16. } func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
  • 18.
  • 19.
  • 20.
  • 21.
  • 23. “THE CONSTRAINTS ON THE SUBVIEWS OF THE SCROLL VIEW MUST RESULT IN A SIZE TO FILL,WHICH IS THEN INTERPRETED AS THE CONTENT SIZE OF THE SCROLL VIEW. (THIS SHOULD NOT BE CONFUSED WITH THE INTRINSICCONTENTSIZE METHOD USED FOR AUTO LAYOUT.)”
  • 24.
  • 25. [UIView animateWithDuration:1 animations:^{ myView.frame = newFrame; }]; // update constraints [UIView animateWithDuration:1 animations:^{ [myView layoutIfNeeded]; }];