SlideShare a Scribd company logo
Good to see you
                  Michael
Over 365 million iOS Devices
                     80% is iOS 5
Most used programming language
      2012

             Position     Language

                1            C

                2           Java

                3       Objective-C

                                      http://bit.ly/JnA6fh
Objective-C
                                                  %
 9.00


 6.75


 4.50


 2.25


   0
        2007   2008   2009   2010   2011   2012
Strange in iOS SDK 6
 Support iOS 5 runtime
Valid Architecture
 armv7s - remove
How about Auto Layout
   Disable it
NSLayoutConstraint
not supported in iOS 5
Facebook API
 Don’t use 3.1                3.1

 Use 3.0 or Deprecated ones




 Accounts only on iOS 6
Unwind
Unwind Segue
 Motivation


               We want this
Need some codes and
 Exit -
Codes
-(IBAction) dismissNext:(UIStoryboardSegue *)segue{
    [self dismissViewControllerAnimated:YES
completion:^{
        NSLog(@"dismissed");
    }];
}
Codes - where ?
-(IBAction) dismissNext:(UIStoryboardSegue *)segue;




       GLViewController
                          GLPage2ViewController
Codes - in the source direction of segue
-(IBAction) dismissNext:(UIStoryboardSegue *)segue{
    [self dismissViewControllerAnimated:YES
completion:^{
        NSLog(@"dismissed");
    }];
}




                                       GLViewController
Drag & Drop



              GLPage2ViewController
Running on iOS 5
 Terminating app due to uncaught exception
 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate
 class named UIStoryboardUnwindSegueTemplate'
Demo
StoryDemo
More
Rotate View Controller
Small but important
 -shouldAutorotateToInterfaceOrientation:
Small but important
 -shouldAutorotateToInterfaceOrientation:

 shouldAutorotate

 supportedInterfaceOrientations
Example - 只支援水平導向
-(BOOL) shouldAutorotate{
     return YES;
}


-(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;
}




                                            in UIViewController
UIInterfaceOrientationMask
typedef enum {
   UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait),
   UIInterfaceOrientationMaskLandscapeLeft = (1 << UIInterfaceOrientationLandscapeLeft),
   UIInterfaceOrientationMaskLandscapeRight = (1 << UIInterfaceOrientationLandscapeRight),
   UIInterfaceOrientationMaskPortraitUpsideDown = (1 <<
UIInterfaceOrientationPortraitUpsideDown),
   UIInterfaceOrientationMaskLandscape =
   (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight),
   UIInterfaceOrientationMaskAll =
   (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
   UIInterfaceOrientationMaskLandscapeRight |
UIInterfaceOrientationMaskPortraitUpsideDown),
   UIInterfaceOrientationMaskAllButUpsideDown =
   (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
   UIInterfaceOrientationMaskLandscapeRight),
} UIInterfaceOrientationMask;
Layout notice
    當 View Controller 被整頁性的 View Controller (如

    presentViewController:animated:completion: )蓋住時,被蓋住的 View

    Controller 中的 willRotateToInterfaceOrientation:duration:,

    willAnimateRotationToInterfaceOrientation:duration: 和

    didRotateFromInterfaceOrientation: 不會被呼叫。

    善用 viewWillLayoutSubviews
Landscape - only App




invoke a portrait-only view controller (such as the Game Center login screen)


                                                 Crash
Add protocol method in AppDelegate.m

 - (NSUInteger)application:(UIApplication *)application
 supportedInterfaceOrientationsForWindow:(UIWindow
 *)window{
     return UIInterfaceOrientationMaskAllButUpsideDown;
 }
Demo
  AutoConstraintDemo
Auto Layout
 Constraint-based
Why auto layout ?        768
         320



 480    Phone

                  1024   Pad



         320




 568   iPhone 5                ?
Why auto layout - Localization
      Hello           こんにちは




  English        Japanese
Why auto layout - Example
      Hello     こんにちは




  English       Japanese
What is Constraint



        200


                   20

   60         60
What is Constraint - code
             NSLayoutConstraint *constraint = [NSLayoutConstraint
              constraintWithItem:button1
              attribute:NSLayoutAttributeTrailing
              relatedBy:NSLayoutRelationEqual
              toItem:self.view
              attribute:NSLayoutAttributeTrailing
              multiplier:1.0f
              constant:-60.0f];

             [self.view addConstraint:constraint];



             button1.trainling = self.view.trainling*1.0-60
        60
Enable Auto Layout




         button1.translatesAutoresizingMaskIntoConstraints = NO;
What is Constraint - more
                                                                             1
                                button1.leading = self.view.leading*1.0+60
                                                                                 2
                                button1.trainling = self.view.trainling*1.0-60
               4                                                                 3
         200                    button1.bottom = self.view.bottom*1.0-20
                                                                4
                                 button1.width = nil*1.0+200
                            20
                            3
1
    60             60   2
What is Constraint - more and code
What is Constraint - more and code
Visual Format


               4
         200
                                 V:[button1]-(20)-|
                            20   |-(60)-[button1(200)]-(60)-|
                            3
1
    60             60   2
Visual Format - Code
-(void) virtualForm{
    NSDictionary * bindingDict =
NSDictionaryOfVariableBindings(button1);

    NSArray * constraints = [NSLayoutConstraint
constraintsWithVisualFormat:@"|-(60)-[button1(200)]-(60)-|" options:
0 metrics:nil views:bindingDict];

    [self.view addConstraints:constraints];

    constraints = [NSLayoutConstraint
constraintsWithVisualFormat:@"V:[button1]-(20)-|" options:0
metrics:nil views:bindingDict];

    [self.view addConstraints:constraints];

}
What is Constraint - Landscape

                        unable to satisfy all constraints


        200                             200


                   20                                       20

   60         60           60                     60
Unable to simultaneously satisfy constraints.
(
    "<NSAutoresizingMaskLayoutConstraint:0x74563f0 h=--& v=--& V:
[UIView:0x743d0d0(480)]>",
    "<NSLayoutConstraint:0x744a310 H:[UIRoundedRectButton:
0x743c350(200)]>",
    "<NSLayoutConstraint:0x744a500 H:|-(60)-[UIRoundedRectButton:
0x743c350]   (Names: '|':UIView:0x743d0d0 )>",
    "<NSLayoutConstraint:0x744a370 H:[UIRoundedRectButton:0x743c350]-
(60)-|   (Names: '|':UIView:0x743d0d0 )>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x744a370 H:[UIRoundedRectButton:0x743c350]-(60)-|
(Names: '|':UIView:0x743d0d0 )>

Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView
listed in <UIKit/UIView.h> may also be helpful.
Visual Format - Not Equal
-(void) virtualForm{
    NSDictionary * bindingDict =
NSDictionaryOfVariableBindings(button1);

    NSArray * constraints = [NSLayoutConstraint
constraintsWithVisualFormat:@"|-(>=60)-[button1(200)]-(>=60)-|"
options:0 metrics:nil views:bindingDict];

    [self.view addConstraints:constraints];

    constraints = [NSLayoutConstraint
constraintsWithVisualFormat:@"V:[button1]-(20)-|" options:0
metrics:nil views:bindingDict];

    [self.view addConstraints:constraints];

}
Result
AMBIGUOUS LAYOUT - Detect
@interface UIWindow (AutoLayoutDebug)
+ (UIWindow *)keyWindow;
- (NSString *)_autolayoutTrace;
@end                                    private method for debug
@implementation GLViewController
-(void) viewDidAppear:(BOOL)animated{
     [super viewDidAppear:animated];
     NSLog(@"%@", [[UIWindow keyWindow] _autolayoutTrace]);
}
- (void)didRotateFromInterfaceOrientation:
(UIInterfaceOrientation)fromInterfaceOrientation
{
     [super didRotateFromInterfaceOrientation:
      fromInterfaceOrientation];
     NSLog(@"%@", [[UIWindow keyWindow] _autolayoutTrace]);
}
@end
AMBIGUOUS LAYOUT - Console
*<UIWindow:0x7198500>
|   *<UIView:0x719b040>
|   |   *<UIView:0x719ae10>
|   |   *<UIRoundedRectButton:0x719ab40>
|   |   |   <UIGroupTableViewCellBackground:0x719bfb0>
|   |   |   <UIImageView:0x719c850>
|   |   |   <UIButtonLabel:0x719db30>




