The document discusses iPhone application development using scroll views and table views in iPhone SDK 3.2. It covers the basics of scroll views including content size, content insets, and scroll indicators. It also covers using scroll views with delegates and zooming functionality. Table views are introduced as a way to display lists of data, and the document discusses table view styles, anatomy, and using a data source to populate table views.
Developing in HTML5: Widgetbox & Sencha TouchSencha
The future of mobile is with cross platform mobile web apps. In this session you'll discover how Widgetbox used Sencha Touch to rebuild their existing HTML5 mobile apps from the ground up. Using real-life product examples, we'll cover all aspects of developing on top of the Sencha framework including using Javascript, styling in CSS3, and taking advantage of performance optimization and workarounds.
Sense of Security - Securing Virtualised Environments; Focus on the FundamentalsJason Edelstein
Virtualisation of ICT infrastructure has been one of the more recent strategies to achieve substantial technical and commercial gains from your technology investment; organisations of all sizes are either evaluating it or using it!
So what’s the catch? Put simply, the principles of information security are regularly overlooked during the planning and deployment stages of a virtualisation program.
This webinar will explore some of the security risks that organisations inadvertently expose there businesses to when deploying virtualised infrastructure. Furthermore the presenter will discuss the fundamentals of information security, and importantly how to apply these fundamentals in a virtualised environment to manage risk and protect critical information assets.
Drupal security - Configuration and processGábor Hojtsy
"Drupal security - Configuration and process" session slides from Drupalcon Copenhagen.
Co-prepared and co-presented with Ben Jeavons from Growing Venture Solutions (http://growingventuresolutions.com/)
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Developing in HTML5: Widgetbox & Sencha TouchSencha
The future of mobile is with cross platform mobile web apps. In this session you'll discover how Widgetbox used Sencha Touch to rebuild their existing HTML5 mobile apps from the ground up. Using real-life product examples, we'll cover all aspects of developing on top of the Sencha framework including using Javascript, styling in CSS3, and taking advantage of performance optimization and workarounds.
Sense of Security - Securing Virtualised Environments; Focus on the FundamentalsJason Edelstein
Virtualisation of ICT infrastructure has been one of the more recent strategies to achieve substantial technical and commercial gains from your technology investment; organisations of all sizes are either evaluating it or using it!
So what’s the catch? Put simply, the principles of information security are regularly overlooked during the planning and deployment stages of a virtualisation program.
This webinar will explore some of the security risks that organisations inadvertently expose there businesses to when deploying virtualised infrastructure. Furthermore the presenter will discuss the fundamentals of information security, and importantly how to apply these fundamentals in a virtualised environment to manage risk and protect critical information assets.
Drupal security - Configuration and processGábor Hojtsy
"Drupal security - Configuration and process" session slides from Drupalcon Copenhagen.
Co-prepared and co-presented with Ben Jeavons from Growing Venture Solutions (http://growingventuresolutions.com/)
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
10. UIScrollView
• For displaying more content than can fit on the screen
Saturday, January 30, 2010 7
11. UIScrollView
• For displaying more content than can fit on the screen
• Handles gestures for panning and zooming
Saturday, January 30, 2010 7
12. UIScrollView
• For displaying more content than can fit on the screen
• Handles gestures for panning and zooming
• Noteworthy subclasses: UITableView and UITextView
Saturday, January 30, 2010 7
42. Using a Scroll View
• Create with the desired frame
CGRect frame = CGRectMake(0, 0, 200, 200);
scrollView = [[UIScrollView alloc] initWithFrame:frame];
Saturday, January 30, 2010 19
43. Using a Scroll View
• Create with the desired frame
CGRect frame = CGRectMake(0, 0, 200, 200);
scrollView = [[UIScrollView alloc] initWithFrame:frame];
• Add subviews (frames may extend beyond scroll view bounds)
frame = CGRectMake(0, 0, 500, 500);
myImageView = [[UIImageView alloc] initWithFrame:frame];
[scrollView addSubview:myImageView];
Saturday, January 30, 2010 19
44. Using a Scroll View
• Create with the desired frame
CGRect frame = CGRectMake(0, 0, 200, 200);
scrollView = [[UIScrollView alloc] initWithFrame:frame];
• Add subviews (frames may extend beyond scroll view bounds)
frame = CGRectMake(0, 0, 500, 500);
myImageView = [[UIImageView alloc] initWithFrame:frame];
[scrollView addSubview:myImageView];
• Set the content size
scrollView.contentSize = CGSizeMake(500, 500);
Saturday, January 30, 2010 19
45. Extending Scroll View Behavior
• Applications often want to know about scroll events
Saturday, January 30, 2010 20
46. Extending Scroll View Behavior
• Applications often want to know about scroll events
■ When the scroll offset is changed
Saturday, January 30, 2010 20
47. Extending Scroll View Behavior
• Applications often want to know about scroll events
■ When the scroll offset is changed
■ When dragging begins & ends
Saturday, January 30, 2010 20
48. Extending Scroll View Behavior
• Applications often want to know about scroll events
■ When the scroll offset is changed
■ When dragging begins & ends
■ When deceleration begins & ends
Saturday, January 30, 2010 20
49. Extending with a Subclass
• Create a subclass
• Override methods to customize behavior
Saturday, January 30, 2010 21
50. Extending with a Subclass
• Create a subclass
• Override methods to customize behavior
• Issues with this approach
Saturday, January 30, 2010 21
51. Extending with a Subclass
• Create a subclass
• Override methods to customize behavior
• Issues with this approach
■ Application logic and behavior is now part of a View class
Saturday, January 30, 2010 21
52. Extending with a Subclass
• Create a subclass
• Override methods to customize behavior
• Issues with this approach
■ Application logic and behavior is now part of a View class
■ Tedious to write a one-off subclass for every scroll view instance
Saturday, January 30, 2010 21
53. Extending with a Subclass
• Create a subclass
• Override methods to customize behavior
• Issues with this approach
■ Application logic and behavior is now part of a View class
■ Tedious to write a one-off subclass for every scroll view instance
■ Your code becomes tightly coupled with superclass
Saturday, January 30, 2010 21
54. Extending with Delegation
• Delegate is a separate object
• Clearly defined points of responsibility
■ Change behavior
■ Customize appearance
• Loosely coupled with the object being extended
Saturday, January 30, 2010 22
61. Implementing a Delegate
• Conform to the delegate protocol
@interface MyController : NSObject <UIScrollViewDelegate>
Saturday, January 30, 2010 24
62. Implementing a Delegate
• Conform to the delegate protocol
@interface MyController : NSObject <UIScrollViewDelegate>
• Implement all required methods and any optional methods
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
// Do something in response to the new scroll position
if (scrollView.contentOffset ...) {
}
}
Saturday, January 30, 2010 24
63. Zooming with a Scroll View
Saturday, January 30, 2010 25
64. Zooming with a Scroll View
• Set the minimum, maximum, initial zoom scales
scrollView.maximumZoomScale = 2.0;
scrollView.minimumZoomScale = scrollView.size.width /
myImage.size.width;
Saturday, January 30, 2010 25
65. Zooming with a Scroll View
• Set the minimum, maximum, initial zoom scales
scrollView.maximumZoomScale = 2.0;
scrollView.minimumZoomScale = scrollView.size.width /
myImage.size.width;
• Implement delegate method for zooming
- (UIView *)viewForZoomingInScrollView:(UIView *)view
{
return someViewThatWillBeScaled;
}
Saturday, January 30, 2010 25
66. Set Zoom Scale
- (void)setZoomScale:(float)scale animated:(BOOL);
Saturday, January 30, 2010 26
67. Set Zoom Scale
- (void)setZoomScale:(float)scale animated:(BOOL);
Saturday, January 30, 2010 26
68. Set Zoom Scale
- (void)setZoomScale:(float)scale animated:(BOOL);
Saturday, January 30, 2010 26
69. Zoom to Rect
- (void)zoomToRect:(CGRect)rect animated:(BOOL);
Saturday, January 30, 2010 27
70. Zoom to Rect
- (void)zoomToRect:(CGRect)rect animated:(BOOL);
Saturday, January 30, 2010 27
71. Zoom to Rect
- (void)zoomToRect:(CGRect)rect animated:(BOOL);
Saturday, January 30, 2010 27
72. Zoom to Rect
- (void)zoomToRect:(CGRect)rect animated:(BOOL);
Saturday, January 30, 2010 28
73. Zoom to Rect
- (void)zoomToRect:(CGRect)rect animated:(BOOL);
Saturday, January 30, 2010 28
74. Zoom to Rect
- (void)zoomToRect:(CGRect)rect animated:(BOOL);
Saturday, January 30, 2010 28
77. Table Views
• Display lists of content
■ Single column, multiple rows
■ Vertical scrolling
■ Large data sets
• Powerful and ubiquitous in iPhone applications
Saturday, January 30, 2010 31
93. A Naïve Solution
• Table views display a list of data, so use an array
[myTableView setList:myListOfStuff];
Saturday, January 30, 2010 38
94. A Naïve Solution
• Table views display a list of data, so use an array
[myTableView setList:myListOfStuff];
• Issues with this approach
Saturday, January 30, 2010 38
95. A Naïve Solution
• Table views display a list of data, so use an array
[myTableView setList:myListOfStuff];
• Issues with this approach
■ All data is loaded upfront
Saturday, January 30, 2010 38
96. A Naïve Solution
• Table views display a list of data, so use an array
[myTableView setList:myListOfStuff];
• Issues with this approach
■ All data is loaded upfront
■ All data stays in memory
Saturday, January 30, 2010 38
97. A More Flexible Solution
• Another object provides data to the table view
■ Not all at once
■ Just as it’s needed for display
• Like a delegate, but purely data-oriented
Saturday, January 30, 2010 39
99. UITableViewDataSource
• Provide number of sections and rows
// Optional method, defaults to 1 if not implemented
- (NSInteger)numberOfSectionsInTableView:(UITableView *)table;
// Required method
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section;
Saturday, January 30, 2010 40
100. UITableViewDataSource
• Provide number of sections and rows
// Optional method, defaults to 1 if not implemented
- (NSInteger)numberOfSectionsInTableView:(UITableView *)table;
// Required method
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section;
• Provide cells for table view as needed
// Required method
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath;
Saturday, January 30, 2010 40
108. Datasource Message Flow
tableView:cellForRowAtIndexPath:
What to display at
section 0, row 0?
Datasource
Saturday, January 30, 2010 43
109. Datasource Message Flow
tableView:cellForRowAtIndexPath:
Datasource
Cell with text
“John Appleseed”
Saturday, January 30, 2010 43
110. NSIndexPath
• Generic class in Foundation
• Path to a specific node in a tree of nested arrays
0
1
2
3
4
Saturday, January 30, 2010 44
111. NSIndexPath
• Generic class in Foundation
• Path to a specific node in a tree of nested arrays
0 0 0 0
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
Saturday, January 30, 2010 44
112. NSIndexPath and Table Views
• Cell location described with an index path
■ Section index + row index
Saturday, January 30, 2010 45
113. NSIndexPath and Table Views
• Cell location described with an index path
■ Section index + row index
• Category on NSIndexPath with helper methods
@interface NSIndexPath (UITableView)
+ (NSIndexPath *)indexPathForRow:(NSUInteger)row
inSection:(NSUInteger)section;
@property(nonatomic,readonly) NSUInteger section;
@property(nonatomic,readonly) NSUInteger row;
@end
Saturday, January 30, 2010 45
115. Single Section Table View
• Return the number of rows
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
return [myStrings count];
}
Saturday, January 30, 2010 46
116. Single Section Table View
• Return the number of rows
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
return [myStrings count];
}
• Provide a cell when requested
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = ...;
cell.textLabel.text = [myStrings objectAtIndex:indexPath.row]
return [cell autorelease];
}
Saturday, January 30, 2010 46
118. Cell Reuse
• When asked for a cell, it would be expensive to create a new
cell each time.
Saturday, January 30, 2010 47
119. Cell Reuse
• When asked for a cell, it would be expensive to create a new
cell each time.
- (UITableViewCell *)dequeueReusableCellWithIdentifier:
(NSString *)identifier;
Saturday, January 30, 2010 47
120. Cell Reuse
• When asked for a cell, it would be expensive to create a new
cell each time.
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:@“MyIdentifier”];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:... reuseIdentifier:@“MyIdenifier”]
autorelease];
}
cell.text = [myStrings objectAtIndex:indexPath.row]
return cell;
}
Saturday, January 30, 2010 47
121. Triggering Updates
• When is the datasource asked for its data?
Saturday, January 30, 2010 48
122. Triggering Updates
• When is the datasource asked for its data?
■ When a row becomes visible
Saturday, January 30, 2010 48
123. Triggering Updates
• When is the datasource asked for its data?
■ When a row becomes visible
■ When an update is explicitly requested by calling -reloadData
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.tableView reloadData];
}
Saturday, January 30, 2010 48
133. UITableView Delegate
• Customize appearance and behavior
• Keep application logic separate from view
• Often the same object as datasource
Saturday, January 30, 2010 52
137. Row Selection in Table Views
• In iPhone applications, rows rarely stay selected
• Selecting a row usually triggers an event
Saturday, January 30, 2010 54
138. Row Selection in Table Views
• In iPhone applications, rows rarely stay selected
• Selecting a row usually triggers an event
Saturday, January 30, 2010 54
141. Responding to Selection
// For a navigation hierarchy...
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Saturday, January 30, 2010 56
142. Responding to Selection
// For a navigation hierarchy...
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Get the row and the object it represents
Saturday, January 30, 2010 56
143. Responding to Selection
// For a navigation hierarchy...
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Get the row and the object it represents
NSUInteger row = indexPath.row
Saturday, January 30, 2010 56
144. Responding to Selection
// For a navigation hierarchy...
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Get the row and the object it represents
NSUInteger row = indexPath.row
id objectToDisplay = [myObjects objectAtIndex:row];
Saturday, January 30, 2010 56
145. Responding to Selection
// For a navigation hierarchy...
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Get the row and the object it represents
NSUInteger row = indexPath.row
id objectToDisplay = [myObjects objectAtIndex:row];
// Create a new view controller and pass it along
Saturday, January 30, 2010 56
146. Responding to Selection
// For a navigation hierarchy...
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Get the row and the object it represents
NSUInteger row = indexPath.row
id objectToDisplay = [myObjects objectAtIndex:row];
// Create a new view controller and pass it along
MyViewController *myViewController = ...;
Saturday, January 30, 2010 56
147. Responding to Selection
// For a navigation hierarchy...
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Get the row and the object it represents
NSUInteger row = indexPath.row
id objectToDisplay = [myObjects objectAtIndex:row];
// Create a new view controller and pass it along
MyViewController *myViewController = ...;
myViewController.object = objectToDisplay;
Saturday, January 30, 2010 56
148. Responding to Selection
// For a navigation hierarchy...
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Get the row and the object it represents
NSUInteger row = indexPath.row
id objectToDisplay = [myObjects objectAtIndex:row];
// Create a new view controller and pass it along
MyViewController *myViewController = ...;
myViewController.object = objectToDisplay;
[self.navigationController
pushViewController:myViewController animated:YES];
}
Saturday, January 30, 2010 56
149. Altering or Disabling Selection
- (NSIndexPath *)tableView:(UITableView *)tableView
willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Don’t allow selecting certain rows?
if (indexPath.row == ...) {
return nil;
} else {
return indexPath;
}
}
Saturday, January 30, 2010 57
152. UITableViewController
• Convenient starting point for view controller with a table view
■ Table view is automatically created
■ Controller is table view’s delegate and datasource
Saturday, January 30, 2010 59
153. UITableViewController
• Convenient starting point for view controller with a table view
■ Table view is automatically created
■ Controller is table view’s delegate and datasource
• Takes care of some default behaviors
■ Calls -reloadData the first time it appears
■ Deselects rows when user navigates back
■ Flashes scroll indicators
Saturday, January 30, 2010 59
163. Basic properties
• UITableViewCell has an image view and one or two text labels
Saturday, January 30, 2010 63
164. Basic properties
• UITableViewCell has an image view and one or two text labels
cell.imageView.image = [UIImage imageNamed:@“vitolidol.png”];
cell.textLabel.text = @“Vitol Idol”;
cell.detailTextLabel.text = @“Billy Idol”;
Saturday, January 30, 2010 63
168. Accessory Types
// UITableView delegate method
- (UITableViewCellAccessoryType)tableView:(UITableView *)table
accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath;
UITableViewCellAccessoryDisclosureIndicator
UITableViewCellAccessoryDetailDisclosureButton
- (void)tableView:(UITableView *)tableView
accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
// Only for the blue disclosure button
NSUInteger row = indexPath.row;
...
}
Saturday, January 30, 2010 64
169. Accessory Types
// UITableView delegate method
- (UITableViewCellAccessoryType)tableView:(UITableView *)table
accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath;
UITableViewCellAccessoryDisclosureIndicator
UITableViewCellAccessoryDetailDisclosureButton
UITableViewCellAccessoryCheckmark
- (void)tableView:(UITableView *)tableView
accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
// Only for the blue disclosure button
NSUInteger row = indexPath.row;
...
}
Saturday, January 30, 2010 64
170. Customizing the Content View
• For cases where a simple image + text cell doesn’t suffice
• UITableViewCell has a content view property
■ Add additional views to the content view
Saturday, January 30, 2010 65
171. Customizing the Content View
• For cases where a simple image + text cell doesn’t suffice
• UITableViewCell has a content view property
■ Add additional views to the content view
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = ...;
CGRect frame = cell.contentView.bounds;
UILabel *myLabel = [[UILabel alloc] initWithFrame:frame];
myLabel.text = ...;
[cell.contentView addSubview:myLabel];
[myLabel release];
}
Saturday, January 30, 2010 65