Skip to Content
COCOA學習手冊--使用OBJECTIVE-C第三版
book

COCOA學習手冊--使用OBJECTIVE-C第三版

by Paris Buttfield-Addison, Jonathon Manning
June 2013
Intermediate to advanced
360 pages
6h 50m
Chinese
GoTop Information, Inc.
Content preview from COCOA學習手冊--使用OBJECTIVE-C第三版
圖形使用者介面
|
75
5-1 nib 檔內含使用者介面
nib 檔透過將物件「冷凍乾燥」(“freeze-drying”, Apple 的術語)並以序列化的形式將
它們儲存在檔案中的方式來運作,物件的所有特性(例如,就按鈕而言,它的位置、標
籤文字和其他資訊)被儲存在 nib 檔裡。當應用程式需要展示視窗時,它載入 nib 檔,
將儲存在裡頭的物件「加水還原」,並且把它們呈現到使用者眼前。
這表示,為求實際,在 Xcode Interface Builder 裡組裝的視圖與畫面,和出現在螢幕
上的物件完全相同。
因為 nib 檔單純包含物件,它們也可以包含你自己的類別的實例。因此,你可以建立載
nib 時所建立之類別的實例,並且將它連接到你的視圖。
單單視圖本身並不是十分有用,除非你想要建立的應用程式純粹只是為了呈現一些可點
擊的按鈕或者輸入文字的文字欄位。假如想要建立實際回應使用者輸入的應用程式,你
必須將視圖連結到你的控制器—也就是,你的應用程式的程式碼。
Interface Builder 提供兩種方式將視圖連結到程式碼︰
Outlet
接口
)與
Action
動作
操作
)。本章稍後會更仔細地討論這兩個觀念。
nib 檔的結構
nib 檔包含物件樹,這個樹狀結構可以有多個根元素(root —例如,nib 檔可能包含
兩個視窗,每個視窗各有各的按鈕及控制項群集。這些位在樹狀結構頂端的物件被稱作
「頂層物件」(top-level object)。
頂層物件通常是呈現給使用者的可見事物— OS ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

網頁互動式資料視覺化:使用D3

網頁互動式資料視覺化:使用D3

Scott Murray
深入淺出代數

深入淺出代數

Tracey Pilone, Dan Pilone
自然语言处理实战:从入门到项目实践

自然语言处理实战:从入门到项目实践

Sowmya Vajjala, Bodhisattwa Majumder, Anuj Gupta, Harshit Surana

Publisher Resources

ISBN: 9789862768136