SlideShare a Scribd company logo
Table Views
IOS Application Development Series
About Table Views
• UI Component that presents data in scrollable
list.
Holds rows that may divided into sections
• Many purposes
– Navigate data
– Present data
– Selectable list of opFons
• Two styles: plain or grouped
Plain Table View
Grouped Table View
Table Views and Table View Cells
• A table view is the view object that displays a table’s data and is an
instance of the class UITableView.
• Each visible row of the table is implemented by the class
UITableViewCell.
• So, a table view is the object that displays the visible part of a
table, and a table view cell is responsible for displaying a single row
of the table
UITableViewCell
• Each UITableViewCell object can be configured
with an image, some text, and an optional
accessory icon, which is a small icon on the
right side
UITableViewDataSource Protocol
• The UITableViewDataSource protocol is adopted by an object that
mediates the application’s data model for a UITableView object.
• The data source provides the table-view object with the
information it needs to construct and modify a table view.
• As a representative of the data model, the data source supplies
minimal information about the table view’s appearance
• The table-view object’s delegate—an object adopting the
UITableViewDelegate protocol—provides that information.
• The required methods of the protocol provide the cells to be
displayed by the table-view as well as inform the UITableView
object about the number of sections and the number of rows in
each section.
• The data source may implement optional methods to configure
various aspects of the table view and to insert, delete, and reorder
rows.
UITableViewDataSource required
instance methods
• 1. tableView:cellForRowAtIndexPath:
• This methods asks the data source for a cell to insert it in a particular
location in the table view. Syntax for method isgiven by:
• - (UITableViewCell *)tableView:(UITableView
*)tableViewcellForRowAtIndexPath:(NSIndexPath *)indexPath
• Parameters: 1.tableView A table-view object requesting the cell.
2.indexPath An index path locating a row in tableView.
• Return Value:Anobject inheriting from UITableViewCell that the table view
can use for the specified row. An assertion is raised if you return nil.
• Discussion: The returned UITableViewCell object is frequently one that the
application reuses for performance reasons. You should fetch a previously
created cell object that is marked for reuse by sending a
dequeueReusableCellWithIdentifier: message to tableView. Various
attributes of a table cell are set automatically based on whether the cell is
a separator and on information the data source provides, such as for
accessory views and editing controls.
UITableViewDataSource required
instance methods
UITableViewDelegate Protocol
• The delegate of a UITableView object must
adopt the UITableViewDelegate protocol.
Optional methods of the protocol allow the
delegate to manage selections, configure
section headings and footers, help to delete
and reorder cells, and perform other actions.
Frequently used Methods
Creating a Table View Application
•
•
•

