WWDC2003 Session 410
Transcript
Kind: captions
Language: en
are you doing folks thank you all for
coming all you guys in the back move on
up front a lot of its space back here I
can't really see you people too low
thank you for coming to today's session
400 410 cocoa update is like me you love
Coco you're going to see a lot of really
great stuff in here that's going to make
you love it even more if you don't yet
love cocoa you will after this session
we're going to talk about some really
great additions the frameworks and here
to talk about them are Leos our manager
of Coca frameworks good morning yes so
we are going to talk about cocoa great
stuff to that is to cocoa let's see as
usual you might have come to this coke
update talks before we're going to talk
about the changes we made in the app get
the application framework and foundation
framework we're going to talk about new
features and we're going to talk about
some of the significant API changes
we've made we are not going to talk
about bug fixes because we don't have
time to go and go into all of that stuff
but we are going to cover the major
stuff and we will also provide plenty of
pointers to other sessions because
there's a lot of information being
presented to you at the stove video VDC
so first the athlete update which I will
do okay so if you have come to Scott
Forstall in Bertram's talk you probably
you heard about the Aqua changes that we
made they're mostly refinements Scott
showed some of them to you their changes
in the look of Windows menus have used
boxes etc our goal with the Aqua
refinements we made is that it's all
automatic adoption by your apps the
metrics are compatible and the api's are
compatible so hopefully no changes for
your app I will just show you some of
these changes they're pretty subtle for
the most part on the right side you have
the old aqua look the Jaguar and the new
side that stuff in cancer I'm not sure
if you can really see but the window
titled art slightly different if you run
Panther you'll probably notice them the
splitter bar now has a more sort of
elegant simple
the slider is more elegant it's thinner
a knob there the buttons actually looks
somewhat better also the Tavi on the box
and the bottom the right and the left
you can notice that the tab you in the
boxes have changed significantly and
they are a much more elegant fresher
look and you'll note that despite the
big change their the metrics are
compatible the inside should still fit
your views just fine so if not you know
you run into problems please report bugs
on that other changes we made in aqua
you might have already noticed if you're
running cancer is there smooth scrolling
now the parameters are still being
fine-tuned but basically allowing you to
not loose context as you scroll through
pages faster window and sheet animations
and also a distinct look for main key
and inactive windows if you don't know
what this means I'll just touch upon it
during my demo in a few minutes safe
Allen open panel have undergone a lot of
changes you might have used users
already and noticed it it's brand new
look and feel but again compatible api's
that's our goal the main goal here with
the save and open channel is one not
only provide more functionality to the
user like list view and column view but
also provide the same user centric model
we are providing in finder so that's the
open panel and this is the face panel
running as a sheet and texted it now
you'll notice that in the bottom of this
screen shot there's an access review
again clicks that it didn't have to
change it all to use when you save panel
the excess review just works the safe
panel just works it just looks and feels
considerably different we have added a
new API to spacetown open channel which
is independent of actually the changes
we made actually API is an open panel as
you know you could have a new folder
button in the safe panel but sometimes
there are cases where you want it in the
open panel as well and we've allowed you
to do that with this new API we've also
deprecated these view tags that face
panel had I mean I don't think anybody
was using them anymore but if you are
using them heavily depending on them you
might want to let us know these were the
tags that let you get to the various UI
elements in the open and save panels so
you could fiddle with them typically we
recommend using excess reviews to
customize these panels mini controls is
another new feature in Panther it's not
automatic if you want to use many
controls you have to ask for them
they are smaller than small you'll see
the regular the small and the meanie all
the way at the right side are your mini
controls there so as we as we improve
our miniaturization technology we will
be able to fit 38 million controls on
window like rg5 but right now we have
the mini control mini controls used with
the ground a 9 as their system fonts we
have added a new method to enter span to
allow you to dynamically get that figure
as opposed to hardwiring it into your
app so we have that new control and if
you were to Scott Forstall the section
of the state of the union you heard
about that switcher thing that's that
switcher thing you see and finder which
just you switch between two three four
in the different modes it is available
in finder in Jaguar you've seen their
open state on also uses it it's a
subclass of control and also available
to sell yesterday in one of the session
summary was asking that they could not
see this control and interface builder
yet that's because it's not there yet
there's a public API in the seat it will
be there for the final one one problem
we're having with this control is that
we just can't come up with a name so
we'd like you to help name this new
class there's immense brain power in
this room so please send us your name
ideas to name that class at groups at
absolute calm the only requirement that
start with NF and you know don't put
your name in it or whatever but so so
this is all you know for fun just send
us your things you know it's going to be
we're just going to see if there are
some great ideas out there we have a few
ideas we're not happy super happy with
most of them so we'll see and legal
asked me to put this next slide up you
know you send us that name that name is
ours you can't claim anything etc etc
and your name isn't the name of a
product and you're like NS Adobe
Photoshop is not a good name so okay so
just send us your name to the next few
days but not now listen to me now but
after the session you can do it and you
know we'll see what comes up and you
know the you know if we use your name
will give you a big thank you
so we have new button Styles the
disclosure triangle which is something
that's been missing is now a button
style on s button we also have a
textured button let's see now there you
go we also have the textured button
style which is basically buttons that
look appropriate for texture that is
metal windows so it's just another style
of button to get that we also added a
circular slider it's a separate slider
type it's the little things so you set
the slider type and there's an enum for
the slider type most of the rest of the
slider API ends up working for instance
the bottom slider in that picture I know
if you can see it but has little tick
marks and so on so you can you know the
slider still work circle sliders just
circular tool bar now has the concept of
selectable to our items Scott Forstall
mentioned this in this talk this is like
in System Preferences where a toolbar
items are not actions but they denote
state just like with other two large
stuff it's pretty easy to use your
delegate normally declares what item
should be on the toolbar it now also
declares if it wants what items can be
flexible with this method and returns an
area of the selectable identifier and
then everything else is managed by the
toolbar for you if you want of course
you can exclusively change the selected
item with these two calls set selected
item or you can ask for it with selected
item identifier pretty straightforward
talk about selections one problem we had
with focus rings and now that is we
implement focus rings more and more
throughout the kit is in some cases
automatic focus rings you know just this
is often if you've enabled focus rings
or keyboard navigation or even if not
because we draw focused rings for you on
text fields and table views and such
sometimes the focus ring just doesn't
look right an example is a screenshot I
know if you can tell but this table
views you know hitting the top edge of
the window and the focus ring ends up
just overlapping the border of the
window up there and sometimes you have
this case for the tables across the one
side of the one edge of the window and
again you don't want to focus ring drawn
so in these cases you can now disable
the focus ring drawing from its default
setting to none and where there will be
other settings we had in the future and
exterior is where you actually
say I wanted exterior always for some
reason default just means control do the
right thing with the focus ring there
are cases where table we're actually
decides not to use to draw the focus
ring if it knows that won't look good
but it can't always tell and that's why
we give you this control text field
sales now has api for placeholder
strings what placeholder is this is this
new UI paradigm thats you know appears
in the last year or two where text field
has a default placeholder where you can
tell what you're supposed to type like
last name address search you know google
and i think in the safari toolbar and so
on so you can now specify placeholders
during you can even specify an extra
Beauty string if you wish if you don't
like the great version but you want some
other radically different things so we
specify the placeholder as soon as the
user starts typing it's replaced by what
they're typing jumping from text field
to search field thank you search field
is a new control it's a subclass of text
field it's also available as a cell it's
basically that the search functionality
the UI for the search functionality that
you see in sapphire email address book
bunch of other apps and it features you
know search button on the left side you
know earlier I screwed up my left and
right didn't I oh so feature the search
button on the left side the X button on
the right side and these are
customizable and there's a recent list
as well let's just talk about the API of
it you can customize a search or cancel
buttons if you want you can have some
other button up here there instead of a
magnifying glass or not appear at all
you can customize the search menu that's
the menu that appears beneath the you
know when you bring down the menu just
you provide a template which allows you
to say where you want the recent item to
go or what other items you want in there
you can also customize the way regions
are handled you can either have us
manage the reasons for you or you can
specify what the reasons are and you can
even have the search field save the
reasons automatically to preferences so
that you know the user type stuff the
recent automatically saves you'll never
have to worry about it and you do that
using the autosave name stuff that you
might be familiar with from in a window
or in its table view you just specify
the autosave a mathematics
the preferences for you you can also
specify the maximum reasons if the
default I think 10 is too big to small
plug not search panel the app that is
not only provider of technology it's
also a client of Technology because the
font panel use the search field as you
can see in the bottom the fonts now has
many other features it's got improved
collection management if you played with
it you've probably seen it better user
interface overall you can now have color
scores and favorites in the ability to
search fonts as I mentioned and the demo
I will just show the fonts now quickly
and see similar of its features the
Fontana now has the ability to
enable/disable elements of the UI this
is useful in some cases where you want
the user to select a font but for
instance you don't want them to specify
the font size or the font space or the
the weight or whatever for instance
users are just specify lucilla and you
just need to know Lucifer you don't need
to know it's 10 point 12 point if the
first responder implements this method
called valid modes for font panels and
returns what heals at once to other
fields will be disabled by default if
this method isn't implemented which is
of course the default state for intended
to apps in most other cases the standard
mode mask is assumed from fontana to
fontana jur you've seen the collections
and again scott touched upon that
there's API for managing the collections
the collections are identified by a name
and they represent a bunch of fonts we
have methods for add a collection you
remove a collection and also of course
enumerate the collection by getting an
array of collection names fairly
straightforward you'll note that when
you add a collection its global for the
user that means the collection applies
to all of the users applications appears
in the pond panels for all apps there's
an option to make a collection / app
however in these WWE cc'd that option is
not working yet in addition to being
able to manage the collections you can
manage the font from the collections by
adding fonts to a collection removing
fonts from a collection enumerate in the
fonts in a collection now notice here
that I'm not talking in terms of NS font
which is how we usually represent fonts
in Cocoa but I'm talking in terms of the
font descriptor object which is another
new object and that's here last
descriptor is a lightweight object
we lets you specify a font which isn't
as much detail as you want for instance
you can specify that Helvetica oblique
13 or you can just specify its Helvetica
you can even specify its 13 but maybe
that's not very useful it also allows
you to specify colors and a bunch of
other attributes and the font descriptor
much lighter weight than a font so if
you have a collection would say 10,000
fonts in it you know you don't have to
enumerate all those enough on instances
and also lets you represent fonts
partially and that's why we added this
class he expected so clear in future
eight more in future api's so Claude
fonts the next obvious topic in text and
there are lots of changes in text in
session for 27 friday afternoon at five
it's the great time you can state an
extra hour avoid traffic good anyway
that session will cover these in detail
now i do want to give a quick demo of
text just to whet your appetite about
what some of the stuff Doug Davidson
will talk about in that session so demo
three I think yes okay so let's see one
thing I mentioned earlier was this
distinction between main key and
inactive Idriss land show you that first
as you can see that the left window now
is is active this one is active when you
bring up a font panel like so it's a not
modal panel it's the question is which
we know doesn't act on now in this case
it's obvious because this window is
still active and my typing goes to that
window however if you make the font
window key by clicking on it or by
typing a font number here for instance
then you have two windows and you
especially in a larger screen in a lot
of you are getting 17 inches or big
cinema displays you can't tell if
windows are side by sides which one is
active and that's the case in Jaguar
here what ends up happening is the title
bar has a distinct look now for users
who don't understand is it probably
won't get in the way but for users to
understand this I think it's a nice
touch which makes it possible to know
that you know if these two windows when
you're in this state let me do this when
you're in this state you know exactly
what window it will apply to so that's
the distinction main key
active state distinction now talk about
the font panel here it is there's a
search field as I mentioned we have
added a menu here as you can see the UI
has been refined a bit you can show
preview that we had that before you can
bring up a typography panel which we did
not have in Jaguar this typography panel
is context-sensitive it's sensitive
based on the current font in Cocoa right
now in the WWE CC discount wasn't hooked
up but what does that she do is it lets
you set up a bunch of font specific
parameters and so it's for advanced
typography but the note again in the
double WCC it's not hooked up so it's
not functional in Cocoa applications
another feature you'll see here is that
edit sizes is now a sheet rather than a
separate model state and also we have a
way to bring up the font panel directly
from the content which is managed fund
menu item down here the one thing I'm
going to show you right now in detect
one of the features we've added is the
text completion stuff we've added
automatic completion some of you might
have already seen this in other contexts
TV certainly provides this before and
there were some packages out there like
Mike spiritual package which provided
completion what you basically get is as
you're typing if you talk your default
completion character which is either f5
or option escape or you can change it to
be escape if you want if you hit that
character it basically provides all the
words that can complete it and in this
case you know welcome happens to be the
first word that's good so I can just
continue tell attacking i'll type ww and
well you know it doesn't know about wdc
so in this case you just will type WABC
now the good thing is once you've done
that next time you try to type WWDC it
will appear and because it's a secure
and documents close by it goes all the
way to the top so that's that's it
[Applause]
ok so we close this document one other
feature in the text system is here's a
document that looks pretty plain but but
the extension will probably give you a
clue as to what it is we don't have
words on this machine and that is the
word document if I were to say open and
go to my desktop here you notice that
the word document will appear here it
actually does open so we've added
support for Word documents but one thing
to note though is that word is a very
rich document format and word has a lot
of features there are many features of
word that we don't yet do of the box
such as tables and stuff those features
do not are not going to work very well
so expect us to work with the more
simple document types and in cases where
we don't have word around I think it's
pretty useful the good thing is you can
also actually save as a word document so
i can try to save this and when you do
that in this case you'll actually tell
me that the saving will be lost because
i open the word document it might have
lost some features the good thing is
once you stay from text editor word
document try to save i can it won't warn
you anymore because it knows it's no
longer la la fille but anyway this is a
feature will be improving but you know
the basics pretty solid support is there
as is okay so one thing that we've added
to the tech system is something we've
been missing for a long time and that's
a standard fine panel here does it look
somewhat like to text edit one that from
before text it now is about five hundred
or three hundred lines a thinner it's
got some nice you know basic find
options and you know it's available in
the text system by default when you
create one an ID so it's there for you
we have one problem people had with the
text system was a default ruler people
didn't quite understand what some of
those fields were in fact they didn't
understand what all of them were maybe
except for maybe this one and we we
clean this stuff of it so for spacing
now we have this you can single or
double and I mean that's nice and simple
but not very powerful you can also for
instance go ahead and specify other
stuff like you can make the line height
one and a half and you can specify
paragraph spacing if you wish let's say
30 pixels and suddenly no you get those
options so it's it's a lot more I think
straightforward intuitive
set these parameters right now another
menu we've added here is the Styles menu
and let me just talk about that briefly
appliances let's say instead of this
black here I want this to be outlined
and by the way from at across nine times
you can notice the outline fonts over
there which we don't have in jag art as
well so let's say you won't really like
this outline font and you want to use it
elsewhere in your document previously
what you could do was you could copy the
style and you could select this and you
could paste the style and if you get use
these command keys they're very useful
for quickly propagating a style
throughout your document one thing we've
done now is if you really like the style
you can go ahead and ask your favorites
and let's say we call this WBC headlines
and you specify whether you want the
font and the ruler is part of the style
so now I can come back here down here
for instance and I can say yep I want
that wdc headline slide so this is not
style sheets but simple way to preserve
the style to use often and again it's
just stand apart the tech system okay so
I think that's all for the demo right
now
[Applause]
so there are many user features we
showed some of them doc saw word
document fine panels dealing with styles
a better texture Euler background color
which I doesn't show you but it's in
there Texas doesn't support it yet text
completion setting based writing
direction that's all so we added support
for this for by the writers and also we
have character styles like outlines
shadows etc not all of them are exposed
to the UI we've also added many new text
attributes again Doug will probably talk
about these in more detail but there's
you know strike through color stroke
color shadow of bleakness expansion you
can specify attach a cursor to a range
of text you can attach a tooltip to a
range of text you can specify line
height as I showed you and paragraph
spacing a lot more control over other
new features include a new public types
of their class the 80s pipe scissor
which gives you a lot more power over
the typesetting process in a glyph
generator class and additional changes
include truncated text drawing if you
have code where you measure the text and
then you go ahead and redraw it after
cutting it clicking it whatever using a
truncated text drawing will be a big
performance win because we do all that
measurement for you and put the ellipse
is in the right place there's also
improved access ability can see the
improved access ability allows the
assistive apps to get at the backing
store of text and get watch more
information about them and also a bunch
of performance improvements for instance
string drawing is way faster now again
session for 27 friday afternoon i
mentioned shadows and a shadow is now a
new class it lets you specify a drop
shadow it's a independent of the ctm so
the light source determines where the
delights of system light source
determines where the shadow is so it's
the value for a new text attribute if
you set the shadow attribute to an
instance of an asado all text will be
drawn with that shadow now shadow is a
generally useful class you can hit
offset blur and you can use it anywhere
just like NS color and responds by just
saying set so you know just that's
pretty straightforward and then any
drawing you do in that graphics context
will appear with a shadow
so let's talk about views for a while
now views in Jaguar one complaint that
came up in various forums discussions
etc this view wrecked coalescing problem
where view with whenever it got multiple
directionality it would call up them
into a bigger erect and that would end
up causing it to draw more than
necessary let me give you a demo a
little example here's your window let's
say the user clicks that check box at
the top and let's say clicking that
check box causes that text field in the
bottom to be updated it needs to happen
in the same event cycle which they
probably would although these individual
views are invalid themselves the super
view the common ancestor for these two
views ends up getting an invalidation
wreck that's this big which oh of course
ends up touching redrawing almost
everything in the view and in some case
it's no big deal you know it's a result
of an event on another cases there's a
performance it and could be significant
so this is the problem that we're
looking to solve so in fancy reviews
tracking validated areas and we restrict
the clipping to the areas that need
drawing only so it's erect has multiple
rectangles we actually set the clip
areas so any drawing you do will
actually only appear in those areas by
default and another important thing
about this is that the draw rect method
which is how a view draws itself is
still the funnel point for drawing we
did not want apps the change to for this
feature to be effective across the
system now what I mean by draw rect is
the funnel is that draw rect will not
get called multiple times with multiple
records instead drawer X will get called
once with a rectangle that's the Union
just like before so that behavior hasn't
change and maintains compatibility now
you can go ahead and draw just that
rectangle as you did before and the
clipping will save you there will be
some gain and performance there however
if you're sophisticated you can call
this method get wrecked being drawn and
count and get back a list and count of
wrecks you do this in your draw rect
method and the result of that you can
just draw those rectangles you know
because those are the rectangles we
actually want you to draw we've also
given you a convenience method to
determine whether I given direct
intersects these rectangles that allows
you to quickly
whether you erect you have should be
drawn we also given you a way to
override the default clipping behavior
before I said that we clip for you you
know the rectangles if you want to
change that for some reason you'd have
been pretty sophisticated to want to do
that you can override that behavior
return though and do your own thing
there might be reasons for this but it's
fairly advanced now is here you're
looking at this thinking well if I have
to do this and I mean you know my view
that doesn't do this is not going to
take advantage of of the this whole
process well it turns out that most of
the time the performance hint we get
from this isn't because a view
internally isn't managing tricks it's
because at the windows content level the
multiple element the views that have
updated are being call us so in fact the
one view that really needs to implement
this is if you like the content view of
your window or maybe a box that can
include multiple views so just by doing
it there which we've done in the app kit
we are seeing in many benefits a lot of
benefits to this thing but if you have a
view that's fairly sophisticated a
graphic view with a lot of changing
documents new animations you might want
to go the next step and implement this
method and make it even faster another
feature we've added to view which is
being was being asked a lot recently was
the concept this view hiding business
you can basically tell of you it's
hidden so thank you and it not only
hides that you but it has all its sub
book views of course and it also managed
a lot of stuff like correct tool to brag
tracking wrecked are disabled opengl
surfaces are ordered out and the
responder chains are just automatically
you don't want to be tabbing through and
you know ending up in the weeds of
course and the api is very coco ask
meaning simple you say set hidden or is
hidden and that's it and everything else
is handled for you we do have a third
method unfortunately fifty percent more
complex than maybe it needs to be you
can ask if you whether it's hidden or
whether it's hidden because a super view
of that view is hidden because clearly
you know if you're super gross hidden
you get hidden but some implicit hiding
and you can ask whether view is in that
state Oh before I move over move on I
should mention
some people have implemented set hidden
and is hidden in their applications as a
category for instance in general we
should work with those categories
however there are cases where we were
assuming the set hidden we called was
our implementation and we clean those up
so we believe we've addressed the
compatibility problems but if you have
your own set hidden methods or is hidden
methods you know just make sure things
are still working right of course
something that might be bad Sofia to set
hidden method but do never is hidden
method so we're calling you know are his
hidden but you're set hidden and that
might be a little desire so there is a
potential compatibility issue there but
we have you know just the ones we've
seen now there's a lot more view
discussion and graphics discussion this
afternoon session for 13 in the 2d
drawing techniques from view to window
if you manage your with windows
internals like you have your own toolbar
whatever or you want a sheep to come out
from a custom place you can now have a
delegate method that allows the sheet to
come up from anywhere you want so there
it is basically specify a rectangle
where should come out of and we ignore
the height of the rectangle for now
because sheeps are always coming down so
if you just specify of small with it
will genie out of there and so on you
can make it come out of for instance if
you have your own toolbar under that
toolbar we also allow you to have a
custom minimized dock icon image this
API used to be there for a long time it
was disabled through the compatibility
but we enabled it again so if you don't
like the doc you know minimum is dark
icon image you can provide your own in
ass windows tooltips in windows used to
be disabled for all windows except the
active window we enable them so that in
active windows in your active app the
tooltips now work they are disabled in
inactive applications because we don't
want tool to just jump up at you
everywhere but you can enable it for an
inactive you can enable for the windows
an inactive app by telling those windows
that they should have tool tips no
matter what and here is the way to do
that we it used to be you can convert
frame wrecks the content threats back
and forth as a factory method so you can
tell for this window style what's the
conversion we now let you do it as a
window level and that lets you take
special circumstance of the window into
account like toolbars and you know when
those may be other future changes but
these are basically little more you know
for instance specific ways to do that
we've also added eight new methods that
parallel similar frame methods where you
can set the max size min size etc of a
window based on the content size of the
window not the frame size of the window
so these are basically parallels the
existing for anyone's they look great
they're not implemented in your seat
though so for now this all you get for
that from windows the alert we've added
a new public class if you use all our
channels you know that that's one of the
no signal piece of C API is we have in
the kit we added this class to add some
flexibility over to see ap is you can
now assign T equipments to your buttons
you can assign custom return values you
can show a Help button you see one in
the left side here and you can if you
want you can provide more than three
buttons and sometimes the situation
calls for it the API here is fairly
straightforward you in it in enough
soulard and then you set parameters
message text and primitive text icon
whatever you want then you run it just
like you're on other sheets or panels at
either run model or begin sheet for
modal window so that brings up a sheet
on a given window so pretty
straightforward the one other thing here
is that if you have old fee-based you
know you're making old sea bass calls
and you want to just convert those from
UNS alert class we've got given your
convenience method that does it this
chrominance method in addition to just
doing that same old you know same
function call in the style with a method
style it also sets the return value so
that they're compatible with the old
return values the old return values were
sort of i don't know i mean if anybody
ever looked at it they're like some- 101
and they weren't you know the rightmost
button and it wasn't clear what it is i
don't even remember what it is now the
new values are like there-there like the
right mouse button right right mouse
button + 1 + 2 etc but this will set up
the old return values assuming you want
to use it in the old old way so use this
if you're transferring quotes from your
sea bass one to this one of course fee
based ones aren't deprecated it's just
you know you might want to switch for
some reason or another I mentioned the
Help button to get a help button to show
in your NS alert you say sets help
anchor and you provide the anchor that
should be open when the Help button is
pressed if you want more sophisticated
handling you wouldn't
the delegate method alerts show health
and you will be called and you can then
decide to show help any way you want of
course in doing that you might want to
use these new health manager methods
we've added before it used to be that
you could have I think you could have
helped anchor in your info pillows and
was automatically dealt with but you
don't have finer control with these new
help manage your methods you can specify
the help anchor you want the book you
want and you can even also open at the
help pages by specifying query string
that you get from the user for instance
using fine string in book you can
specify nil there for the book it will
search in all the books now one other
way you might provide help is rather
than using healthier if you want you
might maybe have your own way of opening
documents or opening a help application
in that case you probably turn into in
this workspace and we've added some new
method sentence workspace as well one of
them is the ability to add and to launch
an app by bundle identifier so rather
than name or path you can now launch it
with bundle identifier and let launch
services decide which version which app
it corresponds to the we've also
provided some options here these are
options like in a launch and classic
print launch and quit etc they're a
bunch of things like that or print and
quit so you specify those options you
can specify an apple event if you wanted
some you know Apple event level
customization there and you also get
back a launch identifier which can be
used for various other purposes
currently it's not i don't use any api
to take advantage of it but in the
future there might be to identify what
launch event you're talking about you
can also now open multiple files at once
with the second method you specify an
area of URLs and they're all opened and
that's rather than calling it one at a
time and we'll see the counterpart to
that in a little bit you can also now
discover an applications bundle ID so if
you want to get a path to an application
but not launch it necessarily use this
and we also now let you see the bundle
identifier launch the application it's
in the dictionary you get back when you
get back an app launch notification and
there's that key for that we also now
have sweet notifications we have will
sleep in a good wake we don't have the
other two these two are not implemented
in the wwc feed but I mean they
what is you might expect them now in the
will sleep notification you can actually
take your time to do some stuff if you
want and the machine won't go to sleep
until you're done however you can't
count on that because there might be
cases where the machine is going to
emerge in some sleep the lid is closed
or the power is going out or there's no
battery in those cases you might not
even get this notification or if you do
it might still go to sleep halfway
through this so don't count on being
able to do stuff in this notification
it's just a way to if you did want to do
something this is the way to do it
better than what you had before okay so
earlier we talked about opening multiple
files this is the counterpart you will
get an open files call which includes
all the files that were open this is
very useful for except the user double
clicks on you know 30.jpg documents and
finder you if you want to hear that they
all came as one big clump you would
implement this method and get all of
them before there are ways I could
implement open file you get 30 open
calls and you could check to see whether
you're on the same event cycle to deduce
that they were all or being open
together if these methods are
implemented they will supersede the old
message which is application open file
colon now note that with multiple file
requests coming in at the same time the
delegate has more responsibility for
handling UI and error conditions for
instance the you know one of the files
might not open the user might cancel the
opening process in between you know when
a panel comes up or such to enable you
to do this typically you handle this by
sending an apple event we've added a
method in its application that lets you
I just send a reply to open or print and
you specify what you want communicated
it's handled for you so you don't have
to do any special apple event stuff now
if you do want more sophisticated
behavior you can send Apple events
directly using app lament manager class
here the successes implied so you would
typically use this if you just want to
communicate canceled or failure so let's
jump to menus mac OS 9 you know the
those of you whose mac OS 9 you know
that when you went to the control panel
menu item in the apple menu you could
select that menu item although the
submenu would open up the control panel
where you could choose what you wanted
croco didn't have that ability to assign
those you know a super menu to be a
leaf target and now you can do that you
can just set the target an action on a
menu item and it will work we also added
this sport for dynamic menu items based
on Kia Cologne what I might mean by this
is you hold down alternate or option or
shift and the menu title changes and you
know something different happens the way
you do that is you just specify certain
menu items with being alternates of the
first one and if we notice that they're
alternates we just collapse them into
one menu item now if you run such a nib
file on jaguar the individual menu items
will show us distinct items which is you
know reasonable behavior maybe not not
exactly what you wanted but in jaguar
this feature doesn't exist so it's
better than nothing another thing in
menus it can now atribute idols you
don't have full you can't put full
attribute of strings here you know like
a word document but you can specify the
style and I think an embedded image it's
fairly limited and color and you can
also have tool clips on menu items and
then as many now is a delegate after so
many years it's finally got a delegate
this we added this for lazily populating
the menu there are some menus which take
time to populate and you don't want to
necessarily do it at the app launch so
we have this delegate method menu needs
updates and you can go ahead and
populate the menu when you get that
that's being that will be sent to you
when the menus product it would seem
would be a good idea for us to talk
about teachers before we implement them
implement in the order of the amount of
interest yes but this is very good
feedback thank you so now if the
building the menu might take a while
because you have to go out to the
network or you have to do other stuff
you can choose to implement these
additional delegate methods where you
tell the menu how many items it will
have and also fulfill a request to build
one menu item and you can also stress
you can also indicate what the key
accounts are of menu item is so by
implementing these three methods you
will get a lot better performance out of
lazily built menus if they are slow to
build now the last one the key
equivalent the reason you want to do
that is when the user hits a key
equivalent you know command H command C
we have to go through the menus looking
for them and normally with
to populate your whole menu to find a
South well this the third method here
allows us to find out what the key
equivalent is without populating the
whole menu typically for a dynamically
build menu like that the key accounts
might be there might be none so you just
return I believe you just returned no
from this and and that's that's that
gets you where you one okay and one
other feature that I ammeter talked
about in the sessions i went to is
customizable command keys in system
preferences you can now specify command
keys for arbitrary menu items and they
can be either global or they can be per
app in this works in cocoa and carbon
app so it's across the system so you
know you can specify what menu
equivalents you want for whatever and
here you see for instance texted it has
some housing of start speaking has been
set to command option s hide others has
been set the command option age so it
works everywhere and so on so that's
what's fairly useful NS browser one
thing in this browser didn't have before
was continuous horizontal scrolling it
was if you remember it would just jump
in discrete steps it's now implemented
and on by default we now also column
resizing which is what finder finder had
this in jaguar column resizing by
default is not on so the browser behaves
like it did before because they're
enough compatibility issues that we do
not want to you know introducing
compatibility as a result of this you
can change the column resizing type to
one of three values the no colonies
Isaac means the columns will never
resize before David resize based on the
width of the browser auto column
resizing is the behavior we have today
and user column resizing is where the
user can resize them any way they want
and of course you know we provide a you
know be good to provide persistence of
these values so you don't have to worry
about them so just by sitting an
autosave name like we saw earlier you
can get the column width to be saved
automatically in preferences you can
also if you want to do more
sophisticated action as a result of
column width size changes you can
implement this notification and
basically do whatever you want table
view now has index set based selection
management will talk about index set in
a few minutes that Chris Parker will go
into that class but
sort of individually specifying of you
know role IDs column ID you do not
specify them in turn in bulk which is a
lot more efficient and this NF index set
is a new foundation class we also have
api for managing sorting UI by using
this other new class called sort
descriptor i hope you realize this means
we don't do sorting for you just the
sort you I for you but basically we do
show you know the appropriate we let the
user click on those the column headers
and you tell us which columns are
shortle and how and we just manage the
sorting behavior for you and by the way
we also yet says they're automatically
made the state persistent if you've
asked your table you to be persistent
the data source which is what you
usually implement still does the actual
sorting but we tell it what the short
parameters are and I'll sign you of
course which is subclass of table who
has the same behavior in table we we
have fine your grid drawing control you
can now draw vertical or horizontal
grids independently we have control over
background drawing points if you want
all training background colors this
might have been a way to do it but turns
out we added this other method that says
set use of all training background
colors which is the white and blue or
white and gray colors you see in a lot
of apps these days if you want if you
want to use those colors in your own
lists or tables and also add methods NS
colors return an area of those colors so
white light blue white light blue it can
change depending on you know the release
whatever you can also find out the
current control tint before it wasn't
easy for you to find out whether the
system was set to graphite or aqua the
blue you could find out what the current
color was but you couldn't really tell
it was graphite or our quadrant and
looking at the hero of the color and as
color also now allows you to set the
fill and Stroke colors independently so
set still set stroke so these are
considered primitives just like this
existing set method NS colors NS image
we now support postscript in eps files
you heard about that i think on monday
we yeah my name's go ahead and try it
and see how it works i think the first
time it couldn't be a bit slow to set up
the vm but after it's pretty quick and
works pretty well we also support five
channels CMYK a images image view now
those automatic
animation of images you can enable or
disable this if you want as we need as
you know we added animated image sport
in Jaguar but now image view will also
do it for you automatically you can now
prove it up with this great new function
called show animation effect and
basically that's to get the little proof
animation we have to actually animation
effects and more to be added maybe in
the future they both do the same thing
the securing and proof but you really
want proof and not a disappearing action
you know you can choose proof as opposed
to the other one and it's an ASA kind of
action and you'll get called back if you
want to when the proof is done and as
cursor now sports images other than 16
by 16 for applications compiled on
Panthers or linked on Panther the reason
for that is we found some incompatible
teaser I just enabling this some
applications it turns out we're already
specifying large images and so we're
getting ugly cursor images so we can't
enable the suturing compatibility
reasons there's also sports for
additional standard cursors that you
know you might need in many cases
pointing hand closed hand resize etc
okay wait speech classes we have two
classes that wrap bunch of speech api's
they're quite powerful you should look
at them I'm not going to talk about them
here because you know the time is short
and teachers are many speech recognizer
speech synthesizer it lets you get that
commands for various recognized each
that the user might be saying another
thing i'm not going to do justice here
is and so i'm going to talk about it
other than talk about a bit is the
controller layer which is the bindings
you've seen two demos of this i think
you're all excited to go see the demo
this afternoon it's basically a TI to
eliminate the glue code it comes it's a
bunch of enhancements of you know in
various places we've enhanced the key
valley coding if you're familiar with
that we also adds a new class and its
controller and subclasses currently we
have three in the kids object controller
array controller user defaults
controller and there's a very tight
integration with interface builder and i
will maybe i will show that or maybe
that's i don't have time and in fact
that's what makes this feature possible
you know you the feature here is to just
raise the bar as far as you know
avoiding eliminating code you have to
write and the integration with interface
bill
there's a major part of that there are
two talks for this the one disaster noon
cocoa you I programming Friday morning
there was a cocoa talk cocoa performance
techniques we actually change that to a
second controller lawyer talk and it's a
continuation of you I programming talk
where Mark Petrelli will go into more a
he will actually cover the api's in more
detail talk about key value coding
controllers key value binding observing
that's friday morning at 9am so it's not
a performance talk at that slot it's the
number in the room is same the title has
changed so please make a note of it
think andreas will probably pointed out
that today's talk so interface builder
has support for many of the teachers and
api's discussed here not all but many I
mean the days the interface builder team
has track the changes and we work with
them carefully to make sure everything
gets in there there's sport for bindings
their scores for a WebKit as you saw as
a simple palette and also many of the
things we talked about here there's also
some good improved compatibility
checking let me just give you a quick
demo of this i'm going to try not to
overlap too much too far can we switch
to the demo machine
okay so i'll create a new color
application in its grace builder so if
you look at some of the palace gear
you'll notice there are some new things
the the search field this is a search
field you know you can actually drag it
out here and if you bring up the
inspector you'll notice there's even a
way to specify the placeholder you know
you can say Google here and there you go
it says google in there let's see it's a
table view one has some bunch of new
stuff I'll get back to it in a second
here you see the new box and then you
tab you styles this is a WebKit
currently there is a web view you can
drag out and finally the bindings one
down here with three nice colored boxes
let's try got a table view here okay now
like just as an example some of the
features we talked about here you can
specify down here use alternating row
background so you can enable this you
can specify vertical horizontal grid as
you can see some of the features another
feature that the IB team added is a way
to specify the data cell for instance
these are now the cells you notice
there's somewhat different than their
big counterparts here and the way you
use this is you go here and you drop it
and there you go
this triangle here lets you set the
properties of the that data cell object
for instance I can make them mini
controls or I can you know give them a
bunch of tick marks and so there you go
so that's basically how you can
customize those cells the if you click
on the table column like I click here
select the table column the table column
info also lets you specify sort key
source selector etc so so much more
sports there let's see okay so let me
now try to save this document i will say
save so note that's in the safe panel it
says 10 2 and later format can you see
this all the way in the back and you
know that's the new key archiving format
we added in jag är now if i try to
specify preten to formats i will get
this morning and it says you know tend
to nib file it will require data loss it
will result in a loss and i'll say
showing compatibilities and this panel
here actually you see if i can magnify
in on this yeah there we go so this
panel here tells you the critical losses
basically this it won't even open in the
old system verse and also the losses
like well you won't get all the inning
background colors or whatever so at this
point you can choose to delete those
incompatibilities or save this file in
the in the new format okay so let's see
what time is it yeah I think I uh maybe
I let Chris come in so i'm gonna i'm not
going to go to the rest of the demo at
this point can we switch back to the
slides please there's my clicker there
okay the last thing on the talk about
before I invite chris part or the stage
well there's a demo is this NS nib class
and it's a new class representing an
interface builder nib file the API as we
had before for nip files was all low the
NIP from disk and there you go loaded
from this we've gotten requests allow
loading them from memory for performance
reasons especially or for other reasons
we might want to save nibs as flattened
data somewhere so basically there's an
escaped class you can omit it with the
contents of a URL so we've loaded from
the file system and you can instantiate
it's over and over while keeping it in
memory or if you want you can load it
from somewhere else and instantiate it
many times of course if you have a nib
that occurs many times in your window
you don't have to load it from the
filesystem over and over again the other
cool thing about in this nib is that
these these can be archived and on
archive for the whole in this new object
can be archived and it represents that
Nick Viall and its resources so it's a
pretty powerful concept useful and you
don't have to use this if you're just
loading a nib file from your resources
like you normally do but for more
advanced you switch this is this is the
place to look ok so that's it for the
athlete update I hope I've left you
enough time this was chris parker who is
an engineer in the copa frameworks group
in the rest of time thank you my name is
chris parker i'm an engineer in the coco
frameworks group and we're going to be
talking about the stuff that we've added
to foundation this year first up we've
added some new language features there's
a new exception mechanism in foundation
and to java style exception mechanism
that includes a finely clause so you get
at catch at try and at finally it's
binary compatible with the old one and
automatically does a few things for you
like bring variables up to volatile so
when you throw the exception things
actually work right it deals with return
statements and it actually handles
continued break and go to correctly so
once upon a time you would have written
something like this using the NS during
macro and stuff like that and now we're
actually asking you to write things like
this using at try you can return the
object directly to the catch
it really doesn't take much you can
actually have multiple catch statements
here so as you get more as you get you
put the more specific ones up front and
then fall through to the more general
exception class so there's also a
synchronization mechanism now in
foundation it's a new statement you can
synchronize that any object individually
and it'll clear any locks that you've
held above the catch point if we throw
an exception there so this is the
synchronized object we don't have a
synchronized method specifier so you can
only do it on individual objects and
actually for the exception stuff we
don't have a throws clause that you can
put on methods so you still have to
manage that yourself and what but we've
made some changes now two key value
coding both to improve key value coding
and support the new bindings API better
and this is some of the older API that
we've had in place has been deprecated
and there's a category in the binding
header that'll show you which are the
coding had a rather which will tell you
which message those are we've also got
some new more consistently named methods
and some new things you can do with it
so you can actually set values for keys
now using this new method and then also
you can validate values for keys and if
something does go wrong and validating a
particular value for a key we actually
give you a way to report a new nserror
back and we'll get to that a few minutes
and there's also some methods for
dealing with getting hole arrays out for
giving keys if you send it if you send a
a value for key message your mutable
array and for all of these methods there
also keep at variance of these so if you
need to go deeper into collections you
can get back more information out than
that there's also a new API for
undefined keys and nil values this lets
you be able to set things up for your
own objects where you can specify values
for undefined keys you can set value
trying to find keys and you can also set
with an ill value is going to be new
categories on NS array no that's
dictionary for value for key as well as
on NS mutable array for doing set value
and getting values for keys there are
extremely detailed comments thanks to
mark Pizzarelli in NS key value coding h
and the companion that we'll talk about
in a minute and it talks about how to
modify the behavior for this if you want
to change how it works or
implement your own methods and that's
definitely good reading for key value
observing now this is part of how the
bindings a PIAA mechanism works you can
register objects for notifications about
value changes on giving keypads for
nsobject and subclasses who use at this
ad observer for keepass specifying some
options and you can specify your own
context pointer which you'll get back
later for NS arrays you should use add
observer to objects and indexes
specifying an index set this is much
more efficient than pinging the ad
observer for keep at method over and
over and over again and again you
specify some options about what kinds of
things you want to get notifications for
in the context corner what you'll get
there we go is this the observer object
will receive an observed value for key
path of object with the change and
nsdictionary representing the change and
your context pointer that you pass them
before so you can attach your own
information to these notification
observer notifications can be either
automatic you can set it up we use our
methods and we do it for you or you can
actually drive the machinery by hand and
there are more notes on that and the key
value observing bh better in order to
make some of this work for large
potentially sparse sets we've got this
new thing called an NS index set and
it's a way to do really efficient fast
storage of large numbers of unsigned
integers and you create one of these
basically by specifying either an
individual index or an index in a range
you can test to see whether or not
indexes exist inside the set you can do
all kinds of intersection work with it
you can find out whether they're your
intersected indexes in a range we're
treating indexes you can pick out the
first index and then you can iterate up
through them to find out what what
indexes are actually in the set and this
ties in with a bunch of stuff for table
view for pulling out selected items and
stuff like that there's a mutable
variant so that once you create this you
can actually push indexes in and out of
it you can add indexes or remove indexes
by range or by entire index set so you
can specify oh I've got this index that
I want to take all the indexes and this
other one out right so it's fairly
powerful sort descriptors you want to be
able to do this for table views you set
up an array of sort descriptors and that
describes
a sword ordering and these can also be
used for comparing objects you can
specify one object and another object
they'll tell you what the comparison
result is based on those sort
descriptors you can also create sorted
arrays from NS arrays and you can pick
out you can take an NS mutable array and
basically hand it to sort of script
would say sort yourself here we go value
transformers again another part of the
bindings API this actually allows you to
return a new object for some kind of
given value and let you shift it over
into this other object type so it'll
return you the same type or a different
type with it with a you can do it either
way you can transform a value and if
it's a reversible transform you can
actually set it up to hand you back the
old value you create these yourselves by
subclassing and then you can register
that subclass by you can register it by
name so you can get it back easily with
class and we've actually provided a
bunch of them for you for doing things
like negating boolean and nil transforms
or not know and being able to pick
things up from archives so you know
basically everybody's been asking for
that category and NS user defaults to do
colors you can do it with this too
there we go and as there is a new public
class for being able to specify errors
flexibly you can attach your own
information to these things so that they
can bubble up through and you can
actually put NS errors inside of other
NS errors you create one by specifying a
domain using a string and we've
specified a number of different error
domains in the headers for things in
foundation and in the kit you specify an
error code from within that domain and
then your dictionary and there are
accessors for all of these things as
well as a localized description and you
should use the localized description to
be able to provide a meaningful string
to your users when it comes up in the UI
and that's XML parser after popular
demand you can set one of these up from
a URL if you need to do it from a file
you can use a file URL or existing data
and you assign a delegate in the
delegate basically just implements only
the messages that it's actually
interested in you'll get things like
starting document or did start element
you'll get some namespace information
you'll get you know you can do found
comment stuff like that we've also added
NS stream to foundation this is an its
input stream and NS output streamer for
reading and writing their toll free
bridged into their CF equivalent so you
can take one of these things and pass it
right into the CF api's that take read
streams or write streams the network
stream support basically everything that
the CF version does Secure Sockets proxy
stuff like that you can also do file and
memory streams and these are sub
classical so if you need to do your own
kinds of streams and pass them into the
cs flavors you can subclass that its
input stream it on its output stream and
they'll just work ok parentis input
stream sorry to cut you guys a lot for
in its input stream you can set them up
with data or with a file at path and you
just read it for a given anticipated
length you'll get back to length you
actually read you can get a buffer in
order one so that it basically as fast
as we can hand it to you or you can test
to see if their bites available on the
stream and its output stream for writing
stuff out you can write out to fixed
length buffers you can write out to a
growing memory buffer or go file at a
pass same kind of thing you write a
specific length you get back how much
actually wrote it and you can check to
see if it's available we've also set it
up so you can get streams to host right
so grab a pair of network stream so you
can read and write to these things if
you don't want one that you pass them in
by reference if you don't want one pass
nil you'll have to schedule these things
in order to get event if you don't want
to pull the stream constantly for event
you can schedule it to get events off of
off of these things and right in the run
loop and once you've done that you
assign a delegate your delegate will get
one of these stream handle event
messages but will say hey this stream
just had this thing happened to it
you've got open whether or not it's got
bites available or you can write to it
whether an error occurred that kind of
thing extreme and oh there are
properties to for setting things like
whether or not you got stuff back out or
you know out of a memory stream or if
you want to set up your socks proxies
what level of security you want
basically all that good stuff in that
line there have been a number of
enhancements nsurl as well the class
itself as well as a number of new
classes this is a short list you should
probably look into foundation headers
for this stuff there will be another
session about this later on probably
today and tomorrow there's one tomorrow
and it's URL request to represent what
you want to get off the wire the
response for what you actually got back
there's stuff to specify caching
policies for downloading URLs or once
you've got it on disk connections and
downloads for getting things either
right into data or write down the disk
and then also nsurl protocol so you can
define your own if you want to support
new URL types there is a modest
technology demo on all of your hard
drives here's a screenshot okay these
are the scene AP is that the Safari guys
use to get all of their work done off
the network so as they improve it and
they get faster you guys improve and you
get faster so there is another session
about this much later in the day so to
wrap up Jason guys going to come up and
sprint up
and so we're going to have a key way
shortly if you guys want to queue up
behind the microphones that'll be great
in the meantime let me do a quick load
map for y'all go to all of our cocoa
sessions lots of really great stuff the
UI programming section 412 later today
right here late 30 you'll get a lot of
really great information on using the
new bindings that we've introduced later
on in the week Friday morning session
for 19 at nine o'clock will go really
in-depth so you'll see all the api's if
you're interested in 2d drawing
techniques or you want to see some
really great tips and tips and tricks
for things that we've done in a chat or
iTunes and so on you should really go to
that take a great look at how we've used
the api's and how you can use the API
lots of code will be in there the text
session is the last session on friday
five o'clock the really hardcore coco
folks will be there so i know you'll all
be there and you missed the first
session some of you probably did item
four hundred but if you look you'll be
getting the DVD so you can watch it
again and of course the feedback form
very important we need to hear from you
guys to that note if you want to send
feedback start with John de Lancie he's
the manager of software evangelism he's
the one who takes the stuff you guys
asked for and makes them do it if you
have API feedback specific things you
want to see this in the api's send it to
coco dash feedback at group that apple
com and if you have technical questions
on how to use the API send it to my team
develop a technical support and we'll
help you out and as Ali noted we need a
name for that switcher thing if you have
ideas its name that class at group apple
com we've got some great documentation
improving all the time the API stuff
will be documented in Panther we won't
put documenting documentation
forthcoming on there will be okay
you