最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

参考教程开发iOS的第二个app:Storyboards – BirdWatching

iOS crifan 5912浏览

已经根据教程:Start Developing iOS Apps Today去折腾了很多了,相关帖子为:

【记录】使用Xcode中的iOS SDK给iphone开发出第一个App程序

管理你在Xcode中的工作流程

【整理】Object-C学习总结

Cocoa的Foundation Framework学习笔记

iOS Framework学习记录 + 理解iOS和OS X在Framework方面的区别和联系

在Mac的Framework下面写代码

学习记录Mac的App的设计模式

现在打算继续参考:Your Second iOS App: Storyboards,去折腾iOS的第二个app,storyboard,下面记录过程:


1.新建Master-Detail的iOS项目:

iOS  application Master-Detail

set new project

 

create folder

default created prj

编译一下,可以出现Master界面:

builded master

点击加号,可以创建一个子项:

added page

detail date time

可以看到Canvas中,详细的Storyboard/view信息:

cavas show

2.

创建相关的类:

new file

cocoa touch obj-c

birdsighting

create birdsighting

two created file

datacontroller

经过一番设置,变成:

table view

此刻,运行程序会出错,详见:

【已解决】Xcode中编译iOS程序,运行出错:Thread 1: signal SIGABRT

【已解决】UITableViewController setDataController:unrecognized selector sent to instance

解决了上面的错误,结果虽然可以显示主界面了,但是点击后,却进入不了详细界面了,不过后来终于解决了,详细折腾过程见:

【已解决】参考Your Second iOS App教程,但是点击BirdsMasterViewController中的TableView后,却无法进入详细页面BirdsDetailViewController

 

继续折腾。

参考:Your Second iOS App – Enabling the Addition of New Items,去添加AddSightingViewController:

AddSightingViewController

embed in navi ctrl

added add scene

 

new segue for add button

 

show add button

input birdname and location

added new tableViewCell

added new item info

 

终于按照教程搞定了这个app了。

 

再多说一句,上述折腾的期间,新建add scene时,不小心把从master view的add buttoncontrol+drag到add scene时产生的新的segue,不小心弄成了custom(而不是正确的modal),导致看到的segue图标都不对:

custom segue

所以运行时候,点击Add按钮,希望弹出add scene,结果出现了错误:

app abort

而且虽然已经在之前就添加了所有的breakpoint了,但是此时竟然没有跳转到对应的错误的地方。

不过此时才注意到,原来还有一个warning呢:

Unsupported Configuration: Custom segues must have a custom class

unsupported configuration

然后把segue改为对应的model,并添加上名字:

modal segue

这样,程序才可以正常运行,点击Add才可以转换到添加item的页面。

 

至此,终于完成教程中利用StoryBoard设计出来的BirdWatching的app了。

后续的根据:

Your Second iOS App – Next Steps

的建议,去做一些功能上的扩展的尝试,详见:

给Your Second iOS App的BirdWatching添加屏幕旋转(orientation rotation)的支持

 


【相关阅读】

有空再继续读这些相关的文章:

“Designing the Master Scene” and “Displaying Information in the Detail Scene”

“Enabling the Addition of New Items”

“Troubleshooting,” “Code Listings,” “Next Steps”

View Controller Programming Guide for iOS

Xcode 4 User Guide

Key-Value Coding Programming Guide

“Storing and Accessing Properties” in Cocoa Fundamentals Guide

转载请注明:在路上 » 参考教程开发iOS的第二个app:Storyboards – BirdWatching

93 queries in 0.190 seconds, using 19.19MB memory