Create empty Application
Set root view controller
Add these protocols to BIDTableViewController.h<UITableViewDataSource,
UITableViewDelegate>
• Drag Table View to the view from Object Library
• Connect Table View With File Owner
• Connect delegate and data source with File owner from Connection Inspector
• Create and Array
• Initiate array in viewDidLoad method in BIDTableViewController.m file
• add Method: - (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
• Add Method: - (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
Explaining the Methods
•
•
•
•
•

•

- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
This method is called by the table view when it needs to draw one of its rows.
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"
This string will be used as a key to represent the type of our table cell. Our table
will use only a single type of cell.
A table view can display only a few rows at a time on the iPhone’s small
screen, but the table itself can conceivably hold considerably more. Remember
that each row in the table is represented by an instance of UITableViewCell, a
subclass of UIView, which means each row can contain subviews. With a large
table, this could represent a huge amount of overhead if the table were to try to
keep one table view cell instance for every row in the table, regardless of whether
that row was currently being displayed.
Instead, as table view cells scroll off the screen, they are placed into a queue of
cells available to be reused. If the system runs low on memory, the table view will
get rid of the cells in the queue. But as long as the system has some memory
available for those cells, it will hold on to them in case you want to use them again.
Explaining the Methods
•

•
•

•

Every time a table view cell rolls off the screen, there’s a pretty good chance that
another one just rolled onto the screen on the other side. If that new row can just
reuse one of the cells that has already rolled off the screen, the system can avoid
the overhead associated with constantly creating and releasing those views. To
take advantage of this mechanism, we’ll ask the table view to give us a previously
used cell of the specified type. Note that we’re making use of the NSString
identifier we declared earlier. In effect, we’re asking for a reusable cell of type
SimpleTableIdentifier.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
SimpleTableIdentifier];
Now, it’s completely possible that the table view won’t have any spare cells (when
it’s being initially populated, for example), so we check cell after the call to see
whether it’s nil. If it is, we manually create a new table view cell using that
identifier string. At some point, we’ll inevitably reuse one of the cells we create
here, so we need to make sure that we create it using SimpleTableIdentifier.
if (cell == nil) { cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier];
}
Displaying Data in UITableViewCell
• We now have a table view cell that we can return for the table view to use.
So, all we need to do is place whatever information we want displayed in
this cell. Displaying text in a row of a table is a very common task, so the
table view cell provides a UILabel property called textLabel that we can set
in order to display strings. That just requires getting the correct string from
our listData array and using it to set the cell’s textLabel.
• To get the correct value, however, we need to know which row the table
view is asking for. We get that information from the indexPath's row
property. We use the row number of the table to get the corresponding
string from the array, assign it to the cell’s textLabel.text property, and
then return the cell.
• To get the correct value, however, we need to know which row the table
view is asking for. We get that information from the indexPath's row
property. We use the row number of the table to get the corresponding
string from the array, assign it to the cell’s textLabel.text property, and
then return the cell.
• cell.textLabel.text = self.dwarves[indexPath.row]; return cell;
Adding an Image
• Each cell has an imageView property.
• Each imageView has an image property, as well as a highlightedImage
property. The image appears to the left of the cell’s text and is replaced by
the highlightedImage, if one is provided, when the cell is selected.
• You just set the cell’s imageView.image property to whatever image you
want to display.
• Add following code in- (UITableViewCell *)tableView:(UITableView
*)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPathmethohd ,
the code is :
• Adding Normal image:
• UIImage *image = [UIImage imageNamed:@"normal.png"];
• cell.imageView.image = image;
• Adding highlighted image:
• UIImage *image = [UIImage imageNamed:@"highlighted.png"];
Choosing Accessory Type
• Add following code in same function:
• cell.accessoryType =
UITableViewCellAccessoryDisclosureIndicator
;
• You Can also give custom image to the
accessorindicator.To do so add follwing code.
• cell.accessoryView = [[UIImageViewalloc]
initWithImage:[UIImageimageNamed:@"disc
.png"]];
Changing Background Color of the
Selected Cell
• To change the background color of a selected
Cell we do so.
• UIView *selectedBackgroundViewForCell =
[UIView new];
[selectedBackgroundViewForCellsetBackgrou
ndColor:[UIColorblackColor]];
cell.selectedBackgroundView
=selectedBackgroundViewForCell;
Changing Font Colors and Font style
and Font Size
•
•
•
•

Setting Text color for cell Text Label
cell.textLabel.textColor=[UIColorblackColor];
Setting Text color when cell is selected
cell.textLabel.highlightedTextColor =
[UIColorwhiteColor];
• setting font and text size
• cell.textLabel.font =
[UIFontfontWithName:@"Times New Roman"
size:18.0f];
Setting Table View Background Color
• Make an Outlet of Table and Connect it with the
table in interface Builder.
• Synthesize the table outlet
• First set cell color to clear color as in order to
enable table background color work.
• Cell.backgroundcolor=[UIColorclearColor];
• Then in viewDidLoadMethod add follwing code
• [table setBackgroundColor:[UIColor
colorWithRed:(255/255.0) green:(193/255.0)
blue:(37/255.0) alpha:1]]
Setting Row Height of the Table View
Cell
• We have a special method to accomplish this task
• Add this method to BIDTableViewcontroller.mfile
• Add the following code which includes method and
expected row height.
• - (CGFloat)tableView:(UITableView *)tableView
heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 70;
}
Setting indent Level
• We again have a special method to add indent
level to each row of UITableView.
• Method and Code is given by. Add in same class
as did in last slide
• -(NSInteger)tableView:(UITableView
*)tableViewindentationLevelForRowAtIndexPat
h:(NSIndexPath *)indexPath
{
return indexPath.row;
}

More Related Content

What's hot

Mysql Optimization
Mysql OptimizationMysql Optimization
Mysql Optimization
KLabCyscorpions-TechBlog
 
Session 2 django material for training at baabtra models
Session 2 django material for training at baabtra modelsSession 2 django material for training at baabtra models
Session 2 django material for training at baabtra models
baabtra.com - No. 1 supplier of quality freshers
 
30 08 Final Sql
30 08 Final Sql30 08 Final Sql
30 08 Final Sql
sarov
 
View & index in SQL
View & index in SQLView & index in SQL
View & index in SQL
Swapnali Pawar
 
Comilla University
Comilla University Comilla University
Vtiger picklist 创建实例
Vtiger picklist 创建实例Vtiger picklist 创建实例
Vtiger picklist 创建实例
YUCHENG HU
 

What's hot (6)

Mysql Optimization
Mysql OptimizationMysql Optimization
Mysql Optimization
 
Session 2 django material for training at baabtra models
Session 2 django material for training at baabtra modelsSession 2 django material for training at baabtra models
Session 2 django material for training at baabtra models
 
30 08 Final Sql
30 08 Final Sql30 08 Final Sql
30 08 Final Sql
 
View & index in SQL
View & index in SQLView & index in SQL
View & index in SQL
 
Comilla University
Comilla University Comilla University
Comilla University
 
Vtiger picklist 创建实例
Vtiger picklist 创建实例Vtiger picklist 创建实例
Vtiger picklist 创建实例
 

Viewers also liked

COMPLETE SOLUTION OF ADVERTISEMENT
COMPLETE SOLUTION OF ADVERTISEMENTCOMPLETE SOLUTION OF ADVERTISEMENT
COMPLETE SOLUTION OF ADVERTISEMENT
Satyendra Gupta
 
Economics reviewer
Economics reviewerEconomics reviewer
Economics reviewer
Belle Gamboa
 
Ang modernong pananaw ng mga kabataan
Ang modernong pananaw ng mga kabataanAng modernong pananaw ng mga kabataan
Ang modernong pananaw ng mga kabataan
Audie Judalena
 
Electronic cigarette
Electronic cigaretteElectronic cigarette
Electronic cigarette
linda catherine
 
whatever it takes
 whatever it takes whatever it takes
whatever it takes
Margie Bagalanon Prejoles
 
signages and complete solution of advertise
signages and complete solution of advertise signages and complete solution of advertise
signages and complete solution of advertise
Satyendra Gupta
 
Teaching Money With Techonology
Teaching Money With TechonologyTeaching Money With Techonology
Teaching Money With Techonology
AmandaCianciola
 
Virtual Reality Museums
Virtual Reality MuseumsVirtual Reality Museums
Virtual Reality Museums
Mattia Crespi
 
signages . sign boards , designing , advertisement,
signages . sign boards , designing , advertisement,signages . sign boards , designing , advertisement,
signages . sign boards , designing , advertisement,
Satyendra Gupta
 

Viewers also liked (10)

COMPLETE SOLUTION OF ADVERTISEMENT
COMPLETE SOLUTION OF ADVERTISEMENTCOMPLETE SOLUTION OF ADVERTISEMENT
COMPLETE SOLUTION OF ADVERTISEMENT
 
Economics reviewer
Economics reviewerEconomics reviewer
Economics reviewer
 
Ferdinand E. Marcos
Ferdinand E. MarcosFerdinand E. Marcos
Ferdinand E. Marcos
 
Ang modernong pananaw ng mga kabataan
Ang modernong pananaw ng mga kabataanAng modernong pananaw ng mga kabataan
Ang modernong pananaw ng mga kabataan
 
Electronic cigarette
Electronic cigaretteElectronic cigarette
Electronic cigarette
 
whatever it takes
 whatever it takes whatever it takes
whatever it takes
 
signages and complete solution of advertise
signages and complete solution of advertise signages and complete solution of advertise
signages and complete solution of advertise
 
Teaching Money With Techonology
Teaching Money With TechonologyTeaching Money With Techonology
Teaching Money With Techonology
 
Virtual Reality Museums
Virtual Reality MuseumsVirtual Reality Museums
Virtual Reality Museums
 
signages . sign boards , designing , advertisement,
signages . sign boards , designing , advertisement,signages . sign boards , designing , advertisement,
signages . sign boards , designing , advertisement,
 

Similar to Table views

Swift Tableview iOS App Development
Swift Tableview iOS App DevelopmentSwift Tableview iOS App Development
Swift Tableview iOS App Development
Ketan Raval
 
iOS: Table Views
iOS: Table ViewsiOS: Table Views
iOS: Table Views
Jussi Pohjolainen
 
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
Vu Tran Lam
 
занятие7
занятие7занятие7
занятие7
Oleg Parinov
 
Table views
Table viewsTable views
Table views
SV.CO
 
Cocoa heads testing and viewcontrollers
Cocoa heads testing and viewcontrollersCocoa heads testing and viewcontrollers
Cocoa heads testing and viewcontrollers
Stijn Willems
 
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
 
201104 iphone navigation-based apps
201104 iphone navigation-based apps201104 iphone navigation-based apps
201104 iphone navigation-based apps
Javier Gonzalez-Sanchez
 
IOS Storyboards
IOS StoryboardsIOS Storyboards
IOS Storyboards
Muhammad Nabeel Arif
 
Sql server ___________session_16(views)
Sql server  ___________session_16(views)Sql server  ___________session_16(views)
Sql server ___________session_16(views)
Ehtisham Ali
 
Shshsjsjsjs-4 - Copdjsjjsjsjsjakakakaaky.pptx
Shshsjsjsjs-4 - Copdjsjjsjsjsjakakakaaky.pptxShshsjsjsjs-4 - Copdjsjjsjsjsjakakakaaky.pptx
Shshsjsjsjs-4 - Copdjsjjsjsjsjakakakaaky.pptx
086ChintanPatel1
 
ASP.NET Session 13 14
ASP.NET Session 13 14ASP.NET Session 13 14
ASP.NET Session 13 14
Sisir Ghosh
 
아이폰강의(6) pdf
아이폰강의(6) pdf아이폰강의(6) pdf
아이폰강의(6) pdf
sunwooindia
 
Introducing collection views - Mark Pospesel
Introducing collection views - Mark PospeselIntroducing collection views - Mark Pospesel
Introducing collection views - Mark Pospesel
Jigar Maheshwari
 
Vertica-Database
Vertica-DatabaseVertica-Database
Vertica-Database
Chakraborty Navin
 
Collections Training
Collections TrainingCollections Training
Collections Training
Ramindu Deshapriya
 
05 Create and Maintain Databases and Tables.pptx
05 Create and Maintain Databases and Tables.pptx05 Create and Maintain Databases and Tables.pptx
05 Create and Maintain Databases and Tables.pptx
MohamedNowfeek1
 
아이폰강의(4) pdf
아이폰강의(4) pdf아이폰강의(4) pdf
아이폰강의(4) pdf
sunwooindia
 
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
allanh0526
 
React table tutorial use filter (part 2)
React table tutorial use filter (part 2)React table tutorial use filter (part 2)
React table tutorial use filter (part 2)
Katy Slemon
 

Similar to Table views (20)

Swift Tableview iOS App Development
Swift Tableview iOS App DevelopmentSwift Tableview iOS App Development
Swift Tableview iOS App Development
 
iOS: Table Views
iOS: Table ViewsiOS: Table Views
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 bar
 
занятие7
занятие7занятие7
занятие7
 
Table views
Table viewsTable views
Table views
 
Cocoa heads testing and viewcontrollers
Cocoa heads testing and viewcontrollersCocoa heads testing and viewcontrollers
Cocoa heads testing and viewcontrollers
 
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)
 
