Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

692
Vistas
UITableView ContentInset and ContentOffset

I'm having trouble with the contentInset property. I have a UITableView, with dynamic cell sizes (AutoLayout). I'm setting the contentInset property to leave some space above the top of the content. But I'm getting the following result:

Unexpected Result

The content is in blue, the content inset in purple. When the table view first appears, it is in the left situation. I can scroll to get to the right situation, that is working, but I would like the table view to appears directly as in the right illustration — which I thought would be the default behavior.

How can I achieve that?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Not sure if it's the best way but I fixed it by adding:

tableView.contentOffset.y = -70

after the line:

tableView.contentInset = UIEdgeInsets(top: 70, left: 0, bottom: 50, right: 0)
over 4 years ago · Santiago Trujillo Denunciar

0

you can scroll programmatically when the view loads.

tableView.setContentOffset(CGPoint(x: 0, y: -70), animated: false)
over 4 years ago · Santiago Trujillo Denunciar

0

This is how it can be fixed easily from the Storyboard:

Table View > Size Inspector > Content Insets: Never

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda