您的位置:首页 > 其它

xcode常用项目模板

2015-11-13 20:58 411 查看
xcode常用的项目模板中,主要有以下几类



首先来讲一下master detail application 其主要是为创建日志的时候可以应用 其主要也是有两个按钮 一个是添加的按钮 一个是消除的按钮 其中可以在代码中修改 使其不具备增加或修改的能力



打开masterviewcontroller.swift文件

override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return false
}
这个是是否可以进行修改

override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
objects.removeAtIndex(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
} else if editingStyle == .Insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}
}

}


这里才是真正的主代码,代码的审核通过这里 若全部注释掉 则没有功能了

pagebasedapplication 主要用于作为电子书的模板



打开ModelController.swift可以在其中修改数据源 pageData

pageData = ["cao","kai","qiang"]
之后就是这样了

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: