Skip to Content
Swift学习手册
book

Swift学习手册

by Jon Manning, Paris Buttfield-Addison, Tim Nugent
February 2017
Beginner to intermediate
472 pages
9h 53m
Chinese
China Electric Power Press Ltd.
Content preview from Swift学习手册
扩展
iOS
应用
305
分享扩展(
share extension
):与动作扩展十分相似,让你的应用接收内容,然后分享。
Twitter
Facebook
Pinterest
应用都提供了分享扩展。
链接分享扩展(
shared links extension
):让应用把链接放到
Safari
的“共享的链接”
区域。例如,
Twitter
应用提供了这样的扩展,你关注的人发布的包含链接的推文都
会出现在
Safari
中。
前面说过,本章将构建两个扩展:
一个
Spotlight
索引扩展,让
iOS
定期运行,更新
Spotlight
搜索系统。
一个“今天”扩展,让应用在通知中心里显示一个小组件(
widget
),当用户从屏
幕顶部向下轻扫时显示。
为这个
iOS
应用添加
Apple Watch
支持时,还会添加一个应用扩展。
13.1
使用
Spotlight
索引扩展搜索
Spotlight
(见图
13-1
)是
iOS
内置的搜索系统。在主屏幕向下轻扫就会进入
Spotlight
在那里可以搜索设备和
Web
中的内容。
如果想让你应用的内容出现在
Spotlight
中,需要把内容添加到可搜索的索引中。可搜索
的索引是搜索数据库,用于定位设备中的一切;索引中没有的内容,不会出现在搜索结
果中。
12
章,我们使用
NSUserActivity
把文档标记为可搜索的。但是有个局限:只有打
开过文档,才能搜索。如果用户在其他设备中修改了文档的内容,搜索索引不会更新,
除非再次打开文档。
为了解决这个问题,我们将添加一个
Spotlight
索引扩展。系统会定期唤醒这个扩展,更 ...
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

PyTorch深度学习

PyTorch深度学习

Posts & Telecom Press, Vishnu Subramanian
深入淺出代數

深入淺出代數

Tracey Pilone, Dan Pilone
PHP学习手册

PHP学习手册

David Sklar
C语言核心技术(原书第2版)

C语言核心技术(原书第2版)

Peter Prinz, Tony Crawford

Publisher Resources

ISBN: 9787519803223