201104 iphone navigation-based apps
201104 iphone navigation-based apps201104 iphone navigation-based apps
201104 iphone navigation-based apps
 
IOS Storyboards
IOS StoryboardsIOS Storyboards
IOS Storyboards
 
Sql server ___________session_16(views)
Sql server  ___________session_16(views)Sql server  ___________session_16(views)
Sql server ___________session_16(views)
 
Shshsjsjsjs-4 - Copdjsjjsjsjsjakakakaaky.pptx
Shshsjsjsjs-4 - Copdjsjjsjsjsjakakakaaky.pptxShshsjsjsjs-4 - Copdjsjjsjsjsjakakakaaky.pptx
Shshsjsjsjs-4 - Copdjsjjsjsjsjakakakaaky.pptx
 
ASP.NET Session 13 14
ASP.NET Session 13 14ASP.NET Session 13 14
ASP.NET Session 13 14
 
아이폰강의(6) pdf
아이폰강의(6) pdf아이폰강의(6) pdf
아이폰강의(6) pdf
 
Introducing collection views - Mark Pospesel
Introducing collection views - Mark PospeselIntroducing collection views - Mark Pospesel
Introducing collection views - Mark Pospesel
 
Vertica-Database
Vertica-DatabaseVertica-Database
Vertica-Database
 
