SlideShare a Scribd company logo
iPhone SDK




http://kishikawakatsumi.com

Twitter
@k_katsumi

24/7 twenty-four seven
http://d.hatena.ne.jp/KishikawaKatsumi/
iPhone SDK



•     touch   •MyWebClip
•LDR touch    •
•             •      on the WEB
•LCD Clock    •i-Radio
•Subway Map   •
iPhone SDK

http://github.com/kishikawakatsumi

•hatena-touch     •DescriptionBuilder
•ldr-touch        •TiledLayerView
•tv-listings      •UICCalendarPicker
•MapKit-Route-Directions
•FlipCardNavigationView
•PhotoFlipCardView
iPhone SDK
iPhone SDK


 UIViewController
iPhone SDK
iPhone SDK
iPhone SDK
iPhone SDK


•iOS View Controller
•Cocoa
iPhone SDK


 UIViewController
iPhone SDK


  Interface Builder
iPhone SDK


     Apple
iPhone SDK
#import <UIKit/UIKit.h>
#import "MyLabel.h"
#import "MyButton.h"

@interface SecondViewController : UIViewController {
    MyLabel *label;
    MyButton *button;
}

@property (nonatomic, retain) IBOutlet MyLabel *label;
@property (nonatomic, retain) IBOutlet MyButto *button;

- (IBAction)buttonPushed:(id)sender;

@end
iPhone SDK
@synthesize label;
@synthesize button;

- (void)dealloc {
    self.label = nil;
    self.button = nil;
    [super dealloc];
}
iPhone SDK
iPhone SDK
#import <UIKit/UIKit.h>
#import "MyLabel.h"
#import "MyButton.h"

@interface SecondViewController : UIViewController {
    IBOutlet MyLabel *label;
    IBOutlet MyButton *button;
}

- (IBAction)buttonPushed:(id)sender;

@end
iPhone SDK
- (void)dealloc {
    [label release];
    [button release];
    [super dealloc];
}
iPhone SDK


•
    setter
setter
•setter
                 retain
iPhone SDK


  Interface Builder
iPhone SDK
#import <UIKit/UIKit.h>
#import "MyLabel.h"
#import "MyButton.h"

@interface SecondViewController : UIViewController {
    MyLabel *label;
    MyButton *button;
}

- (void)buttonPushed:(id)sender;

@end
iPhone SDK
- (void)dealloc {
    [super dealloc];
}
iPhone SDK


  Interface Builder
iPhone SDK

  Interface Builder
iPhone SDK
iPhone SDK
#import <UIKit/UIKit.h>
#import "MyLabel.h"
#import "MyButton.h"

@interface SecondViewController : UIViewController {
    MyLabel *label;
    MyButton *button;
}

@property (nonatomic, retain) MyLabel *label;
@property (nonatomic, retain) MyButton *button;

- (void)buttonPushed:(id)sender;

@end
iPhone SDK
- (void)dealloc {
    self.label = nil;
    self.button = nil;
    [super dealloc];
}
iPhone SDK




self.propertyName = nil;
               OK
iPhone SDK
- (void)dealloc {
    self.label = nil;
    self.button = nil;
    [super dealloc];
}
iPhone SDK
- (void)dealloc {
    [label release]; label = nil;
    [button release]; button = nil;
    [super dealloc];
}
iPhone SDK
iPhone SDK
@interface SecondViewController() {
    MyLabel *label;
    MyButton *button;
}

@property (nonatomic, retain) MyLabel *label;
@property (nonatomic, retain) MyButto *button;
@end

@implementation SecondViewController
...
iPhone SDK


iPhone
iPhone SDK
iPhone SDK

nib                                            nib
(Mac OS X                 iPhone           )


            Objective-C




@property (attributes) IBOutlet UserInterfaceElementClass *anOutlet;




                                   Cocoa
iPhone SDK
                                                (   Mac OS X         (44
        )           iPhone   (45    )     )
■

   Mac OS X
