[Load custom controller Objective-C language]

1. The next operation is more critical.

1. Earlier, we started from UI basics, then to UI advanced, on the first day, and so far,

notify

In all applications and newly created projects, after startup, are the loaded controllers the controller with the arrow in Main.storyboard?

Then, you can also create a new storyboard, and then drag a controller into it,

For example, drag a UITableViewController,

Is it possible to configure it so that it can load this storyboard?

2. Then, what we have to do next is to load your custom controller through code.

This is something you must master,

There's no room for negotiation.

Later, in the process of learning later, we often use,

Then, in your work projects, always write,

Understand,

1) Load custom controller,

notify

2) Then, where is loading a custom controller implemented?

notify

I turned this off,

Create another project:

notify

Create a new project:

notify

Give me a name,

notify

- Load custom controller

notify

Then, click Next, look at the previous serial number, and then come back and add the serial number.

notify

02 - Load custom controller

notify

Just in our code today,

notify

Click Create:

notify

Click on the AppDelegate.m file on the left:

notify

Come and see,

notify

Let's talk about it. Usually, when we operate and load a custom controller,

notify

An action to load a custom controller:

1) Earlier, when introducing this proxy method to you, we said that after the loading is completed, can we perform some custom operations:

notify

Yes, when we load the custom controller, we also load your custom controller here.

As for us earlier, I don’t know if you have ever used a custom controller, no, no, we are going to learn it today,

First of all, I need to explain to you the basic operation process.

Load custom controller:

1) For a basic operation process, if you want to load a custom controller, then you definitely don’t want the ones provided by the system.

notify

Right, so, let’s delete the ViewController “dot” m, “dot” h, and then the storyboard,

1) viewController.h/.m, Main.storyboard, delete

notify

Is this font too big? Let me make it smaller.

Select these words, command + - (command plus minus sign):

notify

This is the first step. After you delete these things, what about the second step?

2) After deleting this, we, by default, do the system require you to have a Main in this configuration file?

In info.plist, Main storyboard file base name: Main,

notify

Is there a Main here?

It will load this by default, but after you delete this Main.storyboard,

That Main will never disappear.

Delete these three,

notify

Move to Trash directly

notify

But if the system provides some framework or something, you don’t want to Move To Trash. That’s very dangerous.

It doesn't matter, but is it still in info.plist?

notify

Therefore, your second step is to delete the storyboard file name loaded by default in the configuration file.

There's no problem with this, right?

I won’t delete it now. I’ll show you its effect first.

notify

Change the simulator to iPhone6S

notify

Don’t delete it yet, let’s take a look at its effect.

Let’s see what fault he will report to us,

command + R

notify

Did it just collapse?

notify

Take a look at why it crashed. You may also encounter this problem when writing.

notify

Terminating

Guess you like

Origin blog.csdn.net/madoca/article/details/134028398