Skip to Content
移动端AI与ML应用开发:基于iOS和Android
book

移动端AI与ML应用开发:基于iOS和Android

by Laurence Moroney
January 2023
Intermediate to advanced
288 pages
6h 6m
Chinese
China Machine Press
Content preview from 移动端AI与ML应用开发:基于iOS和Android
92
|
6
6.1.3
3
步:设置故事板
名为
main.storyboard
的故事板文件将包含你的应用程序的用户界面。向其添加 UIImage
视图并将其属性设置为 Aspect Fit。然后,添加一个按钮控件,将其文本更改为“ Do
Inference。最后添加一个 UILabel 并使用属性检查器将其 Lines 属性设置为“0,以
确保它具有多行文本属性。调整标签大小以提供足够的空间。完成后,你的故事板应如
6-4 所示。
6-4
:创建简单的故事板
接下来,你需要为图像和标签控件创建输出,并为按钮创建一个动作。为此,你可以打
开一个单独的窗口并将控件拖动到
ViewController.swift
文件中。如果你对此不熟悉,请
返回第 3 章查看详细示例。
关于何时需要输出和何时需要动作可能会令人困惑,所以我喜欢这样思考。如果你想
读取或设置控件的属性,则需要一个“ outlet”( 出)。例如,我们需要读取图像视图
控件的内容以传递给 ML Kit 对其进行分类。你还需要写入标签的内容来呈现结果。因
此,它们都需要设置一个输出,该输出的名称是你在代码中引用这些控件的方式。当
你需要响应用户对控件执行某些操作时(例如按下按钮),你需要一个“动作”。当你将
正文.indd 92正文.indd 92 2023-4-30 9:08:312023-4-30 9:08:31
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

人工智能驱动的商业智能

人工智能驱动的商业智能

Tobias Zwingmann
Lua游戏AI开发指南

Lua游戏AI开发指南

Posts & Telecom Press, David Young
人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar

Publisher Resources

ISBN: 9787111713081