yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

xCode Lesson 1 (Build An Interface)


3m read
·Nov 3, 2024

Processing might take a few minutes. Refresh later.

Mid here today, this is a um Xcode lesson. One, we are going to show you how to lay out your interface. Um, so let's get started.

So the first project we're going to be making with Xcode lesson um one is hello world, except I don't like the name hello world, so we're going to call it hello Taco. So you want to go, first of all, uh just jump too many steps ahead under Mac OSX application, Coco application, then choose that. And this is the latest version of Xcode, then I'm going to call it hello taco. And now let's click save.

So now let's create a folder on my desktop called hello taco, and you'll notice we have a few files here, and Main menu.xib happens to be one of them. We can just double click that and it will open up our interface. Um, so right here we have this little menu bar, the dock window, our main window, and I happen to have this um, the library. Now the library will probably not be there on default, so you can go up to tools, library, to show it in tools attributes inspector. We also want to do that to show the properties for everything.

So first of all let's edit our main menu bar. It should be right here; if it's not, just double click in the file menu main menu, and you can just double click on this to rename it. And I'm calling it hello Taco. Okay, so that's pretty cool. Now, right now, first of all, we have a few things about new application preferences, so we're not going to call about new application; let's call it hello Taco. Um, right here, Hide, let's just make this say hide, and let's just make quit say quit. So okay, so that's good.

So now these menus also have to be here, because if you delete them, it messes up everything in Interface Builder. Okay, so do also want to fix this and make it um, hello Taco help, so that just personalizes it a little bit. So here's our window; you can see in the attributes inspector, if you don't get that by the way, just click window in the files. You can set the title of our window. I'm going to call it hello taco, and um, I'm going to make it so you can't resize it or minimize it, and I'm going to check off textured just to make it have this nice gray textured feeling.

Okay, and visible launch is good; hide on deactivate, that's bad. So these are just a few properties you can go up to the ruler tool and move it to the middle of the screen so that it opens up in the middle of the screen when you open it, and um, yeah, so that's how to set that up.

So now we want to go into the library under Library, open up Coco, and here are going to be all the controls and stuff that you can drag on. This is a very simple interface. First of all, we want to drag on a label and make this label, let's just hope that's close enough to the center say name, and then under here I'm going to drag a text field on. Okay, cool.

So now I'm just going to make this a little less tall, and now let's put a button and the label here. So first of all, let's shrink this down, move this over, put the name here, the thing that says name there. Okay, so here's how to lay out the interface for our hello world. So now let's drag on just a textured round button, but um, you can also do this kind of button, this push button; they're the same class, so they're the same thing.

Have to make this a little wider. Okay, so now, wow, you can double click that to set the text, and I'm going to make this say go. And then right down here, I'm going to drag on two labels, this one and this one, and I'll put these right next to each other. This one will say hello, this one will have your name.

Okay, so let's just give you an idea of what this application is going to do. This application is very simple; first of all, you type your name in this box, click the go button, and then it'll say hello, and then your name will go right there. Remember, these are two separate labels, so that's our interface.

Now we can also click these labels, I'll select everything and go up to the ruler and set them to be in the middle and in the middle there, so now they're perfectly set. So um, yeah, this is turning out to be pretty cool. You can also make that a little longer just in case.

Okay, so let's get us all centered again. Okay, so pretty cool, so now that u...

More Articles

View All
Continuity and change in the Gilded Age | Period 6: 1865-1898 | AP US History | Khan Academy
The Second Industrial Revolution in the United States assured in new technologies and new ways of living and working during the Gilded Age. Steel, electricity, and the telephone allowed railroads to crisscross the country, skyscrapers to rise out of citie…
World War I: Homefront | Period 7: 1890-1945 | AP US History | Khan Academy
In 1917, the United States entered World War One on the side of the Allies. After several years of neutrality, Woodrow Wilson, who was serving as president of the United States at the time, even campaigned for re-election on the slogan “He kept us out of …
The FED Just Crashed The Market | DO THIS NOW
What’s up, guys? It’s Graham here, and, uh, welp, things got worse for anybody looking at their portfolio wondering why they can’t seem to make it green. Unfortunately, turning it off and on again isn’t going to work because inflation just came in signifi…
How to Find a Technical Cofounder - Michael Seibel
One question that we get a lot of at YC is how to find a technical co-founder. This is how I would think through this problem. First, I would start with your friends. Um, how many of your friends do you really enjoy talking to and who know how to write c…
Why AI Data Centers Are So Important For Development
This is the biggest problem we have in terms of staying ahead in AI, particularly for defense. So, this issue, which you saw manifest itself in the last 24 hours, is about data center costs. Each center costs $2 to $4 billion. There are only 25 teams tryi…
Strong acid solutions | Acids and bases | AP Chemistry | Khan Academy
A strong acid is an acid that ionizes 100% in solution. For example, hydrochloric acid (HCl) as a strong acid donates a proton to water (H2O) to form the hydronium ion (H3O+) and the conjugate base to HCl, which is the chloride ion (Cl−). In reality, thi…