SlideShare una empresa de Scribd logo
1 de 101
Class 10
iOS 應⽤用軟體設計
內容⼤大綱
•   ViewController
•   UIApplication, Window,Views,ViewControllers
•   UINavigationController
    •   QV031:逐步完成導覽列控制器
    •   Samples:NavBar
•   TabbarController
    •   QV033:Tabbar Controller 標籤列
•   UIToolbar 使⽤用及轉場動畫
    •   QV039:使⽤用根控制器,切換畫⾯面
    •   QV040:畫⾯面切換的動畫
•   多⾴頁⾯面處理
View Controller
View Controllers
Window,Views,ViewControllers

•   Window
    •   Every application has at least one window
    •   Blank canvas to host views
•   View
    •   Draw and animate content
    •   Layout subviews
    •   Receive and forward events
•   View Controller
    •   Manages a self-contained view hierarchy
UIApplication

• Set up main run loop
• Manages event queue
• Custom behavior through delegation
 • UIApplicationDelegation
View Controllers
•   Every screen should have its own controller
•   UIViewController implements much of the iOS
    standard interface behavior
    •   Loading nib file
    •   Working with navigation, tab, and tool bars
    •   Composing multiple view controllers
    •   Handling events and memory warnings
    •   Managing interface orientation change
A window with its target
screen and content views
A view controller attached to a
window automatically adds its view
         of the window
View Management Cycle
View Management Cycle
View Controller Cycle
Interface Orientation
Type of View Controllers
•   Custom view controller
    •   Directly express content on the screen
•   Container view controller
    •   Manage other view controllers
    •   Usually does not express content directly
•   Modal view controller
    •   Any view controller can be presented modally
View controller
classes in UIkit
UINavigationController
Navigation controller
Objects managed by
navigation controller
Navigation stack
範例:

 逐步完成導覽列程式
Project QV031

 Navigation Controller
 導覽列控制器
 由⼀一個主畫⾯面,按鈕進⼊入
 各個⼦子畫⾯面
UINavigationController
 有多個畫⾯面時(很少只有⼀一個畫⾯面吧!)
 負責切換畫⾯面的程式
 切換畫⾯面時可以設定...有無動畫效果
 (⼦子畫⾯面會從螢幕右邊進⼊入)
 位於螢幕上⽅方,當切換到下個畫⾯面時,
 導覽列左上⾓角會出現『Back』
重要method

pushViewController: animated:
使⽤用此⽅方法加⼊入⼦子畫⾯面
(亦即切換到⼦子畫⾯面)
............
(回上⼀一⾴頁的 method 呢?)
範例
根畫⾯面內含兩個按鈕
按下後會顯⽰示各⾃自的畫⾯面
導覽列上有『回上⾴頁』,按下回到根畫⾯面

                 iPhone
               (Page1View)
  Apple產品
  (RootView)      iPad
               (Page2View)
練習步驟

步驟⼀一:設定導覽列控制器
步驟⼆二:新增畫⾯面,並置⼊入根畫⾯面
步驟三:增加⼦子畫⾯面
步驟四:顯⽰示細節修改 (編輯導覽列)
步驟 (⼀一):設定導覽列

新增專案選擇 ...
加⼊入 UINavigationController
於程式初始時 (AppDelegate),啟動導
覽列控制項
AppDelegate.h                                        (1) 注意是寫在AppDelegate.h 及
                                                         AppDelegate.m上
    @interface ViewController : UIViewController
    {
        UINavigationController *navController;       (2) 先加⼊入導覽列物件
    }
    @end
                                                      (3) 在App初始化時就加⼊入導覽列

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController"
bundle:nil];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];

      // 加⼊入導覽列物件
      navController = [[UINavigationController alloc] init];
      [self.window addSubview:navController.view];

      return YES;
}
執⾏行......
應該會看到上⽅方的導覽列
(Navigation)

接下來......
步驟 (⼆二):置⼊入根畫⾯面


新增畫⾯面 (view controller)
加⼊入根畫⾯面的物件及程式
把根畫⾯面置⼊入導覽列控制器
如有圖檔,記得將準備好
 的圖檔加⼊入到專案裡
增加檔案,選擇
UIViewController
(1) ⾃自訂類別名稱
    (2) 確認UIViewController
    (3) 勾選以產⽣生 .xib 檔案




 會產⽣生三個檔案

