Now we're going to set
up a simple project, so
we can experiment with presenting
stock view controllers.
You're probably familiar with views like
the Camera Roll, Activity Views, and
Alert Views.
These are off the shelf view controllers
which we'll present without modifying
Apple's code.
To get some practice with presenting
off the shelf view controllers,
we'll make a one button app
with a method named experiment,
which presents one of
Apple's view controllers.
It'll look something like this.
One button which presents
the camera roll, and
the experiment method will
look something like this.
In this method we'll need a reference
to the view controller we're
about to present.
So how will we get that
view controller reference?
We'll just make one.
So here we invoke the constructor for
the view controller required to select
an image, and then in this line,
we present the image picker.
Now see if you can repeat
this experiment on your own.
Just create a single view project
with a button labeled Present, and
then connect that button to
an action named experiment.
If you get stuck, consult
the steps in the instructor notes.
But first try to complete
it without peeking.
Again, your app should
look something like this.
When you're finished,
describe your level of confidence
working through this exercise.
الآن سنعد
،مشروعًا بسيطًا
لذلك نستطيع أن نجرب تقديم
.وحدات التحكم في عرض المخزون
قد تكونون معتادين على العروض مثل
تدوير الكاميرا وعروض الأنشطة
.وعروض التنبيهات
وهي مختلفة عن وحدات التحكم في العرض الجاهزة
التي سوف نقدمها دون تعديل تعليمة
.Apple البرمجية
للتمرس في تقديم
،وحدات التحكم في العرض الجاهزة
سوف ننشئ تطبيقًا أحادي الزر
،بطريقة تسمى experiment
التي تقدم
.وحدات التحكم في عرض Apple
.وسوف يبدو هكذا
زر واحد يعرض
أسطوانة الكاميرا
وسوف يبدو أسلوب التجربة
.هكذا
في هذا الأسلوب، سوف نحتاج مرجعًا
لوحدة التحكم في view
.التي سوف نعرضها
لذا كيف سنحصل على هذا المرجع
لوحدة التحكم في view؟
.سوف نصنع مرجعًا
لذا سوف نطلب من المعلم
الذي يدرس وحدة التحكم في view اختيار
،صورة، ثم في هذا السطر
.نقدم منتقي الصور
الآن فكروا في إمكانية تكرار
.هذه التجربة بنفسك
فقط أنشئو مشروع عرض فردي
بزر يسمى Present
ثم صلوا هذا الزر
.بإجراء يسمى experiment
،وإذا تعثرتم
.راجعوا الخطوات في ملاحظات المدرب
لكن أولاً حاولوا الإتمام
.دون اختلاس النظر
مرةً أخرى، يجب أن يبدو تطبيقكم
.على هذا النحو
،عندما تنتهون
صفوا مستوى الثقة الذي اكتسبتموه
.أثناء العمل خلال التمرين
Agora vamos configurar um
projeto simples para que
possamos experimentar a apresentação
StockViewControllers.
Você provavelmente está familiarizado com
exibições como Rolo de câmera, Exibições de atividades e
Janelas de alerta.
Eles são controladores de exibição de prateleira
que nós vamos apresentar sem modificar o
código da Apple.
Para obter alguma prática na apresentação
de controladores de exibição de prateleira,
nós vamos criar um aplicativo
de um botão com um método chamado experiment,
que apresenta um dos ViewControllers
da Apple.
Vai ficar parecido com isto.
Um botão que apresenta o rolo da câmera,
e o método
experiment será mais ou
menos assim.
Neste método, vamos precisar de uma referência
para o ViewController que estamos
prestes a apresentar.
Então, como vamos obter
essa referência do ViewController?
Criaremos uma.
Aqui vamos chamar o construtor para
que o ViewController requerido selecione
um imagem e, nesta linha,
nós apresentamos o seletor de imagem.
Agora veja se você pode
repetir isso sozinho.
Basta criar um projeto de exibição única
com um botão chamado Present e,
em seguida, conectar esse botão a
uma ação chamada experiment.
Se achar difícil, consulte as
etapas nas notas do instrutor.
Mas primeiro tente fazer
sem olhar as etapas.
Seu aplicativo deve ser algo
mais ou menos assim.
Quando tiver terminado,
descreva o seu nível de confiança
neste exercício.