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

Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
UK Journal
 

Último (20)

Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4j
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 

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