畫⾯面內容可⾃自⾏行設計
新增的 RootView 仍是在
AppDelegate.h                                                  AppDelegate 內引⽤用

  #import <UIKit/UIKit.h>

  #import "RootView.h"
                                      (1) 宣告 RootView
  @class ViewController;
  @interface AppDelegate : UIResponder <UIApplicationDelegate>
  {
      UINavigationController *navController;
  }


AppDelegate.m

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
  (NSDictionary *)launchOptions
  {
      // 部分程式省略
                                                                   (2) 加⼊入 RootView
      // 加⼊入導覽列物件
      navController = [[UINavigationController alloc] init];         並推⼊入導覽列
      [self.window addSubview:navController.view];

      // 宣告根畫⾯面物件,並將它加⼊入導覽列 (同時會顯⽰示出來)
      RootView *rootView = [[RootView alloc] init];
      [navController pushViewController:rootView animated:NO];

      return YES;
  }
執⾏行......
會直接看到根畫⾯面

接下來......
步驟 (三):增加⼦子畫⾯面

新增兩個⼦子畫⾯面物件
(Page1View 及 Page2View)
在根畫⾯面加⼊入兩個按鈕,並設定好事件
在按鈕事件中,將⼦子畫⾯面物件加⼊入到導
覽列控制器內。並顯⽰示⼦子畫⾯面
(1) 新增兩個⼦子畫⾯面類別


(2) 只需要在  .xib 內放置
 ImageView及圖⽚片即可
RootView.xib




               設置按鈕並連接到按下
               事件時要執⾏行的⽅方法
#import <UIKit/UIKit.h>
RootView.h
              #import "Page1View.h"
              #import "Page2View.h"
                                                       加⼊入兩個⼦子類別
              @interface RootView : UIViewController
              {
              }

              - (IBAction)goPage1:(id)sender;
              - (IBAction)goPage2:(id)sender;

              @end
                                                       將⼀一個⼦子畫⾯面類別
RootView.m   #import "RootView.h"
                                                          推⼊入導覽列中
             @implementation RootView
                                                                       有換場動畫
             -(IBAction)goPage1:(id)sender
             {
                 Page1View *page1 = [[Page1View alloc] init];
                 [self.navigationController pushViewController:page1 animated:YES];
             }

             -(IBAction)goPage2:(id)sender
             {
                 Page2View *page2 = [[Page2View alloc] init];
                 [self.navigationController pushViewController:page2 animated:YES];
             }
執⾏行......導覽列之功能完成




                    動畫移動
步驟 (四):顯⽰示細節修改

加⼊入每個畫⾯面中導覽列的標題
更改所有的倒退按鈕⽂文字
(注意:不是改⽂文字屬性就可以的...)
各畫⾯面有各⾃自的倒退按鈕⽂文字
其他導覽列的屬性
AppDelegate.m



- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // 部分程式省略

    // 加⼊入導覽列物件
    navController = [[UINavigationController alloc] init];
    [navController.navigationBar setTintColor:[UIColor redColor]];
    [self.window addSubview:navController.view];
    // 宣告根畫⾯面物件,並將它加⼊入導覽列 (同時會顯⽰示出來)
    RootView *rootView = [[RootView alloc] init];
    [navController pushViewController:rootView animated:NO];
    rootView.navigationItem.title = @"蘋果產品";

    return YES;
}
RootView.m



-(IBAction)goPage1:(id)sender
{
    Page1View *page1 = [[Page1View alloc] init];
    [self.navigationController pushViewController:page1 animated:YES];
    page1.navigationItem.title = @"iPhone";
}

-(IBAction)goPage2:(id)sender
{
    Page2View *page2 = [[Page2View alloc] init];
    [self.navigationController pushViewController:page2 animated:YES];
    page2.navigationItem.title = @"iPad";
}
預設是⽤用前⾴頁之標題
為倒退按鈕的⽂文字
AppDelegate.m


 - (BOOL)application:(UIApplication *)application
 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {
     // 部分程式省略
     // 加⼊入導覽列物件
     navController = [[UINavigationController alloc] init];
     [navController.navigationBar setTintColor:[UIColor redColor]];
     [self.window addSubview:navController.view];

     // 設定back的按鈕
     UIBarButtonItem *backButton = [[UIBarButtonItem alloc]
                    initWithTitle:@"回前⾴頁"
                            style:UIBarButtonItemStyleBordered
                           target:nil
                           action:nil];

     // 宣告根畫⾯面物件,並將它加⼊入導覽列 (同時會顯⽰示出來)
     RootView *rootView = [[RootView alloc] init];
     [navController pushViewController:rootView animated:NO];
     rootView.navigationItem.title = @"蘋果產品";
     rootView.navigationItem.backBarButtonItem = backButton;

     return YES;
 }
