SlideShare a Scribd company logo
1 of 23
Download to read offline
Table	
  Views	
  in	
  iOS	
  Apps	
  

         Jussi	
  Pohjolainen	
  
About	
  Table	
  Views	
  
•  UI	
  Component	
  that	
  
   presents	
  data	
  in	
  
   scrollable	
  list.	
  Holds	
  
   rows	
  that	
  may	
  divided	
  
   into	
  sec1ons	
  
•  Many	
  purposes	
  
    –  Navigate	
  data	
  
    –  Present	
  data	
  
    –  Selectable	
  list	
  of	
  opFons	
  
•  Two	
  styles:	
  plain	
  or	
  
   grouped	
  
Plain	
  Table	
  View	
  
Cells	
  
•  Table	
  view	
  draws	
  it’s	
  rows	
  using	
  
   UITableViewCell	
  objects	
  
    –  Can	
  contain	
  text,	
  images	
  or	
  other	
  kind	
  of	
  content	
  
    –  Can	
  contain	
  background	
  view	
  for	
  normal	
  and	
  
       selected	
  states	
  
•  Framework	
  defines	
  four	
  cell	
  types,	
  with	
  
   common	
  informa1on	
  
    –  Main	
  label,	
  detail	
  label	
  and	
  image	
  
    –  You	
  can	
  define	
  your	
  own	
  cell	
  type	
  also	
  
Responding	
  to	
  SelecFons	
  
•  As	
  always,	
  UITableView	
  has	
  an	
  delegate	
  
•  Delegate	
  methods	
  are	
  called	
  when	
  user	
  clicks	
  
     a	
  row.	
  Method	
  receives	
  the	
  index	
  of	
  row	
  and	
  
     secFon	
  
	
  
EdiFng	
  Mode	
  
•  Table	
  views	
  can	
  support	
  edi1ng	
  mode	
  
   –  User	
  can	
  insert	
  or	
  delete	
  rows,	
  relocate	
  them	
  in	
  
      the	
  table	
  
•  When	
  ediFng	
  a	
  sequence	
  of	
  messages	
  are	
  
   sent	
  to	
  data	
  source	
  and	
  delegate	
  
IMPLEMENTING	
  TABLE	
  VIEW	
  
Classes	
  Needed	
  
•  Table	
  View	
  
     –  UITableView
     –  Manage	
  selecFons,	
  scroll	
  the	
  table	
  view,	
  insert	
  or	
  delete	
  rows	
  and	
  selecFons	
  
     –  UITableView	
  inherites	
  UIScrollView,	
  defines	
  scrolling	
  as	
  default	
  
•  Table	
  View	
  Controller	
  
     –  UITableViewController
     –  Adds	
  support	
  for	
  many	
  standard	
  table	
  related	
  behaviors.	
  Minimize	
  the	
  
        amount	
  of	
  code	
  you	
  have	
  to	
  write.	
  
     –  Subclass	
  UITableViewController	
  
•  Data	
  Source	
  and	
  Delegate	
  
     –  UITableView	
  must	
  have	
  delegate	
  and	
  data	
  source:	
  UITableViewDataSource	
  
        and	
  UITableViewDelegate
UITableViewDelegate	
  
•  Lot’s	
  of	
  opFons:	
  
    –  Configuring	
  Rows	
  for	
  the	
  Table	
  View 	
  	
  
    –  Managing	
  SelecFons	
  
    –  Modifying	
  Header	
  and	
  Footer	
  
    –  EdiFng	
  Table	
  Rows	
  
•  See	
  UITableViewDelegate	
  documentaFon	
  for	
  
   all	
  methods	
  
UITableViewDataSource	
  
•  Provides	
  informaFon	
  about	
  the	
  data	
  model	
  of	
  
   the	
  table	
  view	
  
•  Configuring	
  a	
  Table	
  View,	
  required	
  methods:	
  
   –  tableView:cellForRowAtIndexPath:	
  
       •  Returns	
  the	
  UITableViewCell	
  for	
  row	
  
   –  tableView:numberOfRowsInSecFon:	
  	
  
       •  Returns	
  the	
  number	
  of	
  rows	
  
Xcode	
  Template	
  
•  When	
  creaFng	
  a	
  new	
  UITableViewController,	
  let	
  
   Xcode	
  create	
  a	
  xib	
  file	
  for	
  you	
  
•  Xcode	
  creates	
  
   –  Class	
  that	
  inherites	
  UITableViewController	
  
   –  XIB	
  with	
  UITableView	
  
   –  ConnecFons	
  
       •  dataSource	
  -­‐>	
  file	
  owner	
  
       •  delegate	
  -­‐>	
  file	
  owner	
  
   –  Template	
  code	
  for	
  dataSource	
  and	
  delegate	
  methods	
  
       	
  