*<UIWindow:0x7198500>
|   *<UIView:0x719b040>
|   |   *<UIView:0x719ae10>
|   |   *<UIRoundedRectButton:0x719ab40> - AMBIGUOUS LAYOUT
|   |   |   <UIGroupTableViewCellBackground:0x719bfb0>
|   |   |   <UIImageView:0x719c850>
|   |   |   <UIButtonLabel:0x719db30>
Exercise AMBIGUOUS
[button1 addTarget:button1 action:@selector(exerciseAmbiguityInLayout)
      forControlEvents:UIControlEventTouchUpInside];
Add Center X
         NSLayoutConstraint *constraint = [NSLayoutConstraint
         constraintWithItem:button1
         attribute:NSLayoutAttributeCenterX
         relatedBy:NSLayoutRelationEqual
         toItem:self.view
         attribute:NSLayoutAttributeCenterX
         multiplier:1.0f
         constant:0.0];

         [self.view addConstraint:constraint];
It works, But...
               樣好像比較順眼




Some one with the force




                          200   300
Virtual Format - Try
 |-(>=60)-[button1(200)]-(>=60)-|




 |-(>=60)-[button1(300)]-(>=60)-|




                                    60
                                    300
Virtual Format - Priority
-(void) virtualForm{
    NSDictionary * bindingDict =
NSDictionaryOfVariableBindings(button1);

    NSArray * constraints = [NSLayoutConstraint
constraintsWithVisualFormat:@"|-(60)-[button1(300@999)]-(60)-|"
options:0 metrics:nil views:bindingDict];

    [self.view addConstraints:constraints];

    constraints = [NSLayoutConstraint
constraintsWithVisualFormat:@"V:[button1]-(20)-|" options:0
metrics:nil views:bindingDict];

    [self.view addConstraints:constraints];

}               Priority 1000 means required, and default is 1000
Great
 Demo - AutoConstraintDemo

More Related Content

Viewers also liked

Strategy Pattern for Objective-C
Strategy Pattern for Objective-CStrategy Pattern for Objective-C
Strategy Pattern for Objective-C
Michael Pan
 
Autorelease pool
Autorelease poolAutorelease pool
Autorelease poolMichael Pan
 
Homework2 play cards
Homework2 play cardsHomework2 play cards
Homework2 play cards
Michael Pan
 
Core data lightweight_migration
Core data lightweight_migrationCore data lightweight_migration
Core data lightweight_migration
Michael Pan
 
比價撿便宜 Steven
比價撿便宜 Steven比價撿便宜 Steven
比價撿便宜 StevenMichael Pan
 

Viewers also liked (7)

Strategy pattern
Strategy patternStrategy pattern
Strategy pattern
 
Strategy Pattern for Objective-C
Strategy Pattern for Objective-CStrategy Pattern for Objective-C
Strategy Pattern for Objective-C
 
Autorelease pool
Autorelease poolAutorelease pool
Autorelease pool
 
Homework2 play cards
Homework2 play cardsHomework2 play cards
Homework2 play cards
 
Core data lightweight_migration
Core data lightweight_migrationCore data lightweight_migration
Core data lightweight_migration
 
比價撿便宜 Steven
比價撿便宜 Steven比價撿便宜 Steven
比價撿便宜 Steven
 
Dropbox sync
Dropbox syncDropbox sync
Dropbox sync
 

Similar to Opening iOS App 開發者交流會

Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder Behind
John Wilker
 
iOS UI Debugging
iOS UI DebuggingiOS UI Debugging
iOS UI Debugging
davidolesch
 
