Next
Previous
Next Steps
下一步
In this tutorial, you created a simple but functional app. To build on the knowledge you gained, consider extending the BirdWatching app in some of the ways described in this chapter.
在本教程中,你创建了一个简单但功能强大的app。为了增长你获得的知识,考虑用本章描述的集中方法扩展BirdWatching app。
Improve the User Interface and User Experience
改善用户界面和用户体验
To meet the high expectations of iOS users, an app must have a great user interface and user experience. Although it’s usually best to avoid adding excessive decoration, the BirdWatching app might look better if it displayed coloring or even a subtle p_w_picpath in some of the view backgrounds.
要达到iOS用户的高期望,app必须有良好的用户界面和用户体验。尽管这通常是要避免增加过多的涨势,但BirdWatching app如果现实一些颜色或者在一些视图背景上增加一些微妙的图像或许会看上去更好。
iOS users generally expect to be able to use iOS-based devices in any orientation, so it’s a good idea to support different orientations in the apps you develop. As you update the app’s UI, be sure to define constraints that help UI elements remain properly positioned when the device is rotated.
iOS 用户通常期望在任何方向上使用iOS设备,所以你开发的app支持不同的方向会是个好主意。当你更新app的UI的时候,确保定义约束来帮助UI元素在当设备旋转的的时候保持恰当的位置。
Although the BirdWatching app makes it easy to add a new bird-sighting event, the user experience isn’t ideal. For one thing, the Done button is active as soon as the add scene appears; it would be better if it became active after the user taps a key on the keyboard. In addition, the text fields don’t provide a Clear button that allows users to quickly erase their input.
虽然BirdWatching app可以很容易的添加一个新的bird-sighting事件,但用户体验并不理想。首先,Done按钮是在add场景一出现的时候激活;如果它变成在用户轻拍键盘上的键的时候被激活可能会更好。此外,文本字段不提供Clear按钮,它允许用户快速的抹去他们的输入。
Add More Functionality
添加更多的功能
The best iOS apps include just the right amount of functionality to make it easy and enjoyable for users to accomplish the main task. The BirdWatching app makes it easy to perform the main task, but it could be more enjoyable to use. Here are a few improvements to consider:
最好的iOS app仅包括适量的功能来使它让用户感觉容易且愉快的完成主要任务。BirdWatching app可以很方便的实现主要功能,但是它可以在使用的时候更愉快。这儿有几个改进的思考:
Instead of asking users to enter a bird name in a text field, display a list of bird names from which they can choose.
Allow users to enter a specific date, rather than automatically using today’s date.
Ask users to enable Location Services so that the app can suggest the current location as the bird-sighting location. And instead of asking users to enter a location in a text field, display a map on which they can select a location.
Let users edit and sort the master list. For some advice on how to enable these actions, see Table View Programming Guide for iOS. And recall that the Master-Detail template provides an Edit button (and some support for rearranging the table) by default. You might start on this task by removing the comment symbols around the appropriate code in BirdsMasterViewController.m.
Allow users to add an p_w_picpath to a bird sighting. The app could let users choose from a set of stock p_w_picpaths or from their own photos.
Make the master list persistent so that users’s bird sightings are displayed every time they restart the app.
Adopt iCloud storage. When you support iCloud, changes that users make in one instance of an app are automatically propagated to their other devices, so that other instances of the app can see them, too. To get started learning how to enable iCloud in an app, see Your Third iOS App: iCloud.
* 与其在文本字段让用户输入鸟的名字,步入把叫得名字显示在列表上让用户选择。
* 允许用户输入特定的日期,而不是自动的使用今天的日期。
* 让用户启用定位服务(Location Services)这样app就能获取观鸟的正确地址。用一张用户可以选择地点的地图来代替让用户输入地址的文本字段。
* 让用户编辑并储存主列表。获取如何启用这些行为的建议,参阅Table View Programming Guide for iOS。回忆一下主-从模板提供的默认Edit按钮(支持重新排列表)。你可以通过移除在BirdsMasterViewController.m文件中被注释掉的代码的注释来开始这个任务。
* 允许用户添加图像到bird sighting。这个app 能让用户从一组储存的图片或者他们自己的照片中选择图片。
* 使主列表固定,这样每次启动app的时候用户的bird sightings都将被显示。
* 采用云存储。当你支持iCloud的时候,改变用户使用app的实体的时候,将自动传播到它们其他的设备上,这样其他app的实体将被他们看到。要开始学习在app中启用iCloud,参看Your Third iOS App:iCloud。
Additional Improvements
进一步改进
As you learn more about iOS app development, consider making the following changes to the BirdWatching app:
当你学习了更多的关于iOS app开发的知识时,考虑为BirdWatching app做出如下改变:
Support localization and accessibility. An app that is localized for different locales and accessible to users with disabilities enjoys a much wider customer base than an app without these features. Xcode and Auto Layout help make the internationalization and localization processes easy; to learn more, start by reading “Localized Resource Files” in iOS App Programming Guide. Use Accessibility Inspector in iOS Simulator to find places where your app can provide a better experience for VoiceOver users; to learn more, see “_Testing the Accessibility of Your iOS App”.
Optimize the code. High performance is critical to a good user experience on iOS. Learn to use the various performance tools provided with Xcode, such as Instruments, to tune your app so that it minimizes its resource requirements.
Add unit tests. Testing ensures that if the implementation of a method changes, the method still works as advertised. You can either create a new version of the project that sets up unit testing from the start, or you can use the current project and choose File > New > New Target, select the Other category, and then select the template Cocoa Unit Testing Bundle. Examine the project to see what Xcode adds when you incorporate unit testing. To learn about unit testing, see Xcode Unit Testing Guide.
Use Core Data to manage the model layer. Although it takes some work to learn how to use Core Data, it can help streamline the code required to support the model layer. Consider working through Core Data Tutorial for iOS to get started learning about this technology.
Ensure that the app runs on a device. It’s a good idea to familiarize yourself with the process of installing and testing an app on a device, because these tasks are prerequisites for submitting an app to the App Store.
Make the app universal. iOS users often expect to be able to run their favorite apps on all types of iOS-based devices. Making an app universal can require additional work on your part; in particular, it generally requires that you create two different user interfaces, even if you reuse most of the same underlying code. To learn more about the steps you need to take to make an app universal, see “Creating a Universal App” in iOS App Programming Guide.
* 支持本地化和易访问性。App 本地化为不同语言环境以及易访问性为残疾用户提供方便,这样的app就比不采用这些功能的app有了更多的客户。Xcode 和自动布局帮助国际化和本地化的过程变得更容易;想要学习更多,开始阅读iOS App Programming Guide中的“Localized Resource Files”。使用iOS 模拟器中的易访问检查器来发现你的app提供给VoiceOver用户更好地体验;想要学习更多,参看“_Testing the Accessibility of Your iOS App”.
* 优化代码。高性能对于用户在iOS上的良好体验至关重要。学习使用Xcode提供的各种各样的性能工具,例如Instruments,来使你的app最小化资源需求。
* 添加单元测试。测试确保如果方法的实现改变了,芳芳仍然能够工作。你可以既可以从一开始就创建工程的新版本的测试单元,也可以在当前工程中选择File > New > New Target,选择另一个类别,然后选择Cocoa Unit Testing Bundle模板。检查这个工程来看看当你合并了单元测试后Xcode增加了什么。学习更多关于单元测试,查看Xcode Unit Testing Guide。
* 使用Core Data 来管理模型层。尽管需要一些工作来学习如何使用Core Data,但它能帮助简化被要求支持模型层的代码。考虑通过 Core Data Tutorial for iOS来开始学习这个技术。
* 确保app在设备上运行。这是你自己熟悉在设备上安装和运行app过程的好主意,因为这些任务是在App Store发布app的先决条件。
* 使app通用。iOS用户经常希望他们喜欢的app能在所有iOS设备上运行。让app通用要求你做一些额外的工作;特别是,它通常需要你创建两个不同的用户界面,即使你重用相同的底层代码。学习更多关于app通用性的步骤,参阅中 iOS App Programming Guide的“Creating a Universal App”。
Next
Previous