重新設定各畫⾯面
倒退按鈕的⽂文字
導覽列的顯⽰示
將導覽列隱藏起來
setNavigationBarHidden (YES/NO)
若設為隱藏,則必須⾃自⾏行增加回前畫⾯面的按鈕及程式
   popViewControllerAnimated:
   popToRootViewControllerAnimated:
   popToViewController: animated:
可以設定有無(導覽列出現)動畫效果
可以客製化導覽列內容
問題練習
若要在各個畫⾯面的倒退按鈕⽂文字都不
同,該如何處理?
           各畫⾯面可以各別
           設定倒退按鈕⽂文字
參考解答
                                                RootView.m


-(IBAction)goPage1:(id)sender
{
    Page1View *page1 = [[Page1View alloc] init];
    page1.navigationItem.title = @"iPhone";
    [self.navigationController pushViewController:page1 animated:YES];

    // 設定back的按鈕
    UIBarButtonItem *backButton = [[UIBarButtonItem alloc]
                     initWithTitle:@"Go Back"
                             style:UIBarButtonItemStyleBordered
                            target:nil
                            action:nil];

    self.navigationItem.backBarButtonItem = backButton;
}
範例觀摩:NavBar
Tab Bar Controller
Tab Bar Controller
範例練習:

     開啟新專案
 『Tabbed Application』
範例:

 Tab Bar 標籤列
Project QV033
TabBar Controller 標籤列
控制器
更多個標籤的View
將UITabBarController寫
在某個ViewController之後
TabBar各個項⺫⽬目的圖⽂文
說明

T Bar 控制器簡介
 ab
在某畫⾯面之後新增 T Bar Controller
           ab
增加 T Bar 切換畫⾯面
    ab
⾃自訂 T Bar 按鈕外觀
     ab
UITabBarController