Autolayout
AutolayoutAutolayout
Autolayout
Jorge Ortiz
 
Autolayout
AutolayoutAutolayout
Autolayout
Jigar Maheshwari
 
IOS APPs Revision
IOS APPs RevisionIOS APPs Revision
IOS APPs Revision
Muhammad Amin
 
Макс Грибов — Использование SpriteKit в неигровых приложениях
Макс Грибов — Использование SpriteKit в неигровых приложенияхМакс Грибов — Использование SpriteKit в неигровых приложениях
Макс Грибов — Использование SpriteKit в неигровых приложениях
CocoaHeads
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
anistar sung
 
Standford 2015 week3: Objective-C Compatibility, Property List, Views
Standford 2015 week3: Objective-C Compatibility, Property List, ViewsStandford 2015 week3: Objective-C Compatibility, Property List, Views
Standford 2015 week3: Objective-C Compatibility, Property List, Views
彼得潘 Pan
 
Lviv MD Day 2015 Костянтин Бичков "iOS Autolayouts – це добре!"
Lviv MD Day 2015 Костянтин Бичков "iOS Autolayouts – це добре!"Lviv MD Day 2015 Костянтин Бичков "iOS Autolayouts – це добре!"
Lviv MD Day 2015 Костянтин Бичков "iOS Autolayouts – це добре!"
Lviv Startup Club
 
Auto Layout
Auto LayoutAuto Layout
Auto Layout
Julian Król
 
Migrating Objective-C to Swift
Migrating Objective-C to SwiftMigrating Objective-C to Swift
Migrating Objective-C to Swift
Elmar Kretzer
 
iOSインタラクションデザイン
iOSインタラクションデザインiOSインタラクションデザイン
iOSインタラクションデザイン
hIDDENxv
 
