照片共享应用开发全解析
1. 模型介绍
在照片共享应用中,有两个重要的模型:注释(Annotation)和评论(Comment)。
- 注释(Annotation) :每张照片可以有一个或多个注释。注释以矩形图层的形式显示在照片上,带有白色边框,下方有文本。注释具有描述、表示图层左上角的 X 和 Y 坐标,以及特定的宽度和高度。以下是注释模型的代码:
class Annotation
include DataMapper::Resource
property :id, Serial
property :description,Text
property :x, Integer
property :y, Integer
property :height, Integer
property :width, Integer
property :created_at, DateTime
belongs_to :photo
end
- 评论(Comment) :用户可以对任何公开照片发表评论。评论类非常简单,只有文本描述这一属性。评论属于用户和照片。代码如下:
class Comment
include DataMapper::Resource
property :id, Serial
prope
照片共享应用开发详解
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