Collections Training
Collections TrainingCollections Training
Collections Training
 
05 Create and Maintain Databases and Tables.pptx
05 Create and Maintain Databases and Tables.pptx05 Create and Maintain Databases and Tables.pptx
05 Create and Maintain Databases and Tables.pptx
 
아이폰강의(4) pdf
아이폰강의(4) pdf아이폰강의(4) pdf
아이폰강의(4) pdf
 
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
 
React table tutorial use filter (part 2)
React table tutorial use filter (part 2)React table tutorial use filter (part 2)
React table tutorial use filter (part 2)
 

Recently uploaded

HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 

Recently uploaded (20)

HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 

Table views

  • 1. Table Views IOS Application Development Series
  • 2. About Table Views • UI Component that presents data in scrollable list. Holds rows that may divided into sections • Many purposes – Navigate data – Present data – Selectable list of opFons • Two styles: plain or grouped
  • 5. Table Views and Table View Cells • A table view is the view object that displays a table’s data and is an instance of the class UITableView. • Each visible row of the table is implemented by the class UITableViewCell. • So, a table view is the object that displays the visible part of a table, and a table view cell is responsible for displaying a single row of the table
  • 6. UITableViewCell • Each UITableViewCell object can be configured with an image, some text, and an optional accessory icon, which is a small icon on the right side
  • 7. UITableViewDataSource Protocol • The UITableViewDataSource protocol is adopted by an object that mediates the application’s data model for a UITableView object. • The data source provides the table-view object with the information it needs to construct and modify a table view. • As a representative of the data model, the data source supplies minimal information about the table view’s appearance • The table-view object’s delegate—an object adopting the UITableViewDelegate protocol—provides that information. • The required methods of the protocol provide the cells to be displayed by the table-view as well as inform the UITableView object about the number of sections and the number of rows in each section. • The data source may implement optional methods to configure various aspects of the table view and to insert, delete, and reorder rows.
  • 8. UITableViewDataSource required instance methods • 1. tableView:cellForRowAtIndexPath: • This methods asks the data source for a cell to insert it in a particular location in the table view. Syntax for method isgiven by: • - (UITableViewCell *)tableView:(UITableView *)tableViewcellForRowAtIndexPath:(NSIndexPath *)indexPath • Parameters: 1.tableView A table-view object requesting the cell. 2.indexPath An index path locating a row in tableView. • Return Value:Anobject inheriting from UITableViewCell that the table view can use for the specified row. An assertion is raised if you return nil. • Discussion: The returned UITableViewCell object is frequently one that the application reuses for performance reasons. You should fetch a previously created cell object that is marked for reuse by sending a dequeueReusableCellWithIdentifier: message to tableView. Various attributes of a table cell are set automatically based on whether the cell is a separator and on information the data source provides, such as for accessory views and editing controls.
  • 10. UITableViewDelegate Protocol • The delegate of a UITableView object must adopt the UITableViewDelegate protocol. Optional methods of the protocol allow the delegate to manage selections, configure section headings and footers, help to delete and reorder cells, and perform other actions.
  • 12. Creating a Table View Application • • • Create empty Application Set root view controller Add these protocols to BIDTableViewController.h<UITableViewDataSource, UITableViewDelegate> • Drag Table View to the view from Object Library • Connect Table View With File Owner • Connect delegate and data source with File owner from Connection Inspector • Create and Array • Initiate array in viewDidLoad method in BIDTableViewController.m file • add Method: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section • Add Method: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  • 13. Explaining the Methods • • • • • • - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath This method is called by the table view when it needs to draw one of its rows. static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier" This string will be used as a key to represent the type of our table cell. Our table will use only a single type of cell. A table view can display only a few rows at a time on the iPhone’s small screen, but the table itself can conceivably hold considerably more. Remember that each row in the table is represented by an instance of UITableViewCell, a subclass of UIView, which means each row can contain subviews. With a large table, this could represent a huge amount of overhead if the table were to try to keep one table view cell instance for every row in the table, regardless of whether that row was currently being displayed. Instead, as table view cells scroll off the screen, they are placed into a queue of cells available to be reused. If the system runs low on memory, the table view will get rid of the cells in the queue. But as long as the system has some memory available for those cells, it will hold on to them in case you want to use them again.
  • 14. Explaining the Methods • • • • Every time a table view cell rolls off the screen, there’s a pretty good chance that another one just rolled onto the screen on the other side. If that new row can just reuse one of the cells that has already rolled off the screen, the system can avoid the overhead associated with constantly creating and releasing those views. To take advantage of this mechanism, we’ll ask the table view to give us a previously used cell of the specified type. Note that we’re making use of the NSString identifier we declared earlier. In effect, we’re asking for a reusable cell of type SimpleTableIdentifier. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier]; Now, it’s completely possible that the table view won’t have any spare cells (when it’s being initially populated, for example), so we check cell after the call to see whether it’s nil. If it is, we manually create a new table view cell using that identifier string. At some point, we’ll inevitably reuse one of the cells we create here, so we need to make sure that we create it using SimpleTableIdentifier. if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier]; }
  • 15. Displaying Data in UITableViewCell • We now have a table view cell that we can return for the table view to use. So, all we need to do is place whatever information we want displayed in this cell. Displaying text in a row of a table is a very common task, so the table view cell provides a UILabel property called textLabel that we can set in order to display strings. That just requires getting the correct string from our listData array and using it to set the cell’s textLabel. • To get the correct value, however, we need to know which row the table view is asking for. We get that information from the indexPath's row property. We use the row number of the table to get the corresponding string from the array, assign it to the cell’s textLabel.text property, and then return the cell. • To get the correct value, however, we need to know which row the table view is asking for. We get that information from the indexPath's row property. We use the row number of the table to get the corresponding string from the array, assign it to the cell’s textLabel.text property, and then return the cell. • cell.textLabel.text = self.dwarves[indexPath.row]; return cell;
  • 16. Adding an Image • Each cell has an imageView property. • Each imageView has an image property, as well as a highlightedImage property. The image appears to the left of the cell’s text and is replaced by the highlightedImage, if one is provided, when the cell is selected. • You just set the cell’s imageView.image property to whatever image you want to display. • Add following code in- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPathmethohd , the code is : • Adding Normal image: • UIImage *image = [UIImage imageNamed:@"normal.png"]; • cell.imageView.image = image; • Adding highlighted image: • UIImage *image = [UIImage imageNamed:@"highlighted.png"];
  • 17. Choosing Accessory Type • Add following code in same function: • cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator ; • You Can also give custom image to the accessorindicator.To do so add follwing code. • cell.accessoryView = [[UIImageViewalloc] initWithImage:[UIImageimageNamed:@"disc .png"]];
  • 18. Changing Background Color of the Selected Cell • To change the background color of a selected Cell we do so. • UIView *selectedBackgroundViewForCell = [UIView new]; [selectedBackgroundViewForCellsetBackgrou ndColor:[UIColorblackColor]]; cell.selectedBackgroundView =selectedBackgroundViewForCell;
  • 19. Changing Font Colors and Font style and Font Size • • • • Setting Text color for cell Text Label cell.textLabel.textColor=[UIColorblackColor]; Setting Text color when cell is selected cell.textLabel.highlightedTextColor = [UIColorwhiteColor]; • setting font and text size • cell.textLabel.font = [UIFontfontWithName:@"Times New Roman" size:18.0f];
  • 20. Setting Table View Background Color • Make an Outlet of Table and Connect it with the table in interface Builder. • Synthesize the table outlet • First set cell color to clear color as in order to enable table background color work. • Cell.backgroundcolor=[UIColorclearColor]; • Then in viewDidLoadMethod add follwing code • [table setBackgroundColor:[UIColor colorWithRed:(255/255.0) green:(193/255.0) blue:(37/255.0) alpha:1]]
  • 21. Setting Row Height of the Table View Cell • We have a special method to accomplish this task • Add this method to BIDTableViewcontroller.mfile • Add the following code which includes method and expected row height. • - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 70; }
  • 22. Setting indent Level • We again have a special method to add indent level to each row of UITableView. • Method and Code is given by. Add in same class as did in last slide • -(NSInteger)tableView:(UITableView *)tableViewindentationLevelForRowAtIndexPat h:(NSIndexPath *)indexPath { return indexPath.row; }