位於螢幕下⽅方,通常有4~5個按鈕,按下
不同的按鈕,即切換到不同的畫⾯面
(ViewController)
將各個ViewController物件,以陣列
(NSArray) 形式做為參數,指定給
UITabBarController
預先準備好各畫⾯面
            注意此範例將UITabBarController 置於
            ViewController畫⾯面 (如要⼀一開始就出現,
            則可置於 AppDelegate 類別內
ViewController.h



#import <UIKit/UIKit.h>

@interface ViewController : UIViewController
{
    UITabBarController *tabBarController;
}

- (IBAction)showTabBar:(id)sender;

@end
ViewController.xib
#import   "ViewController.h"
#import   "Page1View.h"                            ViewController.m
#import   "Page2View.h"
#import   "Page3View.h"
#import   "Page4View.h"

@implementation ViewController                         (2)按鈕按下時
                                                          才顯⽰示出來
- (IBAction)showTabBar:(id)sender
{
    [self.view addSubview:tabBarController.view];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    Page1View *page1 = [[Page1View   alloc]   init];    (1)置⼊入標籤列
    Page2View *page2 = [[Page2View   alloc]   init];
    Page3View *page3 = [[Page3View   alloc]   init];
    Page4View *page4 = [[Page4View   alloc]   init];

    tabBarController = [[UITabBarController alloc] init];

    tabBarController.viewControllers = [NSArray arrayWithObjects:
                  page1, page2, page3, page4, nil];
}
加⼊入TabBarItem的圖⽂文
必須先新增 UITabBarItem 物件
指定⽂文字及圖⽚片,亦可使⽤用系統內建的
型式
將此 UITabBarItem 物件指定在各個
ViewController
(注意:不是在 UITabbarController 裡設定)
- (void)viewDidLoad
{
    [super viewDidLoad];                               ViewController.h
    Page1View *page1 = [[Page1View   alloc]   init];
    Page2View *page2 = [[Page2View   alloc]   init];
    Page3View *page3 = [[Page3View   alloc]   init];
    Page4View *page4 = [[Page4View   alloc]   init];

    tabBarController = [[UITabBarController alloc] init];
    tabBarController.viewControllers = [NSArray arrayWithObjects:
                                        page1, page2, page3, page4, nil];

    // 加⼊入TabBar項⺫⽬目的圖⽂文 (系統內建的)
    UITabBarItem *item1 = [[UITabBarItem alloc]
           initWithTabBarSystemItem:UITabBarSystemItemBookmarks tag:0];
    UITabBarItem *item2 = [[UITabBarItem alloc]
           initWithTabBarSystemItem:UITabBarSystemItemContacts tag:0];
    UITabBarItem *item3 = [[UITabBarItem alloc]
           initWithTabBarSystemItem:UITabBarSystemItemFeatured tag:0];
    UITabBarItem *item4 = [[UITabBarItem alloc]
           initWithTabBarSystemItem:UITabBarSystemItemFavorites tag:0];

    // 指定到各個ViewController物件 (注意:不是指定在UITabBarController)
    page1.tabBarItem = item1;
    page2.tabBarItem = item2;
    page3.tabBarItem = item3;
    page4.tabBarItem = item4;
}
系統內建的標籤項⺫⽬目

typedef enum {
    UITabBarSystemItemMore,
    UITabBarSystemItemFavorites,
    UITabBarSystemItemFeatured,
    UITabBarSystemItemTopRated,
    UITabBarSystemItemRecents,
    UITabBarSystemItemContacts,
    UITabBarSystemItemHistory,
    UITabBarSystemItemBookmarks,
    UITabBarSystemItemSearch,
    UITabBarSystemItemDownloads,
    UITabBarSystemItemMostRecent,
    UITabBarSystemItemMostViewed,
} UITabBarSystemItem;
⾃自訂標籤項⺫⽬目⽂文字

// ⾃自⾏行設定⽂文字 (無圖⽚片)
UITabBarItem *item1 =   [[UITabBarItem   alloc]   initWithTitle:@"藍⾊色"    image:nil   tag:0];
UITabBarItem *item2 =   [[UITabBarItem   alloc]   initWithTitle:@"綠⾊色"    image:nil   tag:0];
UITabBarItem *item3 =   [[UITabBarItem   alloc]   initWithTitle:@"紅⾊色"    image:nil   tag:0];
UITabBarItem *item4 =   [[UITabBarItem   alloc]   initWithTitle:@"⿈黃⾊色"   image:nil   tag:0];




 ⾃自訂標籤項⺫⽬目⽂文字及圖⽚片

 // ⾃自⾏行設定⽂文字及圖⽚片
 UITabBarItem *item1 = [[UITabBarItem alloc] initWithTitle:@"藍⾊色"
                     image:[UIImage imageNamed:@"Tab_B.png"] tag:0];
 UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:@"綠⾊色"
                     image:[UIImage imageNamed:@"Tab_G.png"] tag:0];
 UITabBarItem *item3 = [[UITabBarItem alloc] initWithTitle:@"紅⾊色"
                     image:[UIImage imageNamed:@"Tab_R.png"] tag:0];
 UITabBarItem *item4 = [[UITabBarItem alloc] initWithTitle:@"⿈黃⾊色"
                     image:[UIImage imageNamed:@"Tab_Y.png"] tag:0];
 ⾃自訂UITabBarItem的圖形

 灰階圖⽚片
 30x30 像素
 背景為透明
 存檔為『xxx.png』
 如需⽤用到 iPhone4 的⾼高解析度螢幕中
   60x60 像素
   存檔為『xxx@2x.png』
另⼀一種寫法:⾃自訂標籤項⺫⽬目⽂文字及圖⽚片


  // 指定到各個ViewController物件 (注意:不是指定在UITabBarController)
  /*
  page1.tabBarItem = item1;
  page2.tabBarItem = item2;
  page3.tabBarItem = item3;
                            此⽅方法不需要指定建⽴立UIT  abBarItem物件
  page4.tabBarItem = item4;
  */

  // 也可以⽤用另⼀一種⽅方式,直接指定各Viewcontroller的title屬性
  page1.title = [[NSString alloc] initWithFormat:@"藍⾊色"];
  page2.title = [[NSString alloc] initWithFormat:@"綠⾊色"];
  page3.title = [[NSString alloc] initWithFormat:@"紅⾊色"];
  page4.title = [[NSString alloc] initWithFormat:@"⿈黃⾊色"];

  page1.tabBarItem.image   =   [UIImage   imageNamed:@"Tab_B"];
  page2.tabBarItem.image   =   [UIImage   imageNamed:@"Tab_G"];
  page3.tabBarItem.image   =   [UIImage   imageNamed:@"Tab_R"];
  page4.tabBarItem.image   =   [UIImage   imageNamed:@"Tab_Y"];