@property (assign) IBOutlet UserInterfaceElementClass *anOutlet;
■

   iPhone OS X
@property (nonatomic, retain) Outlet UIUserInterfaceElementClass *anOutlet;



        (iPhone OS       )dealloc




                                        Cocoa
iPhone SDK
nib                                     1
                                       UIKit setValue:forKey:
                                                          setter
                      setter
             (                 (43      )
  )


loadNibNamed:owner:options:




                               Cocoa
iPhone SDK
nib                                     1
                                       UIKit setValue:forKey:
                                                          setter
                      setter
             (                 (43      )
  )


loadNibNamed:owner:options:




                               Cocoa
iPhone SDK
View Controller              (didReceiveMemoryWarning)


  1        View Controller
                             (didReceiveMemoryWarning               UIViewController
  [self setView:nil]                 )
          nib                                                   (                (43
      )         )


                                                     didReceiveMemoryWarning




                                         Cocoa
iPhone SDK
                                                                View Controller
setView:
- (void)setView:(UIView *)aView {
    if (!aView) { //        nil
         //                     nil
         self.anOutlet = nil;
    }
    //
    [super setView:aView];
}
                                                           UIViewController       (
                       )setView:                          dealloc
                                        dealloc       self.anOutlet = nil
                                    View Controller             dealloc




                                         Cocoa
iPhone SDK
- (void)viewDidUnload {

    self.anOutlet = nil;

    [super viewDidUnload];

}




                    Cocoa
+ (void)initialize {
    sectionIndexTitles =


              iPhone SDK
     [[NSArray arrayWithObjects:@"1-10", @"11-100", @"101-400", nil] retain];
}

- (id)init {
    if (self = [super init]) {
        self.pageURL = @"http://www.yahoo.co.jp";

        operationQueue = [[NSOperationQueue alloc] init];
        [operationQueue setMaxConcurrentOperationCount:1];

        [NSFetchedResultsController deleteCacheWithName:nil];
    }
    return self;
}

- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    self.pageURL = nil;
    [operationQueue release];
    [super dealloc];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (void)viewDidUnload {
    [super viewDidUnload];
   [[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)loadView {
    UIView *contentView =
     [[UIView alloc] initWithFrame:
           iPhone SDK
       CGRectMake(0.0f, 0.0f, 320.0f, 367.0f)];
    contentView.backgroundColor = [UIColor blackColor];
    self.view = contentView;
    [contentView release];

    UIImageView *background =
     [[UIImageView alloc] initWithImage:[UIImage
imageNamed:@"search_bg.png"]];
    [contentView addSubview:background];
    [background release];

    searchBar = [[UISearchBar alloc] initWithFrame:
                  CGRectMake(0.0f, 0.0f, 320.0f, 44.0f)];
    searchBar.delegate = self;
    searchBar.showsScopeBar = YES;
    [[searchBar.subviews objectAtIndex:0]
      performSelector:@selector(setBackgroundImage:)
           withObject:[UIImage imageNamed:@"searchbar_bg.png"]];
    [contentView addSubview:searchBar];
    [searchBar release];
}
- (void)viewDidLoad {

            iPhone SDK
    [super viewDidLoad];
    self.title = NSLocalizedString(@"AppName", nil);

    UIBarButtonItem *backBarButtonItem =
     [[UIBarButtonItem alloc] initWithImage:
       [UIImage imageNamed:@"arrow_left_small.png"]
                                      style:UIBarButtonItemStyleBordered
                                     target:nil
                                     action:nil];
    [self.navigationItem setBackBarButtonItem:backBarButtonItem];
    [backBarButtonItem release];

   if (&UIApplicationDidEnterBackgroundNotification) {
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:
          @selector(applicationDidEnterBackground:)
                                                     name:
          UIApplicationDidEnterBackgroundNotification object:nil];
    }
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector
(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector
(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}
iPhone SDK
iPhone SDK
 init


              loadView
                            viewWillAppear:
                               animated:
             viewDidLoad
                            viewDidAppear:
                               animated:

                            viewWillDisappe
                              ar:animated:
            didReceiveMem
              oryWarning    viewDidDisappe
                              ar:animated:
            viewDidUnload


dealloc
iPhone SDK
initWithNibName:

                    viewDidLoad
                                   viewWillAppear:
                                      animated:

                                   viewDidAppear:
                                      animated:

                                   viewWillDisappe
                                     ar:animated:
                   didReceiveMem
                     oryWarning    viewDidDisappe
                                     ar:animated:
                   viewDidUnload


    dealloc
iPhone SDK
 init


              loadView
                            viewWillAppear:
                               animated:
             viewDidLoad
                            viewDidAppear:
                               animated:

                            viewWillDisappe
                              ar:animated:
            didReceiveMem
              oryWarning    viewDidDisappe
                              ar:animated:
            viewDidUnload


dealloc
iPhone SDK
initWithNibName:

                    viewDidLoad
                                   viewWillAppear:
                                      animated:

                                   viewDidAppear:
                                      animated:

                                   viewWillDisappe
                                     ar:animated:
                   didReceiveMem
                     oryWarning    viewDidDisappe
                                     ar:animated:
                   viewDidUnload


    dealloc
iPhone SDK


    loadView
- (void)loadView {
    UIView *contentView =
     [[UIView alloc] initWithFrame:
           iPhone SDK
       CGRectMake(0.0f, 0.0f, 320.0f, 367.0f)];
    contentView.backgroundColor = [UIColor blackColor];
    self.view = contentView;
    [contentView release];

    UIImageView *background =
     [[UIImageView alloc] initWithImage:[UIImage
imageNamed:@"search_bg.png"]];
    [contentView addSubview:background];
    [background release];

    searchBar = [[UISearchBar alloc] initWithFrame:
                  CGRectMake(0.0f, 0.0f, 320.0f, 44.0f)];
    searchBar.delegate = self;
    searchBar.showsScopeBar = YES;
    [[searchBar.subviews objectAtIndex:0]
      performSelector:@selector(setBackgroundImage:)
           withObject:[UIImage imageNamed:@"searchbar_bg.png"]];
    [contentView addSubview:searchBar];
    [searchBar release];
}
iPhone SDK

   viewDidLoad
- (void)viewDidLoad {
           iPhone SDK
    [super viewDidLoad];

    self.managedObjectContext =
     [[[UIApplication sharedApplication] delegate]
        managedObjectContext];
    self.store =
     [[[UIApplication sharedApplication] delegate] store];

    self.searchController =
     [[[UISearchDisplayController alloc] initWithSearchBar:searchBar
                                        contentsController:self]
      autorelease];
    searchController.delegate = self;
    searchController.searchResultsDelegate = self;
    searchController.searchResultsDataSource = self;
    searchController.searchResultsTableView.hidden = YES;
}
iPhone SDK
[initWithNibName:bundle:];
[viewDidLoad];

[viewWillAppear:];
[viewDidAppear:];
[viewWillDisappear:];
[viewDidDisappear:];

[viewWillAppear:];
[viewDidAppear:];
[viewWillDisappear:];
[viewDidDisappear:];

[dealloc];
iPhone SDK

[init];
[loadView];
[viewDidLoad];

[viewWillAppear:];
[viewDidAppear:];

[didReceiveMemoryWarning];
iPhone SDK

[init];
[loadView];
[viewDidLoad];

[viewWillAppear:];
[viewDidAppear:];

[didReceiveMemoryWarning];
[init];
        iPhone SDK
[loadView];
[viewDidLoad];

[viewWillAppear:];
[viewDidAppear:];
[viewWillDisappear:];
[viewDidDisappear:];

[didReceiveMemoryWarning];
[viewDidUnload];

[loadView];
[viewDidLoad];

[viewWillAppear:];
[viewDidAppear:];
iPhone SDK
[init];
[loadView];
[viewDidLoad];

[viewWillAppear:];
[viewDidAppear:];
[viewWillDisappear:];
[viewDidDisappear:];

[didReceiveMemoryWarning];
[viewDidUnload];

[loadView];
[viewDidLoad];

[viewWillAppear:];
[viewDidAppear:];
iPhone SDK
[init];
[loadView];
[viewDidLoad];

[viewWillAppear:];
[viewDidAppear:];
[viewWillDisappear:];
[viewDidDisappear:];

[didReceiveMemoryWarning];
[viewDidUnload];

[dealloc];
iPhone SDK

[init];
[loadView];
[viewDidLoad];

[viewWillAppear:];
[viewDidAppear:];
[viewWillDisappear:];
[viewDidDisappear:];

[didReceiveMemoryWarning];
[viewDidUnload];

[dealloc];
iPhone SDK


       CornerCase:
viewXXXAppear:
iPhone SDK



[init];
[loadView];
[viewDidLoad];

[dealloc];
iPhone SDK
   [view addSubview:viewController.view];




[init];
[loadView];
[viewDidLoad];

[dealloc];
iPhone SDK

UINavigationConroller
[pushViewController:animated:];
[popViewControllerAnimated:];
[popToViewController:animated:];

UITabBarController
[setSelectedIndex:];

UIViewConroller
[presentModalViewController:animated:];
dismissModalViewControllerAnimated:];

UIPopoverConroller
iPhone SDK
- (void)pushViewController:(UIViewController *)viewController
                  animated:(BOOL)animated {
    UIView *contentView = viewController.view;

    if (animated) {
        [UIView beginAnimations:nil context:NULL];
        ...
    }

    [viewController viewWillAppear:animated];

    [self.view addSubview:contentView];

    [viewController viewDidAppear:animated];

    ...
}
iPhone SDK
iPhone SDK
iPhone SDK

       CornerCase:
popViewControllerAnimated:
iPhone SDK

      CornerCase:
UIWebView
iPhone SDK
iPhone SDK

    CornerCase:
iPhone SDK
iPhone SDK




       UITextView
   UIControl
 UITextField, UISwitch
iPhone SDK

         CornerCase:
iPhone 4   iPhone 3GS
iPhone SDK

    CornerCase:
iPhone SDK
iPhone SDK
- (void)diaryUploader:(DiaryUploader *)uploader uploadFailed:(NSError *)
error {
    if (error) {
        alert = [[UIAlertView alloc]
                  initWithTitle:NSLocalizedString(@"AppName", nil)
                        message:
                  [NSString stringWithFormat:@"%@",
                   [error localizedDescription]]
                       delegate:self
              cancelButtonTitle:nil
              otherButtonTitles:NSLocalizedString(@"OK", nil), nil];
        [alert show];
        [alert release];
    }
}
iPhone SDK
- (void)viewDidLoad {
    [super viewDidLoad];

    if (&UIApplicationDidEnterBackgroundNotification) {
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:
          @selector(applicationDidEnterBackground:)
                                                     name:
          UIApplicationDidEnterBackgroundNotification object:nil];
    }
}
- (void)alertView:(UIAlertView *)alertView
         iPhone SDK
didDismissWithButtonIndex:(NSInteger)buttonIndex {
    alert = nil;
}

- (void)applicationDidEnterBackground:
(NSNotification *)note {
    [alert dismissWithClickedButtonIndex:0
                                animated:NO];
    alert = nil;

    if (self.modalViewController) {
        [self.modalViewController
         dismissModalViewControllerAnimated:NO];
    }
}
iPhone SDK

    CornerCase:

More Related Content

PDF
Android App development and test environment, Understaing android app structure
PDF
Android studio
PDF
Code driven development: using Features effectively in Drupal 6 and 7
PPT
Getting started with android dev and test perspective
PDF
Building an app with Google's new suites
PDF
The Glass Class - Tutorial 3 - Android and GDK
PDF
What's new in android 4.4 - Romain Guy & Chet Haase
PDF
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Android App development and test environment, Understaing android app structure
Android studio
Code driven development: using Features effectively in Drupal 6 and 7
Getting started with android dev and test perspective
Building an app with Google's new suites
The Glass Class - Tutorial 3 - Android and GDK
What's new in android 4.4 - Romain Guy & Chet Haase
Jetpack, with new features in 2021 GDG Georgetown IO Extended

What's hot (20)

PPTX
Titanium Studio [Updated - 18/12/2011]
KEY
L0020 - The Basic RCP Application
PDF
Standford 2015 week5: 1.View Controller Lifecycle, Autolayout 2. Scroll View ...
PPT
Ios - Introduction to platform & SDK
PPTX
Google Plus SignIn : l'Authentification Google
PDF
Apps development for Recon HUDs
PDF
Implementing Data Visualization Apps on iOS Devices
PDF
Mobile Application Development with JUCE and Native API’s
KEY
L0036 - Creating Views and Editors
PDF
Pavlo Zhdanov "Java and Swift: How to Create Applications for Automotive Head...
PPT
Eclipse Training - Standard Extension Points and APIs
PDF
Baruco 2014 - Rubymotion Workshop
KEY
Android app development basics
PDF
Capture image on eye blink
KEY
L0018 - SWT - The Standard Widget Toolkit
PDF
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
PDF
Efficient Image Processing - Nicolas Roard
PPTX
Extend sdk
PPTX
Mobile Worshop Lab guide
PPTX
How to Build & Develop Responsive Open Learning Environments with the ROLE SDK
Titanium Studio [Updated - 18/12/2011]
L0020 - The Basic RCP Application
Standford 2015 week5: 1.View Controller Lifecycle, Autolayout 2. Scroll View ...
Ios - Introduction to platform & SDK
Google Plus SignIn : l'Authentification Google
Apps development for Recon HUDs
Implementing Data Visualization Apps on iOS Devices
Mobile Application Development with JUCE and Native API’s
L0036 - Creating Views and Editors
Pavlo Zhdanov "Java and Swift: How to Create Applications for Automotive Head...
Eclipse Training - Standard Extension Points and APIs
Baruco 2014 - Rubymotion Workshop
Android app development basics
Capture image on eye blink
L0018 - SWT - The Standard Widget Toolkit
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
Efficient Image Processing - Nicolas Roard
Extend sdk
Mobile Worshop Lab guide
How to Build & Develop Responsive Open Learning Environments with the ROLE SDK
Ad

Similar to UIViewControllerのコーナーケース (20)

KEY
PhotoFlipCardView
PDF
Quick Start to iOS Development
KEY
I phone勉強会 (2011.11.23)
PDF
iPhone SDK dev sharing - the very basics
PDF
Leaving Interface Builder Behind
KEY
漫游iOS开发指南
PPTX
Custom cell in objective c
PDF
React Native for multi-platform mobile applications
KEY
Iphone os dev sharing with new examples
PDF
Iphone course 3
PPTX
New to native? Getting Started With iOS Development
PDF
Embed SwiftUI in React Native: Boost iOS Performance & UX Seamlessly
PDF
Practicing AppDevKit in kata training
PPTX
Hello world ios v1
PDF
How To Build iOS Apps Without interface Builder
PPTX
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
PDF
I os 11
PDF
iOS_Presentation
PDF
iOS overview
PhotoFlipCardView
Quick Start to iOS Development
I phone勉強会 (2011.11.23)
iPhone SDK dev sharing - the very basics
Leaving Interface Builder Behind
漫游iOS开发指南
Custom cell in objective c
React Native for multi-platform mobile applications
Iphone os dev sharing with new examples
Iphone course 3
New to native? Getting Started With iOS Development
Embed SwiftUI in React Native: Boost iOS Performance & UX Seamlessly
Practicing AppDevKit in kata training
Hello world ios v1
How To Build iOS Apps Without interface Builder
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
I os 11
iOS_Presentation
iOS overview
Ad

UIViewControllerのコーナーケース