Now that you have some experience
presenting off the shelf
view controllers,
you're probably wondering how to present
your own custom view controllers.
Here we have an app that
simulates rolling dice.
The first view controller with
the roll the dice button,
presents a second view controller
that displays a roll of the dice.
The second view controller can be
presented in the same way as the camera
roll or the activity views and
alert views.
But this time we have full control
over the displayed view controller.
The app is currently incomplete.
In a second, you'll be asked to download
it, and look at the Xcode project.
But before we get into the Xcode files,
let's pause for a second,
to draw the object diagrams for
the two view controllers.
That way we can clarify
which IBOutlets and
IBActions the project should contain.
The first view controller is simple.
It's just a single button
with a single action.
This is the action that should
trigger the presentation
of the Dice View Controller.
The Dice View Controller
is slightly more complex.
It needs outlets to these two
image views that are for the dice.
It also has one button
with a single action.
This action will cause the view
controller to be dismissed.
If you look in the instructor notes
you should see a file called dice.zip.
Go ahead and download that file and
then examine the Dice Xcode Project
with the following questions in mind.
Check off each question
as you find the answers.
لقد حصلتم الآن على بعض الخبرة
في وحدات التحكم
،في العرض الجاهزة
وربما تتساءلون حول كيفية تقديم
.وحدات التحكم في view المخصصة الخاصة بكم
ونستطيع هنا الحصول على تطبيق
.يحاكي الزهر الدوار
تقدم وحدة التحكم في view الأولى
هي وزر تحريك الزهر
وحدة تحكم في view ثانية
.تعرض حركة الزهر
كما يمكن تقديم وحدة التحكم في view الثانية
بنفس طريقة تدوير الكاميرا
أو طرق عرض النشاط
.أو طرق عرض التنبيهات
لكننا لدينا هذه المرة التحكم التام
.في وحدة التحكم في view المعروضة
.والتطبيق غير مكتمل حاليًا
وخلال ثانية، سيُطلب منكم تنزيله
.والنظر في مشروع Xcode
،لكن قبل التوجه إلى ملفات Xcode
،دعونا نوقف التشغيل مؤقتًا لثانية
ونسحب مخططات الكائنات لوحدتي
.التحكم في view
وبهذه الطريقة يمكننا توضيح
خصائص IBOutlet
.وIBAction التي يتعين أن يتضمنها المشروع
.ووحدة التحكم في view الأولى بسيطة
فهي عبارة عن زر واحد
.بإجراء واحد
وهذا هو الإجراء الذي ينبغي
أن يشغل العرض التقديمي
.لوحدة التحكم في عرض الزهر
ووحدة التحكم في عرض الزهر
.صعبة أكثر قليلاً
فهي بحاجة إلى مخارج لعرضي
.الصور هذين الخاصين بالزهر
وبها أيضًا زر واحد
.بإجراء واحد
وسيؤدي هذا الإجراء إلى تجاهل وحدة التحكم في
.view
ولو نظرتم إلى ملاحظات المدرب، فينبغي
.أن تشاهدوا ملفًا يسمى dice.zip
امضوا قدمًا ونزّلوا هذا الملف ثم
تعرفوا على مشروع Dice Xcode
.مع وضع الأسئلة التالية في الاعتبار
حددوا كل سؤال
.عند العثور على الإجابات
Agora que você tem alguma experiência
na apresentação de
controladores de exibição de prateleira,
você provavelmente está se perguntando
como apresentar seus próprios ViewControllers personalizados.
Aqui temos um aplicativo que
simula o lançamento de dados.
O primeiro ViewController com
o botão de lançar dados
apresenta um segundo ViewController
que exibe um lançamento do dado.
O segundo ViewController pode ser
apresentado da mesma forma como o rolo
de câmera ou as exibições de atividade e
janelas de alerta.
Mas desta vez temos total controle
sobre o ViewController exibido.
O aplicativo está no momento incompleto.
Em um segundo, você será solicitado a baixá-lo,
e olhar para o projeto Xcode.
Mas, antes de iniciar nos arquivos do Xcode,
vamos pausar um segundo
para desenhar os diagramas de objetos para
os dois ViewControllers.
Dessa forma, podemos esclarecer
quais IBOutlets e
IBActions o projeto deve conter.
O primeiro ViewController é simples.
É apenas um único botão
com uma única ação.
Essa é a ação que deve acionar
a apresentação do
DiceViewController.
O DiceView Controller
é um pouco mais complexo.
Ele precisa de saídas para estas
duas UIImageViews que são para os dados.
Ele também tem um botão
com uma única ação.
Esta ação fará com que o View Controller
seja descartado.
Se você consultar as notas do instrutor
, deverá ver um arquivo chamado dice.zip.
Vá em frente e baixe o arquivo e, em
seguida, examine o projeto Xcode Dice
com as seguintes perguntas em mente.
Marque cada pergunta
conforme encontra as respostas.