問題:標籤列位置不對
                    理想結果




上⽅方會多出⼀一列,下⽅方會被截去
有建議將ViewController的狀態列
                                  設為無,但似乎無效!!!




                                                    必須增加這⼀一列程式


{
    [super viewDidLoad];

    self.wantsFullScreenLayout = YES;          // 避免TabBar往下偏移

    Page1View   *page1   =   [[Page1View   alloc]   init];
    Page2View   *page2   =   [[Page2View   alloc]   init];
    Page3View   *page3   =   [[Page3View   alloc]   init];
    Page4View   *page4   =   [[Page4View   alloc]   init];

    tabBarController = [[UITabBarController alloc] init];
    tabBarController.viewControllers = [NSArray arrayWithObjects:
                            page1, page2, page3, page4, nil];
問題:畫⾯面內容尺⼨寸不對
作業練習
如何解決之前畫⾯面尺⼨寸不對的問題?
超過五個以上的畫⾯面會如何?
做出兩組的 TabBar (似乎沒有意義)
奇怪的功能
UIToolbar 使⽤用及轉場動畫
Project QV039


透過根控制器,進⾏行畫⾯面
間的切換
UIToolbar的使⽤用
AppDelegate.h

   AppDelegate.m
                           BlueViewController.h

                           BlueViewController.m
SwitchViewController.h
                           BlueViewController.xib
SwitchViewController.m

SwitchViewController.xib




                           YellowViewController.h

                           YellowViewController.m

                           YellowViewController.xib
AppDelegate.h

#import <UIKit/UIKit.h>

@class SwitchViewController;

@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
    SwitchViewController *switchViewController;
}

@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, retain) IBOutlet SwitchViewController
*switchViewController;

@end


                           此處之 SwitchViewController 與
                           專案樣版 SingleView 的功能相同
AppDelegate.m
#import "AppDelegate.h"
#import "SwitchViewController.h"

@implementation AppDelegate

@synthesize window = _window;
@synthesize switchViewController;

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen]
bounds]];
    self.window.backgroundColor = [UIColor whiteColor];

    //[self.window addSubview:switchViewController.view]; // 不能使⽤用
    self.switchViewController = [[SwitchViewController alloc]
                    initWithNibName:@"SwitchViewController" bundle:nil];
    self.window.rootViewController = self.switchViewController;

    [self.window makeKeyAndVisible];
    return YES;
}
ViewController.h


#import <UIKit/UIKit.h>
@class BlueViewController;
@class YellowViewController;

@interface SwitchViewController : UIViewController
{
    BlueViewController *blueViewController;
    YellowViewController *yellowViewController;
}
@property (retain,nonatomic) BlueViewController *blueViewController;
@property (retain,nonatomic) YellowViewController *yellowViewController;

- (IBAction)switchViews:(id)sender;

@end
ViewController.xib
#import "SwitchViewController.h"
#import "BlueViewController.h"                ViewController.m (1/3)
#import "YellowViewController.h"

@implementation SwitchViewController
@synthesize blueViewController;
@synthesize yellowViewController;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle
*)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    blueViewController = [[BlueViewController alloc]
                    initWithNibName:@"BlueViewController" bundle:nil];
    [self.view insertSubview:blueViewController.view atIndex:0];
    // [super viewDidLoad];
}                                這裡不能⽤用addSubView,為什麼?
ViewController.m (2/3)
- (IBAction)switchViews:(id)sender
{
    if(self.yellowViewController.view.superview==nil)
    {
        if(self.yellowViewController==nil)
         {
             yellowViewController = [[YellowViewController alloc]
                    initWithNibName:@"YellowViewController" bundle:nil];
         }
         [blueViewController.view removeFromSuperview];
         [self.view insertSubview:yellowViewController.view atIndex:0];
    }
    else
    {
        if(self.blueViewController==nil)
         {
             blueViewController = [[BlueViewController alloc]
                      initWithNibName:@"BlueViewController" bundle:nil];
         }
         [yellowViewController.view removeFromSuperview];
         [self.view insertSubview:blueViewController.view atIndex:0];
    }
}
                       為何要這麼⿇麻煩!為何不⼀一開始就將藍⿈黃
                       兩個ViewController都叫出來再切換順序?
