6. nib-‐file?
• Interface
Builder
is
used
for
creaIng
Uis
• The
interface
is
stored
in
a
file
.n/xib
– .nib
=
Next
Interface
Builder
– .xib
=
new
version
(Interface
Builder
3)
of
nib
• The
xib
file
is
xml!
• By
conven)on,
refer
to
nib
9. main.m
//
// main.m
// ExampleOfiPhoneApp
//
// Created by Jussi Pohjolainen on 22.3.2010.
// Copyright TAMK 2010. All rights reserved.
//
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
10. UIApplicaIonMain?
• Creates
instance
of
UIApplicaIon
• Scans
info.plist
• Opens
the
UI
–
file
(xib)
that
is
defined
in
info.plist
(mainwindow.xib)
• Connects
to
window
server
• Establishes
run
loop
• Calls
method's
from
it's
delegate
12. Design
PaYern:
DelegaIon
• One
object
sends
periodically
messages
to
another
object
specified
as
its
delegate
• Delegate
methods
are
grouped
together
with
protocol
(Java:
Interface)
13. Delegate?
• Xcode
project
template
has
provided
UIApplicaIonDelegate
for
you
• Can
implement:
- applicationDidFinishLaunching
- applicationWillTerminate
– applicationDidReceiveMemoryWarning
– ...
16. Outlet?
• Outlet:
the
UI
widget
is
implemented
in
Interface
Builder!
• When
the
app
starts,
the
main
.nib
file
is
loaded
– MainWindow.xib
• This
file
contains
UIWindow
that
can
be
modified
via
the
Interface
Builder.
18. Windows,
Views
• iPhone
app
has
usually
one
UIWindow
• UIWindow
can
consist
of
UIViews.
View
can
contain
another
UIViews
(UI-‐elements)
• UIWindow
– UIView
• NSBuYon