[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern
NAVER Engineering
 
CocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIViewCocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads France
 
iOS Layout Overview
iOS Layout OverviewiOS Layout Overview
iOS Layout Overview
Make School
 
Chainable datasource
Chainable datasourceChainable datasource
Chainable datasource
CocoaHeads France
 
Introduction to auto layout
Introduction to auto layoutIntroduction to auto layout
Introduction to auto layout
Ciklum Ukraine
 

Similar to Opening iOS App 開發者交流會 (20)

004
004004
004
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder Behind
 
iOS UI Debugging
iOS UI DebuggingiOS UI Debugging
iOS UI Debugging
 
Autolayout
AutolayoutAutolayout
Autolayout
 
Autolayout
AutolayoutAutolayout
Autolayout
 
IOS APPs Revision
IOS APPs RevisionIOS APPs Revision
IOS APPs Revision
 
Макс Грибов — Использование SpriteKit в неигровых приложениях
Макс Грибов — Использование SpriteKit в неигровых приложенияхМакс Грибов — Использование SpriteKit в неигровых приложениях
Макс Грибов — Использование SpriteKit в неигровых приложениях
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
Standford 2015 week3: Objective-C Compatibility, Property List, Views
Standford 2015 week3: Objective-C Compatibility, Property List, ViewsStandford 2015 week3: Objective-C Compatibility, Property List, Views
Standford 2015 week3: Objective-C Compatibility, Property List, Views
 
Lviv MD Day 2015 Костянтин Бичков "iOS Autolayouts – це добре!"
Lviv MD Day 2015 Костянтин Бичков "iOS Autolayouts – це добре!"Lviv MD Day 2015 Костянтин Бичков "iOS Autolayouts – це добре!"
Lviv MD Day 2015 Костянтин Бичков "iOS Autolayouts – це добре!"
 
Auto Layout
Auto LayoutAuto Layout
Auto Layout
 
Migrating Objective-C to Swift
Migrating Objective-C to SwiftMigrating Objective-C to Swift
Migrating Objective-C to Swift
 
I os 11
I os 11I os 11
I os 11
 
react.pdf
react.pdfreact.pdf
react.pdf
 
iOSインタラクションデザイン
iOSインタラクションデザインiOSインタラクションデザイン
iOSインタラクションデザイン
 
[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern
 
CocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIViewCocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIView
 
iOS Layout Overview
iOS Layout OverviewiOS Layout Overview
iOS Layout Overview
 
Chainable datasource
Chainable datasourceChainable datasource
Chainable datasource
 
Introduction to auto layout
Introduction to auto layoutIntroduction to auto layout
Introduction to auto layout
 

More from Michael Pan

Activity
ActivityActivity
Activity
Michael Pan
 
Shootting Game
Shootting GameShootting Game
Shootting Game
Michael Pan
 
Introduction to Android Studio
Introduction to Android StudioIntroduction to Android Studio
Introduction to Android Studio
Michael Pan
 
Eclipse and Genymotion
Eclipse and GenymotionEclipse and Genymotion
Eclipse and Genymotion
Michael Pan
 
Google maps SDK for iOS 1.4
Google maps SDK for iOS 1.4Google maps SDK for iOS 1.4
Google maps SDK for iOS 1.4Michael Pan
 
Objc under the_hood_2013
Objc under the_hood_2013Objc under the_hood_2013
Objc under the_hood_2013Michael Pan
 
Prototype by Xcode
Prototype by XcodePrototype by Xcode
Prototype by Xcode
Michael Pan
 
Nimbus
NimbusNimbus
Nimbus
Michael Pan
 
Superstar dj pdf
Superstar dj pdfSuperstar dj pdf
Superstar dj pdf
Michael Pan
 
Appsgaga - iOS Game Developer
Appsgaga - iOS Game DeveloperAppsgaga - iOS Game Developer
Appsgaga - iOS Game DeveloperMichael Pan
 
GZFox Inc. Jacky
GZFox Inc. JackyGZFox Inc. Jacky
GZFox Inc. JackyMichael Pan
 
創投公司 hoku_20121017
創投公司 hoku_20121017創投公司 hoku_20121017
創投公司 hoku_20121017Michael Pan
 

More from Michael Pan (14)

Activity
ActivityActivity
Activity
 
Shootting Game
Shootting GameShootting Game
Shootting Game
 
Introduction to Android Studio
Introduction to Android StudioIntroduction to Android Studio
Introduction to Android Studio
 
Eclipse and Genymotion
Eclipse and GenymotionEclipse and Genymotion
Eclipse and Genymotion
 
Note something
Note somethingNote something
Note something
 
Google maps SDK for iOS 1.4
Google maps SDK for iOS 1.4Google maps SDK for iOS 1.4
Google maps SDK for iOS 1.4
 
Objc under the_hood_2013
Objc under the_hood_2013Objc under the_hood_2013
Objc under the_hood_2013
 
Prototype by Xcode
Prototype by XcodePrototype by Xcode
Prototype by Xcode
 
Nimbus
NimbusNimbus
Nimbus
 
Superstar dj pdf
Superstar dj pdfSuperstar dj pdf
Superstar dj pdf
 
ADB - Arthur
ADB - ArthurADB - Arthur
ADB - Arthur
 
Appsgaga - iOS Game Developer
Appsgaga - iOS Game DeveloperAppsgaga - iOS Game Developer
Appsgaga - iOS Game Developer
 
GZFox Inc. Jacky
GZFox Inc. JackyGZFox Inc. Jacky
GZFox Inc. Jacky
 
創投公司 hoku_20121017
創投公司 hoku_20121017創投公司 hoku_20121017
創投公司 hoku_20121017
 

Recently uploaded

GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 

Recently uploaded (20)

GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 

Opening iOS App 開發者交流會

  • 1. Good to see you Michael
  • 2. Over 365 million iOS Devices 80% is iOS 5
  • 3. Most used programming language 2012 Position Language 1 C 2 Java 3 Objective-C http://bit.ly/JnA6fh
  • 4. Objective-C % 9.00 6.75 4.50 2.25 0 2007 2008 2009 2010 2011 2012
  • 5. Strange in iOS SDK 6 Support iOS 5 runtime
  • 7. How about Auto Layout Disable it NSLayoutConstraint not supported in iOS 5
  • 8. Facebook API Don’t use 3.1 3.1 Use 3.0 or Deprecated ones Accounts only on iOS 6
  • 10. Unwind Segue Motivation We want this
  • 11. Need some codes and Exit -
  • 12. Codes -(IBAction) dismissNext:(UIStoryboardSegue *)segue{ [self dismissViewControllerAnimated:YES completion:^{ NSLog(@"dismissed"); }]; }
  • 13. Codes - where ? -(IBAction) dismissNext:(UIStoryboardSegue *)segue; GLViewController GLPage2ViewController
  • 14. Codes - in the source direction of segue -(IBAction) dismissNext:(UIStoryboardSegue *)segue{ [self dismissViewControllerAnimated:YES completion:^{ NSLog(@"dismissed"); }]; } GLViewController
  • 15. Drag & Drop GLPage2ViewController
  • 16. Running on iOS 5 Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UIStoryboardUnwindSegueTemplate'
  • 18. More
  • 20. Small but important -shouldAutorotateToInterfaceOrientation:
  • 21. Small but important -shouldAutorotateToInterfaceOrientation: shouldAutorotate supportedInterfaceOrientations
  • 22. Example - 只支援水平導向 -(BOOL) shouldAutorotate{ return YES; } -(NSUInteger)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskLandscape; } in UIViewController
  • 23. UIInterfaceOrientationMask typedef enum { UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait), UIInterfaceOrientationMaskLandscapeLeft = (1 << UIInterfaceOrientationLandscapeLeft), UIInterfaceOrientationMaskLandscapeRight = (1 << UIInterfaceOrientationLandscapeRight), UIInterfaceOrientationMaskPortraitUpsideDown = (1 << UIInterfaceOrientationPortraitUpsideDown), UIInterfaceOrientationMaskLandscape = (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight), UIInterfaceOrientationMaskAll = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown), UIInterfaceOrientationMaskAllButUpsideDown = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight), } UIInterfaceOrientationMask;
  • 24. Layout notice 當 View Controller 被整頁性的 View Controller (如 presentViewController:animated:completion: )蓋住時,被蓋住的 View Controller 中的 willRotateToInterfaceOrientation:duration:, willAnimateRotationToInterfaceOrientation:duration: 和 didRotateFromInterfaceOrientation: 不會被呼叫。 善用 viewWillLayoutSubviews
  • 25. Landscape - only App invoke a portrait-only view controller (such as the Game Center login screen) Crash
  • 26. Add protocol method in AppDelegate.m - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{ return UIInterfaceOrientationMaskAllButUpsideDown; }
  • 29. Why auto layout ? 768 320 480 Phone 1024 Pad 320 568 iPhone 5 ?
  • 30. Why auto layout - Localization Hello こんにちは English Japanese
  • 31. Why auto layout - Example Hello こんにちは English Japanese
  • 32. What is Constraint 200 20 60 60
  • 33. What is Constraint - code NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:button1 attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTrailing multiplier:1.0f constant:-60.0f]; [self.view addConstraint:constraint]; button1.trainling = self.view.trainling*1.0-60 60
  • 34. Enable Auto Layout button1.translatesAutoresizingMaskIntoConstraints = NO;
  • 35. What is Constraint - more 1 button1.leading = self.view.leading*1.0+60 2 button1.trainling = self.view.trainling*1.0-60 4 3 200 button1.bottom = self.view.bottom*1.0-20 4 button1.width = nil*1.0+200 20 3 1 60 60 2
  • 36. What is Constraint - more and code
  • 37. What is Constraint - more and code
  • 38. Visual Format 4 200 V:[button1]-(20)-| 20 |-(60)-[button1(200)]-(60)-| 3 1 60 60 2
  • 39. Visual Format - Code -(void) virtualForm{ NSDictionary * bindingDict = NSDictionaryOfVariableBindings(button1); NSArray * constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"|-(60)-[button1(200)]-(60)-|" options: 0 metrics:nil views:bindingDict]; [self.view addConstraints:constraints]; constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[button1]-(20)-|" options:0 metrics:nil views:bindingDict]; [self.view addConstraints:constraints]; }
  • 40. What is Constraint - Landscape unable to satisfy all constraints 200 200 20 20 60 60 60 60
  • 41. Unable to simultaneously satisfy constraints. ( "<NSAutoresizingMaskLayoutConstraint:0x74563f0 h=--& v=--& V: [UIView:0x743d0d0(480)]>", "<NSLayoutConstraint:0x744a310 H:[UIRoundedRectButton: 0x743c350(200)]>", "<NSLayoutConstraint:0x744a500 H:|-(60)-[UIRoundedRectButton: 0x743c350] (Names: '|':UIView:0x743d0d0 )>", "<NSLayoutConstraint:0x744a370 H:[UIRoundedRectButton:0x743c350]- (60)-| (Names: '|':UIView:0x743d0d0 )>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x744a370 H:[UIRoundedRectButton:0x743c350]-(60)-| (Names: '|':UIView:0x743d0d0 )> Break on objc_exception_throw to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
  • 42. Visual Format - Not Equal -(void) virtualForm{ NSDictionary * bindingDict = NSDictionaryOfVariableBindings(button1); NSArray * constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"|-(>=60)-[button1(200)]-(>=60)-|" options:0 metrics:nil views:bindingDict]; [self.view addConstraints:constraints]; constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[button1]-(20)-|" options:0 metrics:nil views:bindingDict]; [self.view addConstraints:constraints]; }
  • 44. AMBIGUOUS LAYOUT - Detect @interface UIWindow (AutoLayoutDebug) + (UIWindow *)keyWindow; - (NSString *)_autolayoutTrace; @end private method for debug @implementation GLViewController -(void) viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; NSLog(@"%@", [[UIWindow keyWindow] _autolayoutTrace]); } - (void)didRotateFromInterfaceOrientation: (UIInterfaceOrientation)fromInterfaceOrientation { [super didRotateFromInterfaceOrientation: fromInterfaceOrientation]; NSLog(@"%@", [[UIWindow keyWindow] _autolayoutTrace]); } @end
  • 45. AMBIGUOUS LAYOUT - Console *<UIWindow:0x7198500> | *<UIView:0x719b040> | | *<UIView:0x719ae10> | | *<UIRoundedRectButton:0x719ab40> | | | <UIGroupTableViewCellBackground:0x719bfb0> | | | <UIImageView:0x719c850> | | | <UIButtonLabel:0x719db30> *<UIWindow:0x7198500> | *<UIView:0x719b040> | | *<UIView:0x719ae10> | | *<UIRoundedRectButton:0x719ab40> - AMBIGUOUS LAYOUT | | | <UIGroupTableViewCellBackground:0x719bfb0> | | | <UIImageView:0x719c850> | | | <UIButtonLabel:0x719db30>
  • 46. Exercise AMBIGUOUS [button1 addTarget:button1 action:@selector(exerciseAmbiguityInLayout) forControlEvents:UIControlEventTouchUpInside];
  • 47. Add Center X NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:button1 attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0]; [self.view addConstraint:constraint];
  • 48. It works, But... 樣好像比較順眼 Some one with the force 200 300
  • 49. Virtual Format - Try |-(>=60)-[button1(200)]-(>=60)-| |-(>=60)-[button1(300)]-(>=60)-| 60 300
  • 50. Virtual Format - Priority -(void) virtualForm{ NSDictionary * bindingDict = NSDictionaryOfVariableBindings(button1); NSArray * constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"|-(60)-[button1(300@999)]-(60)-|" options:0 metrics:nil views:bindingDict]; [self.view addConstraints:constraints]; constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[button1]-(20)-|" options:0 metrics:nil views:bindingDict]; [self.view addConstraints:constraints]; } Priority 1000 means required, and default is 1000
  • 51. Great Demo - AutoConstraintDemo

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n