SlideShare uma empresa Scribd logo
1 de 11
Baixar para ler offline
Collections Fun @ the Queensland C# Mobile
Developers Meetup
Glenn Stephens
glenn@orchardebusiness.com
http://www.orchardebusiness.com
0432 933 972
Wednesday, 31 July 13
iOS ViewControllers
• Most of us are familiar with the common ones
• UINavigationController
• UITabViewController
Wednesday, 31 July 13
What if...
• We wanted a custom
display of sorts
• Its surprisingly simple
Wednesday, 31 July 13
To create custom collection systems
• You need to store a list of UIViewController
• Position these controllers where you want them
• Animate between them (optional but
recommended)
• Perform Lazy Loading where/if possible
Wednesday, 31 July 13
Creating custom collection systems
• For my Evernote style, I worked out the initial position based on the number
of tabs and then animated to and from the initial position
• Tabs above the selected tab get animated up
• Tabs below the selected tab get animated down
• I expose two events OnShowTab and OnShowAll. I use this to do whatever
I want in the area above the tabs, such as having a UIView fade in and out
• Hitting the tab animates to the tab
• Tapping the tab again goes back to the main screen
Wednesday, 31 July 13
Hitting the Green Tab
Hit the tab
Hit the controller
Wednesday, 31 July 13
Another example
• TabBar replacement
• Animates the tab status and buttons
• The same technique as the others
• Using Lazy loading of UIView Controllers
this time
Wednesday, 31 July 13
Surprisingly simple
• Again, creating a new UIViewController subclass
• Storing a list of other UIViewController subclasses
• with some extra info this time
• Using UIView based animation to get a smooth effect
Wednesday, 31 July 13
Declaring the class
! public class AnimatedTabBarViewController : UIViewController
! {
! ! public AnimatedTabBarViewController () : base()
! ! {
! ! }
! ! public class TabEntry
! ! {
! ! ! public UIImage ButtonImage;
! ! ! public UIViewController ViewController;
! ! ! public UILabel Label = null;
! ! ! public TapableImageView Button = null;
! ! ! public bool HasCreated = false;
! ! ! public override string ToString ()
! ! ! {
! ! ! ! return ViewController.Title;
! ! ! }
! ! }
! ! public List<TabEntry> Tabs = new List<TabEntry>();
! ! public void AddTab(UIImage buttonImage, UIViewController viewController)
Wednesday, 31 July 13
Animating where required
! ! void ProcessTabButtonTouch (object sender, EventArgs e)
! ! {
! ! ! // Change the Tab
! ! ! ActiveTabIndex = (sender as TapableImageView).Tag;
! ! ! ShowCurrentTab();
! ! ! // Animate the Button Popping in and out
! ! ! UIView.BeginAnimations("MoveShapyThing");
! ! ! UIView.SetAnimationDuration(0.4f);
! ! ! UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
! ! ! _highlightShape.Frame = new RectangleF(PaddingSizeHorizontal + ActiveTabIndex * (RectangleWidth + PaddingSizeHorizontal),
! ! ! PaddingSizeVertical, RectangleWidth, RectangleHeight);
! ! ! UIView.CommitAnimations();
! ! }
Wednesday, 31 July 13
Q&A
• This was a quick 15 minute talk at the July 2013 Queensland C# Mobile
Developers Meetup
http://www.meetup.com/Queensland-based-MonoTouch-and-Mono-for-
Android/
• For more info, questions, or general Xamarin chit chat
Email: glenn@orchardebusiness.com
Web: http://www.orchardebusiness.com
Skype: glennthomasstephens
Wednesday, 31 July 13

Mais conteúdo relacionado

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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)
 
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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Destaque

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

Building Custom view controllers with Xamarin

  • 1. Collections Fun @ the Queensland C# Mobile Developers Meetup Glenn Stephens glenn@orchardebusiness.com http://www.orchardebusiness.com 0432 933 972 Wednesday, 31 July 13
  • 2. iOS ViewControllers • Most of us are familiar with the common ones • UINavigationController • UITabViewController Wednesday, 31 July 13
  • 3. What if... • We wanted a custom display of sorts • Its surprisingly simple Wednesday, 31 July 13
  • 4. To create custom collection systems • You need to store a list of UIViewController • Position these controllers where you want them • Animate between them (optional but recommended) • Perform Lazy Loading where/if possible Wednesday, 31 July 13
  • 5. Creating custom collection systems • For my Evernote style, I worked out the initial position based on the number of tabs and then animated to and from the initial position • Tabs above the selected tab get animated up • Tabs below the selected tab get animated down • I expose two events OnShowTab and OnShowAll. I use this to do whatever I want in the area above the tabs, such as having a UIView fade in and out • Hitting the tab animates to the tab • Tapping the tab again goes back to the main screen Wednesday, 31 July 13
  • 6. Hitting the Green Tab Hit the tab Hit the controller Wednesday, 31 July 13
  • 7. Another example • TabBar replacement • Animates the tab status and buttons • The same technique as the others • Using Lazy loading of UIView Controllers this time Wednesday, 31 July 13
  • 8. Surprisingly simple • Again, creating a new UIViewController subclass • Storing a list of other UIViewController subclasses • with some extra info this time • Using UIView based animation to get a smooth effect Wednesday, 31 July 13
  • 9. Declaring the class ! public class AnimatedTabBarViewController : UIViewController ! { ! ! public AnimatedTabBarViewController () : base() ! ! { ! ! } ! ! public class TabEntry ! ! { ! ! ! public UIImage ButtonImage; ! ! ! public UIViewController ViewController; ! ! ! public UILabel Label = null; ! ! ! public TapableImageView Button = null; ! ! ! public bool HasCreated = false; ! ! ! public override string ToString () ! ! ! { ! ! ! ! return ViewController.Title; ! ! ! } ! ! } ! ! public List<TabEntry> Tabs = new List<TabEntry>(); ! ! public void AddTab(UIImage buttonImage, UIViewController viewController) Wednesday, 31 July 13
  • 10. Animating where required ! ! void ProcessTabButtonTouch (object sender, EventArgs e) ! ! { ! ! ! // Change the Tab ! ! ! ActiveTabIndex = (sender as TapableImageView).Tag; ! ! ! ShowCurrentTab(); ! ! ! // Animate the Button Popping in and out ! ! ! UIView.BeginAnimations("MoveShapyThing"); ! ! ! UIView.SetAnimationDuration(0.4f); ! ! ! UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut); ! ! ! _highlightShape.Frame = new RectangleF(PaddingSizeHorizontal + ActiveTabIndex * (RectangleWidth + PaddingSizeHorizontal), ! ! ! PaddingSizeVertical, RectangleWidth, RectangleHeight); ! ! ! UIView.CommitAnimations(); ! ! } Wednesday, 31 July 13
  • 11. Q&A • This was a quick 15 minute talk at the July 2013 Queensland C# Mobile Developers Meetup http://www.meetup.com/Queensland-based-MonoTouch-and-Mono-for- Android/ • For more info, questions, or general Xamarin chit chat Email: glenn@orchardebusiness.com Web: http://www.orchardebusiness.com Skype: glennthomasstephens Wednesday, 31 July 13