Data	
  Source	
  Required	
  Methods	
  
Reusing	
  UITableViewCells	
  
•  If	
  one	
  would	
  have	
  large	
  amount	
  of	
  
   UITableViewCells	
  in	
  UITableView,	
  it	
  would	
  take	
  a	
  
   lot	
  of	
  memory	
  
•  Offscreen	
  cells	
  are	
  put	
  into	
  a	
  pool	
  of	
  cells	
  
   available	
  for	
  reuse	
  
•  Instead	
  of	
  creaFng	
  a	
  new	
  cell	
  for	
  every	
  request,	
  
   the	
  data	
  source	
  first	
  checks	
  the	
  pool	
  
    –  I	
  need	
  a	
  cell	
  with	
  this	
  reuse	
  iden1fier	
  (=	
  name	
  of	
  the	
  
       cell	
  class)	
  
•  If	
  unused	
  cell,	
  it	
  configures	
  it	
  with	
  new	
  data	
  and	
  
   returns	
  it	
  to	
  the	
  table	
  view	
  
Reusing	
  
NSIndexPath
•  The	
  NSIndexPath	
  class	
  represents	
  the	
  path	
  to	
  
   a	
  specific	
  node	
  in	
  a	
  tree	
  of	
  nested	
  array	
  
   collecFons.	
  This	
  path	
  is	
  known	
  as	
  an	
  index	
  
   path.	
  
•  Has	
  two	
  properFes:	
  secFon	
  and	
  row	
  
NavigaFon	
  and	
  Table	
  View	
  
•  Follow	
  paYerns	
  that	
  are	
  common	
  to	
  all	
  
   navigaFon-­‐based	
  apps	
  
    –  Use	
  data	
  model	
  that	
  has	
  hierarchical	
  depth;	
  
       arrays,	
  dicFonary,	
  some	
  collecFon	
  
    –  Array	
  may	
  contain	
  another	
  array	
  and	
  so	
  on..	
  
•  When	
  user	
  taps	
  a	
  row,	
  then	
  
    –  Create	
  new	
  table	
  view	
  controller,	
  set	
  it’s	
  data	
  and	
  
       push	
  it	
  to	
  navigaFon	
  controller	
  
Simple	
  Data	
  Model	
  Object	
  
Push	
  Content	
  to	
  Another	
  View	
  
            Controller	
  
EDITABLE	
  TABLE	
  VIEW	
  
Editable	
  Table	
  View	
  
•  User	
  can	
  add,	
  delete	
  or	
  
   move	
  table	
  rows	
  
•  Set	
  ediFng	
  property	
  to	
  YES	
  
    –  [[self tableView]
       setEditing:YES];
•  And	
  implement	
  delegate	
  
   methods	
  for	
  moving	
  and	
  
   deleFng	
  
Adding	
  Rows	
  
Removing	
  Rows	
  
Moving	
  Rows	
  

More Related Content

Viewers also liked

iOS UI Table Views
iOS UI Table ViewsiOS UI Table Views
iOS UI Table ViewsMarian Ignev
 
UITableView Training Presentation Slides
UITableView Training Presentation SlidesUITableView Training Presentation Slides
UITableView Training Presentation SlidesgrateDvyde
 
iOS UIKit
iOS UIKitiOS UIKit
iOS UIKitWOX APP
 
iOS Development using Swift: Enums, ARC, Delegation, Closures, Table View and...
iOS Development using Swift: Enums, ARC, Delegation, Closures, Table View and...iOS Development using Swift: Enums, ARC, Delegation, Closures, Table View and...
iOS Development using Swift: Enums, ARC, Delegation, Closures, Table View and...Ahmed Ali
 
Modern Objective-C @ Pragma Night
Modern Objective-C @ Pragma NightModern Objective-C @ Pragma Night
Modern Objective-C @ Pragma NightGiuseppe Arici
 
Thinking in swift ppt
Thinking in swift pptThinking in swift ppt
Thinking in swift pptKeith Moon
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03) iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03) Jonathan Engelsma
 
iOS NSAgora #3: Objective-C vs. Swift
iOS NSAgora #3: Objective-C vs. SwiftiOS NSAgora #3: Objective-C vs. Swift
iOS NSAgora #3: Objective-C vs. SwiftAlex Cristea
 
Spring MVC to iOS and the REST
Spring MVC to iOS and the RESTSpring MVC to iOS and the REST
Spring MVC to iOS and the RESTRoy Clarkson
 