ViewController.m (3/3)




- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
    if(self.blueViewController.view.superview==nil)
        self.blueViewController = nil;
    else
        self.yellowViewController = nil;
}




             多個畫⾯面的程式中,記憶體管理變得更加重要
BlueViewController.xib
問題

ViewController.m 裡的問題......
   這裡不能⽤用addSubView,為什麼?
   (會把ViewController的 toolbar 蓋住)
   為何要這麼⿇麻煩!為何不⼀一開始就將藍⿈黃兩個
   ViewController都叫出來?
   (延遲載⼊入,記憶體節⽤用)
Project QV040


延續 QV039
加⼊入轉換 UIView 的動畫
注意:⼀一般 Button 和 Bar Button Item 不同
- (IBAction)switchViews:(id)sender                       ViewController.m
{
    [UIView beginAnimations:@"View Flip" context:nil];
    [UIView setAnimationDuration:1.25];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    if(self.yellowViewController.view.superview==nil)
    {
        if(self.yellowViewController==nil)
        {
            yellowViewController = [[YellowViewController alloc]
                          initWithNibName:@"YellowViewController" bundle:nil];
        }

        [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
                                                  forView:self.view cache:YES];
        [blueViewController viewWillAppear:YES];
        [yellowViewController viewWillDisappear:YES];

        [blueViewController.view removeFromSuperview];
        [self.view insertSubview:yellowViewController.view atIndex:0];

        [yellowViewController viewDidDisappear:YES];
        [blueViewController viewDidAppear:YES];
    }
    else
    {
        // 部分程式省略
    }                                 僅在ViewController.m中增加程式
    [UIView commitAnimations];
}
轉場時速度的變化


// 控制速度變化

[UIView setAnimationCurve:UIViewAnimationCurveLinear];
// 從頭到尾都是等速

