WWDC2001 Session 702

Transcript

Kind: captions Language: en welcome so down it down down below all the lights how many people were here for the project builder session just raise your hands excellent so more than half of you development tools are one of the most important aspects of building the new operating system and making successful applications and in that direction I want to just introduce very rapidly on real Amuro manager of the interface builders group and he's going to tell you all about our world class leading aqua UI design tool ok right on the podium good afternoon so I want to start by pointing out that today we have a wide audience here we have developer which would stuck it to you that the face builder many years ago with next set next steps then open step and now is Coco we have also developer that just starting to use the toughest builder or are thinking about using cocoa and use not a face builder we also have cabin developer now we can use interface builder so as you can see a wide audience of developers with different need different and theorized so when we're thinking about that we decided to organize off talk around several several topics we want first to answer some of the frequently asked questions questions are coming over and over of onam detailed mailing list we want to show you the new feature we've we've added to NTFS build this year I want to give you some tips how to better user interface builder and also give you some demos so this is the roadmap are going to be following today I'm gonna first introduced quickly what is NTFS builder and then go III be for short I'll be using the world I be sometimes for this interface builder I will go then who the three steps it takes to develop an application using at a phase builder first you have to let you how to use an NTFS then you have to connect your user interface to your code and then you have to load the user interface in your application I'm going to go through some tips and tricks talked about neat tool and talk about our debt schedule so let's stuff is what isn't a face builder interface builder is a per user interface builder tool we have one tool at Apple that covers all of converts this isn't a face builder interface builder has been tuned to create a quad compliant user interfaces for both cocoa and carbon and also interface builder originally was a cocoa tool we know support carbon as a first class citizen both cocoa and carbon are fully supported by a TFS builder we're spending as much time on both framework to support both framework so a TFS builder it's a cocoa application running on Mac OS 10 which FS builder you create what we call nib files at a phase below does not generate code we don't generate objective-c code or java code we generate what you call a nib file that contains the description of your user interface I show you two different nib file a cocoa nib file and the cabinet file although they are the same that same structure internally they are quite different and you cannot use a cocoa nib in the common application or carbon even a cocoa application a cocoa nib is a is archive objects archive cocoa objects can be the active objects or it can be also your own objects so it's enough type of objects the carbon nib is more of a description of your user rtfs carbon is not an objective oriented framework so the carbon needs are more than a template for your user at your face also I want to point out that in a cocoa nib you have more than simply object you also have the connection between those objects how those objects interact between each other as you can see the cocoa nib and cavalry bad either build different also the cabin needs are XML based while the cocoa nib are still using a binary format so from a cocoa nib you can set a cocoa application either in Objective C or in Java because we don't generate code the language you use to you to develop your application I won't say we don't care but it's not important for us you can also create a java current web object application and there are several session this week that show I would use interface builder for using web objects with a carbon nibble you can get a cabin application and you can target both back OS 10 and Mac OS 9 the code that allows us to get a new file and recreate your user interface is available in both Mac OS 10 and Mac OS 9 I should have said 8 & 9 because in fact we we support also 8 6 so you can target both platform you have to do your development on 10 but you can target both environments the let's stuff is how do we artifice builder is a building to do the thing we want to do first we were to lay out your user an idea that you want to put button in a window you want to edit your menus and things like that so how you do that we have a wide variety of layout activities and well first one I want to talk about is what we call guides if you use that if has builder several years ago there was a feature called the grid and we discovered that it was not working very very well and it was not working very well also with aqua because it was hard to align object with aqua on a grid so we replace the grid by something we call guides we think it's a much faster way to align object much faster and attitude way to align objects and we have two type of guides we are what we call the aqua guides and what we call the user guides so let's start with the Aqua guides the Aqua guide implements the Equality I really would guide lines that means that this is a way for you to be sure that you are putting your UI at the right place in your window yeah latitude in your window so in the picture number one here I am putting a button and hanging a button inside the window and as I move this button close to the edge of the window lines we show up and show you what what is the right distance for this button to this window you can put it anywhere you want but since we show you where it would be the best place for this button and as you move closer to those guides the button will snap to those lines in the picture number two I'm moving a second button close to the first button and something we tell you where the what is the right distance between the second button and the first button the user the user guides are similar to Zack wise except that it's you can do whatever you want you can put them anywhere you want in a window you have vertical guide horizontal guides we can put as many as you want you define them they are said we don't say it with a nib file so the next time you open the nib those guys will be loaded and something here when you move an object a UI element close to those lines they will snap to the tools to those guides this is useful for example to create templates you want all your different dialogues to look the same and you want to be able to put guides there too to have a way to have your UI looking the same then we have what we call a effect which is it is not a cocoa know a cabin notion it is a pure IP notion the there is a difference there is a difference between cocoa and carbon how are they are the drawing UI elements on on the cocoa everything is drawn inside the frame although there's the shadow of the aqua butter NextEra add the whole inside the the frame on the on the cabin side the shadow is sometimes the woman outside of the control bounds of the control and yak the Aqua guidelines give you some number of saying a button should be not even remember 20 pixel high so the lady I would take matches those those aqua guidelines it's a visual bounding box of an object you can turn them on and off by using command L so in this image I have it was those ahead border or on your objects and also show you the baseline if you have a project that's text but it's very handy to see where where a control hands because of the unity are using the backward and the shadow sometime is hard to figure out where your control really hand we also distance measurement this is a way to measure distance between two objects or between an object in this container so the way you do use distance measurement is are by selecting an object and as you press the option key and as you move your mouse above other objects we show you that those line with a distance very handy feature to figure out what is the distance between two buttons or things like that we have also a full layout menu with plenty of options usually those menu items act on the group of objects so you can align all the edge of the left edge of those objects or the right edges we can make colors you can make holes you can change the Z ordering of objects send them to the back move them to the front very similar to Tuhoe program and also you can make object the same size or make them fit to the content of this subject so different options there we have an alignment panel which is as some of the same function it is at the layout menu plus some other one just a different way to present those options we also have can you change the the clock is still 75 thank you I want to say you have to look all day long we also have a test mode which is not really a facilities but it's a way to see your application Laki we will be at one time I'm sure you've all seen the demonstration of a during the keynote Monday where we were able to drill a full iMovie like application and run it inside a surface builder without click using PBE or comparing anything you're bringing your code inside interface builder and be able to get the full application and test it with in interface builder test mode would work of the boat for both cocoa and cabin containers so HFS builder unforce the notion of a a view year rocky cocoa as a national overview the building block of the user at your face and view as a view as a super view we can have sub views so in the original toolbox Mac toolbox there was no notion of embedding except a button was inside the window but that was I would say there was no notion of embedding with escapa now we have also embedding and objectively embedded into a group box and at the fest builder maintained this year a key of UI elements so if you have a good box and you want to put a button inside this Google box you have to be we have to put it Eddy inside the box up just on top of the box and to do that right now you have to double click on the the good box and you get this ring around the good bugs and says the editor on this good box is open and now you can divide object inside and as you move the box if this thing inside the box we move along with your box what's what we do clipping correctly and everything like that so this is a very important notion if you are using tab view good box you need to open the editor before you can drag something inside those containers so activating Scott Earth's on the on stage you're going to show you some of those negativities right okay so the first thing I do is I'm gonna give just a tiny little tour of IB since I have a feeling a few of you have any of her even opened the application this is our starting point dialog you can see that you can make cocoa cocoa applications and you can also make carbon applications I'm gonna go ahead and make a cocoa one although everything I'm going to show applies to carbon as well this is our design window you can drag widgets from our palette over here onto it and then you can change their attributes their size their connections all kinds of things using this inspector palette over here or info palette sorry we have a document window here which contains our top-level objects we have a window and a main menu and then there's also the files owner and first-responder for cocoa which we'll talk about later so now let's talk a little bit about some of the new layout facilities we have I'm gonna go over it pretty quick since unrecovered it fairly well I'm gonna drag a button out and these little blue lines appear and it'll snap to where the human interface guidelines say that button should where that button should be I know if anybody saw there was an aqua talk earlier or if it's if it's going to be there's this great slide where there's this dialogue I lay it out and there's something like 40 little numbers of where everything should be lined up and when they came to that came to us with with those with those guidelines we were we were pretty spooked by the whole thing so what we do is we compile all those numbers into the application so it knows for example and I'm gonna show the measurement lines by holding the option key down that a button should be 20 pixels from the right and 20 pixels from the bottom so now I'll drag another one out and just like on reso Turnus slides it'll snap and it knows that it's 12 pixels from here and then also 20 pixels from the bottom interesting note with the measurement lines if I hold the option key down over the selected button it shows which guides are apply to that widget so we doesn't we do more than that we know how to do like tabs like for example tabs can be all the way to the left or they can be over a little bit we'll drag that down here they know how far they they should be above a button which is completely different than how far a button should be from say a pop-up button I'm going to double click on this to open the editor and on reman ssin that you have to do that from containment for containment I'm happy to say that in a future version this nonsense is all gone and you won't have to to worry about that and it'll work as it should have 11 years ago so so I'll drag this out we one thing that we do is indention this is really great for preferences dialogues and things like that where you have a header and then you have a lot of checkboxes below I'll drag out a radio button group and as you can see it knows that it's automatically aligned down there I'll switch the tabs I'm gonna bring out a button and I'll make a matrix of buttons by holding down the option key something we hear asked a lot how do I make a matrix well you hold the option key down and you just grow it I'm gonna turn on the layout rectangles and you can see here if I make this a little bit longer then we have the baselines for all widgets that contain text elements this is great because if I want to drag out another message text see how the blue lines align up to all of the base lines will automatically snap so that the last thing I want to show you is user the user guides so I go to the guides menu I can go add vertical guide and then these little blue jobbies they work just like you would see in a page layout program the yellow up above measures the distance like right now it says 56 so it's 56 pixels from the right of the screen and 424 from the left so we'll line this up to our buttons here so they go up and down this is a great way to line stuff up across container boundaries so say I want to drag out a switch or something it'll automatically switch there lay in there if I don't want it to stick to the guy and say you have a whole lot of widgets on the screen and you find the guides to be kind of a pain what you can do is you can hold the command key down and it'll move without sticking to them so some what some people find nice to do is turn the guides off completely and then just know when they know that they really want to be laying them out they just hold the command key down that's all about I have to say say that have to say about that so we've seen how to layout your user interface and what the facilities we have interface builder to do that now let's talk about how do you connect your user at your face to your code you want you have a pattern you want to the user click on the button you want something to happen so in the real facilities we didn't make any distinction between cocoa and carbon they work the same way there is no difference as far except for the the UI elements you have available on the palette there are no differences between cocoa and carbon as far lega lega lega interface builder all the same features when we come to how to connect your user interface to your code this is different Carbon cocoa different frameworks carbon is as is a CPI procedural framework add well whether cocoa is an object-oriented framework any relies heavily on a dynamic feature objective-c so ii thought i did it different framework let's tap is cabin the thing you have to understand is IP does not change the plumbing model of carbon if you know how to use carbon today you can use a checklist video immediately there is we don't invent a new way to program carbon this is just a better way to layout your user at your face and to package your user at your face it makes it easy to use the carbon level model we have some features in IB and make it easier to you for you to use recovery mode model but you don't have to forget you the cabin API T is a semi API so there are two things you may want to do as a cabin developer you may want to get a reference on the UI element and you want maybe also to what you want to get a pointer on the button or a text field and you want also to react to some user action so let's first talk about getting a reference to a UI element so what we do in our head builder you build your user at your face you bring my nose and for window and you can just assign controller ID to control or menu IDs to menu black you will do anywhere else and in your code called the appropriate API the appropriate cable API to get a reference to your account whole like going get controller by ID or to a menu by Korean get many restaurants get on your wife or etc so nothing very unusual to react to user action kappa disease notion of a common tiny now you can si the comment ID to some UI elements so you can assign a comment idea to a menu item or to a control and in your code implement the event and we'll have to process those commands there is a talk right after this one about the event manager and if you want to learn more about the event manager stick around so as you see nothing very unusual just a new way to layout your user at your face and set up to user at your face - so you can connect your users if that's your code so I bring back Scott on stage to show you some of those features you miss me ok ok so I'm gonna go back to our starting point dialog and this time I'm going to create a carbon application I'm not going to show you so much not really gonna show you any code will let the carbon folks do that in the next next session but I want to give you sort of a tour of when they talk about you know the control ID and where to put your h:i commands I want to show you where those are interface builder once again we have the same we have a design window we have a palette all of your your favorite Carbon widgets are represented here so I'm gonna drag out a button and as you can see the guides work in carbon just as well as they work in cocoa I'm gonna bring up the inspector here and I'm gonna switch to the control pain and here's the signature that you would use by something like like in get control by ID you fill up a little struck this is you're gonna type something in there and you remember it you're gonna put it in that struck and here's the H I command so you you've seen us do in demos past where we put quit and it's automatically been sent to the nearest handler that listens to it so what you would probably do is you would put some sort of command of your own working in there and you listen to it in a window controller or something like that that's all I have to show for that one it's a quickie clean this up for me thanks so a quick demo on cabin as I say there is a choke right here right after this talk about cabin even manager and you'll be able to learn more about how to use the cabin even manager cuckoo now there are four important cuckoo ID concept that you need to understand to be able to use IB and cuckoo those those four notions are the notion of outlet target action files owner and first responder those are very important to understand because you have to use that become just say oh I don't know I'm gonna skip files on I don't want to know about this one you have to understand all of that so let's let's start so an outlet analysis an essence variable that points to another object just an SS variable just another fancy word for Aniston's variable to point to an another object that means that unless an outlet cannot be an int or float it has to be a point to another object what do we call them an outlet because this is a specialist and some variable that you are not setting this value back by code by writing code you're setting this value of this random variable within a FS builder by making a connection between an essence variable of a class and some other object you're making you can set the value of this outlet so here I have a class food that has two instance variable or window in a button and I can in a FS builder set the value of this subject with not access builder without writing any code so at one time the subject will have those values their target an action target is an object responsible for responding to a user's action just an object the action is a method in this object that specify what the object is to do so a lot of object need kids have two instance variable called target in action and as control and spa new item I have those kind of instance variable those 2,000 variable are like outlet we can set them using at a phase builder the first one the target is a pointer to an object when I press this button I want this object to do something and the action is I want C subject to do something I want to do is this I want to execute this piece of code so in this case the target is a pointer to this subject and the action is the method within this object that's going to do something when you press the button but the reaction have a specific pattern they do something with one parameter which is the sender and it's in this case of a button the sender will busy the button itself so as I say what is the whole butterface builder is regarding outlets and target action is to graphically connect those outlets and those target action together all those connections are saved in the nib file along with audio objects and at one time all those connections are put back together like if you were doing it by program except you don't do any programming here I would let subsets control menu item are ready to trigger the appropriate code this is what outlet action and target actions are now first owner and first responder the two big one if you look if you look at a document window at a phase below you see all those icons and there are two important icon in there which are the files owner and the first responder and their name is grayed out because you can't change the name of those objects but those are not real objecting in a nibble they are just proxy objects they are standing from so from some other object that are outside of the nib file those objects are not instantiated with all the other object that you have in your nib file in an if I grab a window you have a menu excetera whose object that coming back to life when you wrote the nib but those two objects are not they already exist before you started to load a nib file so I'll just proxy object the files owner as I said just n distinct object its external to the nib file is already an instance of this object somewhere in your application B even before the nib was loaded and you're passing this object to the the Col that allow us to load a new file in this case we are using load nib name passing the name of the nib and passing this files owner what so all of this foreigner it's always to channel messages between objects that enact light from the nib and object that I would start your application imagine your nib as little bubble of object and if there was no file on there would be no way to reach what's inside this bubble you need some some way to to hitch inside the nib file when the nib file is loaded and this object is the files owner first responder it's also a proxy object means it's not as sensitive in your nib file the first object the first responder is more of a status given to an object than a real object the definition is that it's the first object in the responder chain to respond to a message so as I say the files owner with the real object the first responder is what it is different object depending on the situation of your application where you where your application is what you have been doing with your application so let's also let me explain what a responder Chinese first I'm getting confused here so let's explain first what the responder Chinese so I have a vast monitor which is not completely right it's just for an example it's a lot of missing object in this way smaller chain but is just to show you how things works so I have an application I have this application as one window and inside this window I have a control which here is a text field and the user is typing in this text field as a user type in the text field we pull down the menu and choose hide window so the high window miss a menu item was connected to the first responder so the high window message is sent and he goes to the object that acts currently as the focus which is a text field the text field is knows nothing about hide window so it says it pass it to the next responder which is the window and the window says yes I know how to hide my window so hide the window so by connecting to the first responder you're connecting to whatever objects that are currently in the responder chain that can answer this message so this is a very useful concept the first responder is useful to collect line and action to enhance unspecified instance of a target you have ten textfield in the window you don't want to connect your cut copy paste when you attempt to every Texan in your window you just want to say connect it to the whatever text field ask you what he has a focus and you connect it to the first responder you can also use the first responder to connect an object to another object outside of your nib file as long as this object is inside the target chain so far we do use that with a port for any application which is never in a nibble but you may want sometimes to connect a menu item to some action in your application a good way to do that might be to use the first responder to connect your menu I turn to the first responder and the application will get this message if nobody else is getting it so now being squatters back on stage to the big demo this one's hard so the first thing I do is show you the application that we're gonna build to demonstrate how to add an action to first responder and how to connect your interface to it we're gonna do it with this little application here if you look on the window on the right it's the frontmost window which means that you can consider it to be the lowest object in the responder chain so when I say toggle picture that there's a message that we're going to with there's an action rather that we're going to add to first responder that is implemented by this Windows controller and so because this window is the frontmost window it's going to get that action first and it's going to toggle the picture this will hide this let's go to our project there's a little bit of code that you need to see this is our NS application subclass all that's going to do is it's going to create two of our toggle controller classes and those those toggle controller classes are what create the window and handle messages that come come to in front so this is the the header for the toggle controller there's two things I want you to see here we declare an outlet to what's going to be an NS image view called picture outlet this header file also implements our action called toggle picture action or toggle picture we have these two little blurbs here called IB outlet and IB action which actually sort of no loud they don't really do anything but what that allows that Ivy to do is look for your header and parse those those these outlets and actions in we have two nibs we have a main menu and we have a toggle window so let's first take a look at our window you saw this earlier there's no picture in it right now because the code actually puts that in what we want to do is we want to hook this window up to our toggle controller code before we can do that we have to tell the nib what is a toggle controller so we go to the classes pane here we go to the classes menu and we say read files and what we can do is we can find our header file so here it is toggle controller and we can parse it and if you look down here it's realized oh this is here's toggle controller and not only that but it's an NS window controller it's already figured out from the header what type of subclass it is I'm gonna click the little actions Deeley here and we can see that it's found our picture outlet it's also found the window outlet that comes from NS window controller and it's also found our toggle picture action and then another action show window that's also implemented by NS window controller so we've told the nib hey here's what a toggle controller is so now we need to tell the nib that you're actually going to be loaded by a toggle controller your files owner is a toggle controller right now it's just it doesn't know so it's just at the NS object if I scroll down we can actually click the toggle controller here in the files owner attributes pane on the inspector so now that we can now that we've told the name pay files owner is the toggle controller we can go about making connections to it so I hold the control key down and I drag from files owner and the first one I'm gonna do is our picture control and you see how it highlights it it's going to bring up the connections inspector and here we go here's the picture outlet so I'll click that and I'll click connect now we need to tell now that we put the picture control up we've we've done sort of all the connections for our toggle controller we need to go about and do the ones that NS window controller wants namely it wants to know what window it's supposed to be controlling so I'll hold the control key down again and this time I'm going to drag from files owner to the window so if you look right here in the connection inspector click on window click connect so we've hooked all of our outlets up but there's one thing we haven't done yet we haven't inserted our toggle controller into the responder chain so remember how unrealistic view of what the responder chain is well there's one more little thing if NS window can't respond to your action it'll try it's what's called its delegate and that's how we're going to get into the responder chain we're going to set our toggle controller to be the delegate of those windows and how I do that is by holding the control key counter control key down again go from window two files owner and I can set its delegate and I hit connect so that's done I'm gonna close that now let's take a look at our main menu nib open this up so here's our main menu editor here's our toggle picture command we want to make an action you want to drag an action from our toggle picture to the first responder but out-of-the-box interface builder doesn't know anything about that action and toggle picture so we have to tell it again so what we do is we go to the classes pane and I'm going all the way to the top we're first responder lives never go to the classes menu and I'm going to say add action and I'm a type toggle picture all these other ones that are in gray are sort of convenience ones that we know that a lot of other stuff implements and so we put those there for you just sort of for your convenience but we have to add this one because like I said 11 years ago we had no idea if somebody was going to make something called toggle picture so we have to do it now that we've put the add that it added that to first responder we can drag a connection so once again with the ctrl key drag it down to our first responder so we want to set the menu items target to be toggle picture so I hit connect and if I've remembered my script that's all we have to do so I'm gonna go here and I'm gonna build it just probably kill this one just to prove that I'm doing it and we'll run it so here's our frontmost window and oops I forgot to put something up with an uppercase T what's that you put a back st huh you type toggle picture with a potato pockets T indeed you were supposed to shout that out when I did that you're not much of an audience uppercase T ah there we go yeah so the only thing we don't do is spell checking in the control in the connections inspector thank you so those notion of out liaise tacit action files on our first a small are very important charge on the first is in first Espada are difficult notion and and they are quite unusual in in there are only in the in this environment so they are difficult notion that they are very very powerful and you can do anything you want with those two notions so look at them practice look at those occurred it's very important to understand the notion of files owner and first responder to really be able to develop a cocoa application so you've laid out your user interface you connected your code you user interface either for cable and cocoa and now you want to load this user interface it inside your application so here again there is a difference between cocoa and carbon in carbon that there are no objects so you have to explicitly load your user at your face and get object outside of the nib in cocoa this is more or less automatic there is there is also also a need which we call we call the main nib which is automatically loaded when your application is launched and also on it can be loaded on demand so let me go first explain about carbon in carbon there is one a header the ID cap on one time dot edge which has six functions a very small API and this all the the six API allows you to load a new file and get anything outside of this nib file windows menus etc those api's are available on Mac OS 10 that particular carbon framework so if you using your linking against carbon you're already getting those API is ready to use and on a quest time we are Mac OS 9 and 8 should have say 8 also we are part of carbon nip since 1.1 so you can use nib file and use the same API the same code to load your nib file on a 8 or 9 so here I have a typical small application cabin application that which by the way will run perfectly well and what I'm doing here is that I'm first getting a reference to an e file I called head need reference passing the name of the of the need file and I get back any preference I can then ask for the the money bar inside this nib file and I up happens I call my money back money bar in my nib file so I can say set the main menu many bar using the minibar that's inside this nibble I can also then create a window from the nib file sensing passing a dim electrons passing the main window the name of the window you want to extract and you get a window at the rows I immediately dispose linear fairness you should not keep those nibbler famous around because we are loading in some XML file etc you want to get rid of them as soon as you are done the window was created invisible so now you just say show window and the window pops on the screen and you can go and run go and talk and call one application event loop and you done and this application will run fine providing a nib that has those two two objects that will put a mini bar and a window on the screen cocoa so for cocoa there is one special need file which we call we call the main nib file it's this nib file is automatically loaded at lunchtime when you launch a cocoa application the main nib file is automatically loaded the name doesn't have to be main you can be anything you want you can go into project builder application settings tab and you can change the name of this neighborhood where you want usually this nib file should contain the money bar at least the money bar because this is the UI that you want to come up immediately when you launch your application so the a good place for your money bar is inside the main nibble the files owner of this mainly will be the application object because the application is loading this nib file so this is a good press for example if you want to connect some money right turn to the applicant application properly implemented some code in your application and you want to collect money write em to your application you can define those target action those action on your files owner which is the application and connect your menu item to the files owner because the fastener is the application author hip file should be loaded lazily you can explicitly load an in file using NS bundle or name name owner we have also some other API to load deep file but this is one the one of the most use you can also use a test window controller is it's a class that you should try to use whenever possible if you the window controller the window controller is created outside of the nib and the fair owner of this nib will be the window controller we've just added a new sample in the city you got at the conference called simple multi window it's a cocoa sample that shows you how to create an application with beautiful nib and how to use window controller so now I'd like to go and cover some tips and tricks on things that you need to know about on the test builder that will make it make your life much easier and I was - so let's go some tips and tricks here first an important one do not put all your UI in one big giant niba this is not the way nib file should be used this is very important for people cabin developer which are used to a resource for with a bunch of dialog the IDL or the application in one big huge resource fork need file not his source files and should not be used like you used to use resource file you should wake up to your UI in has been in IBAs possible because when you wrote a new file in cocoa when you wrote a new file all the object in this new file will be loaded automatically all windows will be accentuated everything will be loaded at once on the cabin side there are no object but still will be loading a lot of extra XML just to for you to get one window so if you backup your UI in multiple nib your nibble goes faster and also it will facilitate he use if you have this nicely about box you want to reuse and another application it's much easier to just copy your nib file and your source code and bring it to the other application instead of trying to extract your your window your controller etc so break up your UI in multiple nib as an example here I have a cabin application a bad cabin application which has four windows and an ammonia bar this application has a mana bar a main window and about box connection panel and some craftsman's panel this is this is bad this is not the way you should do it what you should do is that in this case for neither one with your main window and your main menu because in this case this is a single single window applet type of application with one window in the menu bar so you put your window and your money back to your main nib you'd load this UI when you launch your application then you need to have a nib with your about box a nib with your connection panel and a nibble your preferences if the user never used your preference or your ballot box there's no need to load this nib file top-level objects qapla will object this is specific for Coco in a new file you have this document window with a bunch of icons and we talked about the first the files owner and the first responder which are not here objects are just 10 proxy object for object that are outside of the nib file but here I highlighted three objects here is a minibar a window and a controller object this is for cocoa carbon and not have to worry about top-level objects too much so typically this is what you used to have in the nib file traditionally used to have a controller on Windows and an minutia we've added new object essentially to I think you can Astin shit-ass top-level object so you can instantiate now a formatter subclass of an S format so you can share your matter among multiple text field usually the way to do that was to drag will form a turn onto any H text field and you had a formatter for each text field now you can share your formatter among multiple text field or share them inside the window we've also added added a view as a top-level object which means what we call windowless view it's a view that stand by itself and it's not enclosed in any window I will talk later about that you can also accentuate a single menu this is very useful for contextual menu NS view as an outlet which is a menu if you connect this outlet to a single menu we automatically have a contextual menu without doing anything we also had this feature of a cable in carbon you can instantiate basically not instantiate but you can create menu I'm only bar window and you can also get a single menu if you want to use for contextual knowledge so new type of top-level objects and I will talk more about the view in a few minutes though I'm talking about those top-level objects because of graph counting you know that cocoa use reference counting so an object is created if you call a log in it your head count is one creating an object in a nib file that is exactly like calling a lot in it if you instantiate a window inside the nib file it's like in your code cooling and that's window I login it but whispers Ixtapa rameters so this is really creating an object and you get an object with the ref count of 1 which means that if you don't do anything you have a leak because you're adding a nib file and so that his nipple is not needed anymore those object are still there someone asked to release those objects so the whole of the who should be the subject is usually the files owner the way to do that for example would be to have an outlet inside your file owner that will connect to a window or connect to another object inside your nib and when the controller decide the files owner decide that this nib is not they did it will release those objects this is very very important there's one exception a nest window has this little flag kiddies on clothes which means that means when I'm close delegate of myself so it just it is itself so another an NS window you don't have to worry about that because if you set this flag here isn't close it will go where automatically for all other object have to be very careful that someone has to only subject someone has to have an outlet on this subject and knows how to release it when you end up with a neat file table window let's view this is new interface builder and so very very useful feature he allows you to create a view without analyzing window to do that you simply drag a custom view you have a custom object on the palette you just have to drag a custom view inside your document window and you have to send me instantiate an NS view you can then change the class obviously NS view can be my view whatever this eliminates the need to create a window in a couple of years ago but yet we need what you have to do is create a window at one time get an out that I have an outlet on this window get a get a pointer to Z to the content view and get rid of the windows we have to write a little bit of code to just get a view by itself is out a window you don't have to do that anymore now you can just create a view you can put control inside this view and you can just as some share this view by itself which big missing or so that something that's important a new feature in anti-phase builder for people who use cocoa for a while we can also now on bed control in a custom view is something you could not do before you can only run bad thing into a good box or something like that you can use now a custom view as a container so we use this windowless view as the content view of an asteroid this is one of the use edge we have a windowless view there you can use we know the tree for anything you want be very careful with the red counting again this view is going to be created if you have an outlet with this view and you'd put this view inside another of you know the ref count is to the this coating in Viggo's aware the ref count of your hue is still one so it's not going away you have to be careful of the reference counting we have the windows view encoding cabin and we bring that to Cocoa so he works at cocoa and bring that in cabin where you'll be able to create a user pain without a view and be able to manipulate this user pain and put it wherever wherever you want so that's the future feature for cabin post nib loading in initialization I think that's one of the question that come up the ball often on different mailing lists I had this subject in an e band I overheard you need with frame and my ETA scram is not cold why because the hole here is do not don't rely on in it in it with frame or a hit with code to do any post loading post nib loading initialization the way to do that is to implement awake from nib any objection optimal awake from nib and when we load a nib file when you a stanch at all those object the last thing we do is that we we ask every object do you map limit awakefromnib objects a yes we call awake from nib this is the last thing we do so at this point all object and instantiated basing your nib is it it's been associated all the outlet target action has been set so you're all the rabbit are ready to go so never try to override init init with frame or any piece coder to do any post need bloating indigestion amp limit awake from me this is the right place to do that neat tool Newton is a handy little tool is a command-line tool that we have that allows you to manipulate the content of a nib file without using a TFS builder it's a command line tool it works for both cocoa and Calvin so you can we can boot can both accept cocoa and carbon nibs and there are a lot of options we just added a man page to nip tool so you have all three option using man page it's used by fan mirage too deep to nibs cocoa nibs are binary so farmers cannot show you the difference between what changes on him files so what farmers does is that he invoked near nib to on those two nibs asking him to convert those to knead into a textual representation and then you can differentiate you can do a diff of those two nib files with adding we've added a feature recently to allow localization of vani file using it using using neat tool so let's say that you have a friend in English nib and you want to translate it into a French neighbor one way to do that would be to open your English deep into NTFS builder and have someone to go out figuring out where our the strings trying to find where the strings are so we can localize those strings there is a new way to do that now what you can do is really you can use nip tool and ask nip to to extract all the strings from this new file so the output of need to rebuild a text file that looks like Hello equal ello close equal close open a call open but it's a way to extract all the strength from his nib tool we can then send this text text file to a localizer and ask him to translate the right side of the strings of the equal sign and when you get back here your text file localized you can send it back to dip tool using the original English nib file and cut a finished nib ID will know where to put back those strings in the right place so you may have to go back and still open the dip file and readjust some button would mean too short or too long but the you can make we can make the requisition a lot more automatic and in fact it is one way we're doing that at Apple to localize nib files we have a process which is a little more complex than this one that huge neat tool to localize automatically all the nib file without any intervention of an open Janelle so there is a session first day on how to localize your application and if you're interesting a hard to look at look at that go to this session update schedule so in the box that came with Mac OS 10 there was a developer CD and on this in this on his CD there wasn't a face bill Direction 2.0 I think I I be was version 1 2004 15 years so we decided it was a good time to go to 2.0 so this is version 2.0 we know a ship English on 201 at the other conference and it's mainly big bug fixing we have some bugs fixed for web objects as many bug fixes are no new feature there but we've added two new example we have an example called busy palette and simple multi window this was a both cocoa example the busy palette is there been a lot of demand recently for people wanting to write palettes and we haven't talked about that today but this sample is a complete palette example that shows you how to support undo in your object when you're working a palette to show you that how to write an inspectors show you will show you how to write multiple mode for the inspector for example when you dragon a formatter on the text field we get another inspector so how to add and spectra to the inspector window the f4 window but this is a full complete palette sample that I'm sure a lot of you will find very useful there's also a simple multi window example which I took before showing you how to write an application with beautiful window using a nice window controller interface builder will be released what really you're doing using the quaterly developer update so as we have new features and bug fixing bug fixes you will see a new version of ib coming out and I just want to talk briefly about what's coming up what new feature we have scheduled for at a phase builder first we want to concordia concentrate on the stability of the product you want make it faster stable easier to use as far as easier to use and Scott Scott was talking about that we got a lot of feedback about how you added those container you have to double-click all these things so we are changing that you'll find a much better more intuitive way to edit containers we won't have to double click all these things be much more natural we're also changing the UI to define outlet and action I think a better UI to define what I would attend actions for people who are familiar with a face builder there is a clown Coco's there is a class tab and right now it shows an outline view we are also giving you the choice to use a browser view which is much easier to navigate and also give you a search feature so you can type NS view and it's going nsv and it going to go to NS view automatically we are also adding flagging of unconnected outlet and actions the target actions this is very useful because sometimes we have if you have a very complex use of at your face and you're a lot of menus item lot of controls you may miss the connection and sometimes you don't own some wire application doesn't work so now we will be showing you what is and not connected in a a face builder for example it's very important that if you have a nice window controller that the the window out read to be correctly connected to the window so if you don't do that your application may not work so we'll be flagging those unconnected outlet and actions we want to continue to improve ppi be at regulation we want to take advantage of the and extra in PB so this is something important we like to be able to use and also we continuing to close it hot cocoa and cabin frameworks cocoa and cabin are adding new features new UI elements and you want to have IB to always be on top of that always be ready for you to use those new you guys and in both cocoa and Calvin so we are working in fact we are a part of the cocoa and cabin teams and we we talk very closely what what changes are met with those two frameworks to bring you the latest user interface and we have a lot more ideas and features coming up pretty soon so I like to bring back got faith on stage and I went very very fast today so we have time for yes really thank you very much hungry pretty amazing stuff the use of interface builder for carbon and cocoa really ensures much much better aqua user interfaces it's an essential part of the cocoa development and really helps you use your carbon events to the greatest effect on the screen right now information resources again our information pages for all Mac os10 tools the project somebody somebody copy and paste of the wrong should be the interface builder webpage there and below that the master mailing list page for for all the all the different mailing lists that we supported Apple there's project builder users there's Coco dev there's also carbon dev and the web objects lists all of which we'll be using in interface builder a roadmap for more sessions a carbon Event Manager right here after this after this session tomorrow using cocoa actually Thursday using cocoa and the advanced cocoa topics and the Mac os10 application localization and now if I can have the house lights up people can start coming up to the microphones to ask their questions this is my contact information if you have strategic questions regarding tools of any sort I am your technology manager to deal with those and also for feedback to the Mac os10 Tools groups we have a mailing list direct a mailing address specifically for that purpose you