Introduction to Parse
Introduction to ParseIntroduction to Parse
Introduction to Parseabeymm
 
Denis Lebedev, Swift
Denis  Lebedev, SwiftDenis  Lebedev, Swift
Denis Lebedev, SwiftYandex
 
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOSSoftware architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOSJinkyu Kim
 
Workshop iOS 2: Swift - Structures
Workshop iOS 2: Swift - StructuresWorkshop iOS 2: Swift - Structures
Workshop iOS 2: Swift - StructuresVisual Engineering
 
iOS for Android Developers (with Swift)
iOS for Android Developers (with Swift)iOS for Android Developers (with Swift)
iOS for Android Developers (with Swift)David Truxall
 
Auto Layout part 1
Auto Layout part 1Auto Layout part 1
Auto Layout part 1Liyao Chen
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to SwiftGiordano Scalzo
 

Viewers also liked (20)

iOS UI Table Views
iOS UI Table ViewsiOS UI Table Views
iOS UI Table Views
 
UITableView Training Presentation Slides
UITableView Training Presentation SlidesUITableView Training Presentation Slides
UITableView Training Presentation Slides
 
iOS UIKit
iOS UIKitiOS UIKit
iOS UIKit
 
Swift
SwiftSwift
Swift
 
iOS Development using Swift: Enums, ARC, Delegation, Closures, Table View and...
iOS Development using Swift: Enums, ARC, Delegation, Closures, Table View and...iOS Development using Swift: Enums, ARC, Delegation, Closures, Table View and...
iOS Development using Swift: Enums, ARC, Delegation, Closures, Table View and...
 
Modern Objective-C @ Pragma Night
Modern Objective-C @ Pragma NightModern Objective-C @ Pragma Night
Modern Objective-C @ Pragma Night
 
Ios - Intorduction to view controller
Ios - Intorduction to view controllerIos - Intorduction to view controller
Ios - Intorduction to view controller
 
Thinking in swift ppt
Thinking in swift pptThinking in swift ppt
Thinking in swift ppt
 
iOS (7) Workshop
iOS (7) WorkshopiOS (7) Workshop
iOS (7) Workshop
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03) iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
 
iOS NSAgora #3: Objective-C vs. Swift
iOS NSAgora #3: Objective-C vs. SwiftiOS NSAgora #3: Objective-C vs. Swift
iOS NSAgora #3: Objective-C vs. Swift
 
Spring MVC to iOS and the REST
Spring MVC to iOS and the RESTSpring MVC to iOS and the REST
Spring MVC to iOS and the REST
 
Introduction to Parse
Introduction to ParseIntroduction to Parse
Introduction to Parse
 
Denis Lebedev, Swift
Denis  Lebedev, SwiftDenis  Lebedev, Swift
Denis Lebedev, Swift
 
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOSSoftware architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
 
Workshop iOS 2: Swift - Structures
Workshop iOS 2: Swift - StructuresWorkshop iOS 2: Swift - Structures
Workshop iOS 2: Swift - Structures
 
iOS for Android Developers (with Swift)
iOS for Android Developers (with Swift)iOS for Android Developers (with Swift)
iOS for Android Developers (with Swift)
 
Auto Layout part 1
Auto Layout part 1Auto Layout part 1
Auto Layout part 1
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to Swift
 
Apple iOS
Apple iOSApple iOS
Apple iOS
 

Similar to iOS: Table Views

Session 14 - Working with table view and search bar
Session 14 - Working with table view and search barSession 14 - Working with table view and search bar
Session 14 - Working with table view and search barVu Tran Lam
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)Jonathan Engelsma
 
Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Michael Shrove
 
아이폰강의(4) pdf
아이폰강의(4) pdf아이폰강의(4) pdf
아이폰강의(4) pdfsunwooindia
 
Model View Controller
Model View ControllerModel View Controller
Model View ControllerSV.CO
 
Advanced collection views
Advanced collection viewsAdvanced collection views
Advanced collection viewsMike Bluestein
 
Introducing collection views - Mark Pospesel
Introducing collection views - Mark PospeselIntroducing collection views - Mark Pospesel
Introducing collection views - Mark PospeselJigar Maheshwari
 
foodmunch 2.pptx hdshid hdbfhdbfhkd vcn vbds
foodmunch 2.pptx hdshid hdbfhdbfhkd vcn  vbdsfoodmunch 2.pptx hdshid hdbfhdbfhkd vcn  vbds
foodmunch 2.pptx hdshid hdbfhdbfhkd vcn vbdsputtipavan23022023
 