[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
// 從開始時慢慢加速

[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
// 到結束前慢慢減速

[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
// 開始時慢慢加速,結束前慢慢減速
作業練習



⽐比較 InsertSubview 和 AddSubview
多⾴頁⾯面處理之技巧
多⾴頁⾯面處理的演進
•   各⾃自為政
     •   ⼀一個 ViewController 控制全部的項⺫⽬目
     •   各個 ViewController 控制各⾃自的 View
•   建置更上層的控制器,管理各個 ViewController
     •   UIToolbarController
     •   UITabbarController
     •   UINavigationController
•   更複雜的 iPad
     •   UISplitViewController
     •   UIPopViewController
Navigation Controller
Tab Bar + Navigation
presentatoin ViewController
Storyboard
建⽴立多⾴頁⾯面關連的好⼯工具
不⼀一定要弄成許多個
     ViewController

• UITableView Controller
• UIPageView Controll
• UIScrollView Controller
• ......
......

Más contenido relacionado

Destacado

是「資訊」還是「雜訊」?剖析投影片設計的有效性
是「資訊」還是「雜訊」?剖析投影片設計的有效性是「資訊」還是「雜訊」?剖析投影片設計的有效性
是「資訊」還是「雜訊」?剖析投影片設計的有效性Yi-Hung Peng
 
Uncertainty and the slow labor market recovery
Uncertainty and the slow labor market recoveryUncertainty and the slow labor market recovery
Uncertainty and the slow labor market recoveryYi-Hung Peng
 
11 Things My Son Taught Me about Life and Business
11 Things My Son Taught Me about Life and Business11 Things My Son Taught Me about Life and Business
11 Things My Son Taught Me about Life and BusinessRae Hoffman
 
Prepared Speech Presentation
Prepared Speech PresentationPrepared Speech Presentation
Prepared Speech PresentationYi-Hung Peng
 

Destacado (16)

I os 15
I os 15I os 15
I os 15
 
I os 06
I os 06I os 06
I os 06
 
I os 02
I os 02I os 02
I os 02
 
I os 11
I os 11I os 11
I os 11
 
I os 04
I os 04I os 04
I os 04
 
I os 08
I os 08I os 08
I os 08
 
I os 09
I os 09I os 09
I os 09
 
I os 14
I os 14I os 14
I os 14
 
課程規畫
課程規畫課程規畫
課程規畫
 
I os 05
I os 05I os 05
I os 05
 
I os 03
I os 03I os 03
I os 03
 
是「資訊」還是「雜訊」?剖析投影片設計的有效性
是「資訊」還是「雜訊」?剖析投影片設計的有效性是「資訊」還是「雜訊」?剖析投影片設計的有效性
是「資訊」還是「雜訊」?剖析投影片設計的有效性
 
Uncertainty and the slow labor market recovery
Uncertainty and the slow labor market recoveryUncertainty and the slow labor market recovery
Uncertainty and the slow labor market recovery
 
11 Things My Son Taught Me about Life and Business
11 Things My Son Taught Me about Life and Business11 Things My Son Taught Me about Life and Business
11 Things My Son Taught Me about Life and Business
 
Prepared Speech Presentation
Prepared Speech PresentationPrepared Speech Presentation
Prepared Speech Presentation
 
I os 13
I os 13I os 13
I os 13
 

Similar a I os 10

07 View Controllers
07 View Controllers07 View Controllers
07 View ControllersTom Fan
 
105-2 iOS程式設計(六)
105-2 iOS程式設計(六)105-2 iOS程式設計(六)
105-2 iOS程式設計(六)Hao Lee
 
iOS App 開發 -- Storybard 基礎練習、APP 上架、IAP
iOS App 開發 -- Storybard 基礎練習、APP 上架、IAPiOS App 開發 -- Storybard 基礎練習、APP 上架、IAP
iOS App 開發 -- Storybard 基礎練習、APP 上架、IAPMing-Sian Lin
 
10 Editing UITableView
10 Editing UITableView10 Editing UITableView
10 Editing UITableViewTom Fan
 
08 Notification and Rotation
08 Notification and Rotation08 Notification and Rotation
08 Notification and RotationTom Fan
 
01 A Simple iOS Application
01 A Simple iOS Application01 A Simple iOS Application
01 A Simple iOS ApplicationTom Fan
 
沈阳师范大学课程实践 Java语言部分
沈阳师范大学课程实践 Java语言部分沈阳师范大学课程实践 Java语言部分
沈阳师范大学课程实践 Java语言部分ArBing Xie
 
ASP.NET Core 2.1設計新思維與新發展
ASP.NET  Core 2.1設計新思維與新發展ASP.NET  Core 2.1設計新思維與新發展
ASP.NET Core 2.1設計新思維與新發展江華 奚
 
DoozyUI_基礎介紹教學
DoozyUI_基礎介紹教學DoozyUI_基礎介紹教學
DoozyUI_基礎介紹教學River Wang
 
UIKit Framework
UIKit FrameworkUIKit Framework
UIKit FrameworkRyan Chung
 
Spring 2.x 中文
Spring 2.x 中文Spring 2.x 中文
Spring 2.x 中文Guo Albert
 
15 Subclassing UITableViewCell
15 Subclassing UITableViewCell15 Subclassing UITableViewCell
15 Subclassing UITableViewCellTom Fan
 
12 Camera
12 Camera12 Camera
12 CameraTom Fan
 
[GDG Kaohsiung DevFest 2023] 以 Compose 及 Kotlin Multiplatform 打造多平台應用程式
[GDG Kaohsiung DevFest 2023] 以 Compose 及 Kotlin Multiplatform 打造多平台應用程式[GDG Kaohsiung DevFest 2023] 以 Compose 及 Kotlin Multiplatform 打造多平台應用程式
[GDG Kaohsiung DevFest 2023] 以 Compose 及 Kotlin Multiplatform 打造多平台應用程式Shengyou Fan
 
Uliweb cheat sheet_0.1
Uliweb cheat sheet_0.1Uliweb cheat sheet_0.1
Uliweb cheat sheet_0.1modou li
 
2016輕鬆開發自有網路地圖工作坊 進階班 0701
2016輕鬆開發自有網路地圖工作坊 進階班 07012016輕鬆開發自有網路地圖工作坊 進階班 0701
2016輕鬆開發自有網路地圖工作坊 進階班 0701family
 
YUIconf2010介绍
YUIconf2010介绍YUIconf2010介绍
YUIconf2010介绍ling yu
 

Similar a I os 10 (20)

07 View Controllers
07 View Controllers07 View Controllers
07 View Controllers
 
005
005005
005
 
105-2 iOS程式設計(六)
105-2 iOS程式設計(六)105-2 iOS程式設計(六)
105-2 iOS程式設計(六)
 
iOS App 開發 -- Storybard 基礎練習、APP 上架、IAP
iOS App 開發 -- Storybard 基礎練習、APP 上架、IAPiOS App 開發 -- Storybard 基礎練習、APP 上架、IAP
iOS App 開發 -- Storybard 基礎練習、APP 上架、IAP
 
10 Editing UITableView
10 Editing UITableView10 Editing UITableView
10 Editing UITableView
 
08 Notification and Rotation
08 Notification and Rotation08 Notification and Rotation
08 Notification and Rotation
 
UIKit-Swift
UIKit-SwiftUIKit-Swift
UIKit-Swift
 
01 A Simple iOS Application
01 A Simple iOS Application01 A Simple iOS Application
01 A Simple iOS Application
 
沈阳师范大学课程实践 Java语言部分
沈阳师范大学课程实践 Java语言部分沈阳师范大学课程实践 Java语言部分
沈阳师范大学课程实践 Java语言部分
 
ASP.NET Core 2.1設計新思維與新發展
ASP.NET  Core 2.1設計新思維與新發展ASP.NET  Core 2.1設計新思維與新發展
ASP.NET Core 2.1設計新思維與新發展
 
DoozyUI_基礎介紹教學
DoozyUI_基礎介紹教學DoozyUI_基礎介紹教學
DoozyUI_基礎介紹教學
 
UIKit Framework
UIKit FrameworkUIKit Framework
UIKit Framework
 
Spring 2.x 中文
Spring 2.x 中文Spring 2.x 中文
Spring 2.x 中文
 
15 Subclassing UITableViewCell
15 Subclassing UITableViewCell15 Subclassing UITableViewCell
15 Subclassing UITableViewCell
 
react-zh-hant.pdf
react-zh-hant.pdfreact-zh-hant.pdf
react-zh-hant.pdf
 
12 Camera
12 Camera12 Camera
12 Camera
 
[GDG Kaohsiung DevFest 2023] 以 Compose 及 Kotlin Multiplatform 打造多平台應用程式
[GDG Kaohsiung DevFest 2023] 以 Compose 及 Kotlin Multiplatform 打造多平台應用程式[GDG Kaohsiung DevFest 2023] 以 Compose 及 Kotlin Multiplatform 打造多平台應用程式
[GDG Kaohsiung DevFest 2023] 以 Compose 及 Kotlin Multiplatform 打造多平台應用程式
 
Uliweb cheat sheet_0.1
Uliweb cheat sheet_0.1Uliweb cheat sheet_0.1
Uliweb cheat sheet_0.1
 
2016輕鬆開發自有網路地圖工作坊 進階班 0701
2016輕鬆開發自有網路地圖工作坊 進階班 07012016輕鬆開發自有網路地圖工作坊 進階班 0701
2016輕鬆開發自有網路地圖工作坊 進階班 0701
 
YUIconf2010介绍
YUIconf2010介绍YUIconf2010介绍
YUIconf2010介绍
 

Más de 信嘉 陳

Más de 信嘉 陳 (12)

Processing 06
Processing 06Processing 06
Processing 06
 
Processing 05
Processing 05Processing 05
Processing 05
 
Processing 04
Processing 04Processing 04
Processing 04
 
Processing 03
Processing 03Processing 03
Processing 03
 
Processing 02
Processing 02Processing 02
Processing 02
 
Processing 01
Processing 01Processing 01
Processing 01
 
Processing 09
Processing 09Processing 09
Processing 09
 
Processing 08
Processing 08Processing 08
Processing 08
 
Processing 07
Processing 07Processing 07
Processing 07
 
Google 街景
Google 街景Google 街景
Google 街景
 
社群網站 Facebook
社群網站 Facebook社群網站 Facebook
社群網站 Facebook
 
網路搜尋
網路搜尋網路搜尋
網路搜尋
 

I os 10