Android webinar class_6
Android webinar class_6Android webinar class_6
Android webinar class_6Edureka!
 
Using a model view-view model architecture for iOS apps
Using a model view-view model architecture for iOS appsUsing a model view-view model architecture for iOS apps
Using a model view-view model architecture for iOS appsallanh0526
 
Sage 300 ERP: Technical Tour of Diagnostic Tools
Sage 300 ERP: Technical Tour of Diagnostic ToolsSage 300 ERP: Technical Tour of Diagnostic Tools
Sage 300 ERP: Technical Tour of Diagnostic ToolsSage 300 ERP CS
 
Query Optimization in SQL Server
Query Optimization in SQL ServerQuery Optimization in SQL Server
Query Optimization in SQL ServerRajesh Gunasundaram
 
SQL WORKSHOP::Lecture 13
SQL WORKSHOP::Lecture 13SQL WORKSHOP::Lecture 13
SQL WORKSHOP::Lecture 13Umair Amjad
 

Similar to iOS: Table Views (20)

Session 14 - Working with table view and search bar
Session 14 - Working with table view and search barSession 14 - Working with table view and search bar
Session 14 - Working with table view and search bar
 
Table views
Table viewsTable views
Table views
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
 
Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)
 
아이폰강의(4) pdf
아이폰강의(4) pdf아이폰강의(4) pdf
아이폰강의(4) pdf
 
Model View Controller
Model View ControllerModel View Controller
Model View Controller
 
VIEWS.pptx
VIEWS.pptxVIEWS.pptx
VIEWS.pptx
 
Advanced collection views
Advanced collection viewsAdvanced collection views
Advanced collection views
 
Collections
CollectionsCollections
Collections
 
Introducing collection views - Mark Pospesel
Introducing collection views - Mark PospeselIntroducing collection views - Mark Pospesel
Introducing collection views - Mark Pospesel
 
foodmunch 2.pptx hdshid hdbfhdbfhkd vcn vbds
foodmunch 2.pptx hdshid hdbfhdbfhkd vcn  vbdsfoodmunch 2.pptx hdshid hdbfhdbfhkd vcn  vbds
foodmunch 2.pptx hdshid hdbfhdbfhkd vcn vbds
 
Android Database
Android DatabaseAndroid Database
Android Database
 
Database Objects
Database ObjectsDatabase Objects
Database Objects
 
Android webinar class_6
Android webinar class_6Android webinar class_6
Android webinar class_6
 
Using a model view-view model architecture for iOS apps
Using a model view-view model architecture for iOS appsUsing a model view-view model architecture for iOS apps
Using a model view-view model architecture for iOS apps
 
Sage 300 ERP: Technical Tour of Diagnostic Tools
Sage 300 ERP: Technical Tour of Diagnostic ToolsSage 300 ERP: Technical Tour of Diagnostic Tools
Sage 300 ERP: Technical Tour of Diagnostic Tools
 
6232 b 04
6232 b 046232 b 04
6232 b 04
 
Query Optimization in SQL Server
Query Optimization in SQL ServerQuery Optimization in SQL Server
Query Optimization in SQL Server
 
SQL WORKSHOP::Lecture 13
SQL WORKSHOP::Lecture 13SQL WORKSHOP::Lecture 13
SQL WORKSHOP::Lecture 13
 
chap13.ppt
chap13.pptchap13.ppt
chap13.ppt
 

More from Jussi Pohjolainen

libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferencesJussi Pohjolainen
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationJussi Pohjolainen
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDXJussi Pohjolainen
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript DevelopmentJussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame AnimationJussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame AnimationJussi Pohjolainen
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDXJussi Pohjolainen
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDXJussi Pohjolainen
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesJussi Pohjolainen
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platformJussi Pohjolainen
 

More from Jussi Pohjolainen (20)

Moved to Speakerdeck
Moved to SpeakerdeckMoved to Speakerdeck
Moved to Speakerdeck
 
Java Web Services
Java Web ServicesJava Web Services
Java Web Services
 
Box2D and libGDX
Box2D and libGDXBox2D and libGDX
Box2D and libGDX
 
libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and Preferences
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDX
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript Development
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
libGDX: Scene2D
libGDX: Scene2DlibGDX: Scene2D
libGDX: Scene2D
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: User Input
libGDX: User InputlibGDX: User Input
libGDX: User Input
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDX
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDX
 
Android Threading
Android ThreadingAndroid Threading
Android Threading
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platform
 
Intro to Asha UI
Intro to Asha UIIntro to Asha UI
Intro to Asha UI
 

Recently uploaded

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

iOS: Table Views

  • 1. Table  Views  in  iOS  Apps   Jussi  Pohjolainen  
  • 2. About  Table  Views   •  UI  Component  that   presents  data  in   scrollable  list.  Holds   rows  that  may  divided   into  sec1ons   •  Many  purposes   –  Navigate  data   –  Present  data   –  Selectable  list  of  opFons   •  Two  styles:  plain  or   grouped  
  • 4. Cells   •  Table  view  draws  it’s  rows  using   UITableViewCell  objects   –  Can  contain  text,  images  or  other  kind  of  content   –  Can  contain  background  view  for  normal  and   selected  states   •  Framework  defines  four  cell  types,  with   common  informa1on   –  Main  label,  detail  label  and  image   –  You  can  define  your  own  cell  type  also  
  • 5. Responding  to  SelecFons   •  As  always,  UITableView  has  an  delegate   •  Delegate  methods  are  called  when  user  clicks   a  row.  Method  receives  the  index  of  row  and   secFon    
  • 6. EdiFng  Mode   •  Table  views  can  support  edi1ng  mode   –  User  can  insert  or  delete  rows,  relocate  them  in   the  table   •  When  ediFng  a  sequence  of  messages  are   sent  to  data  source  and  delegate  
  • 8. Classes  Needed   •  Table  View   –  UITableView –  Manage  selecFons,  scroll  the  table  view,  insert  or  delete  rows  and  selecFons   –  UITableView  inherites  UIScrollView,  defines  scrolling  as  default   •  Table  View  Controller   –  UITableViewController –  Adds  support  for  many  standard  table  related  behaviors.  Minimize  the   amount  of  code  you  have  to  write.   –  Subclass  UITableViewController   •  Data  Source  and  Delegate   –  UITableView  must  have  delegate  and  data  source:  UITableViewDataSource   and  UITableViewDelegate
  • 9. UITableViewDelegate   •  Lot’s  of  opFons:   –  Configuring  Rows  for  the  Table  View     –  Managing  SelecFons   –  Modifying  Header  and  Footer   –  EdiFng  Table  Rows   •  See  UITableViewDelegate  documentaFon  for   all  methods  
  • 10. UITableViewDataSource   •  Provides  informaFon  about  the  data  model  of   the  table  view   •  Configuring  a  Table  View,  required  methods:   –  tableView:cellForRowAtIndexPath:   •  Returns  the  UITableViewCell  for  row   –  tableView:numberOfRowsInSecFon:     •  Returns  the  number  of  rows  
  • 11. Xcode  Template   •  When  creaFng  a  new  UITableViewController,  let   Xcode  create  a  xib  file  for  you   •  Xcode  creates   –  Class  that  inherites  UITableViewController   –  XIB  with  UITableView   –  ConnecFons   •  dataSource  -­‐>  file  owner   •  delegate  -­‐>  file  owner   –  Template  code  for  dataSource  and  delegate  methods    
  • 12. Data  Source  Required  Methods  
  • 13. Reusing  UITableViewCells   •  If  one  would  have  large  amount  of   UITableViewCells  in  UITableView,  it  would  take  a   lot  of  memory   •  Offscreen  cells  are  put  into  a  pool  of  cells   available  for  reuse   •  Instead  of  creaFng  a  new  cell  for  every  request,   the  data  source  first  checks  the  pool   –  I  need  a  cell  with  this  reuse  iden1fier  (=  name  of  the   cell  class)   •  If  unused  cell,  it  configures  it  with  new  data  and   returns  it  to  the  table  view  
  • 15. NSIndexPath •  The  NSIndexPath  class  represents  the  path  to   a  specific  node  in  a  tree  of  nested  array   collecFons.  This  path  is  known  as  an  index   path.   •  Has  two  properFes:  secFon  and  row  
  • 16. NavigaFon  and  Table  View   •  Follow  paYerns  that  are  common  to  all   navigaFon-­‐based  apps   –  Use  data  model  that  has  hierarchical  depth;   arrays,  dicFonary,  some  collecFon   –  Array  may  contain  another  array  and  so  on..   •  When  user  taps  a  row,  then   –  Create  new  table  view  controller,  set  it’s  data  and   push  it  to  navigaFon  controller  
  • 17. Simple  Data  Model  Object  
  • 18. Push  Content  to  Another  View   Controller  
  • 20. Editable  Table  View   •  User  can  add,  delete  or   move  table  rows   •  Set  ediFng  property  to  YES   –  [[self tableView] setEditing:YES]; •  And  implement  delegate   methods  for  moving  and   deleFng