Skip to content

Commit

Permalink
Add Tutorial view #13
Browse files Browse the repository at this point in the history
  • Loading branch information
satococoa committed Feb 9, 2013
1 parent 20dc512 commit d6fb07c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/photos_controller.rb
Expand Up @@ -19,12 +19,18 @@ def viewDidLoad
collectionView.styleId = 'photos'
collectionView.registerClass(FriendCell, forCellWithReuseIdentifier:'friend_cell')
@friends = Friend.find({}, {:sort => {:created_at => :desc}})
if @friends.count == 0
tutorial_frame = [[0, 0], [content_frame.size.width, content_frame.size.height-44]]
@tutorial ||= TutorialView.alloc.initWithFrame(tutorial_frame)
collectionView.addSubview(@tutorial)
end
navigationController.toolbarHidden = false
end

def viewWillAppear(animated)
navigationController.navigationBar.translucent = false
@add_friend_observer = App.notification_center.observe('FriendDidCreate', Friend) do |notif|
@tutorial.removeFromSuperview unless @tutorial.nil?
reload
end
end
Expand Down
18 changes: 18 additions & 0 deletions app/tutorial_view.rb
@@ -0,0 +1,18 @@
class TutorialView < UIView
def initWithFrame(rect)
super.tap do
self.styleId = 'tutorial'
image = UIImage.imageNamed('tutorial.png')
image_view = UIImageView.alloc.initWithImage(image).tap do |iv|
iv.frame = [[5, 5], [self.bounds.size.width - 10, self.bounds.size.height - 10]]
iv.contentMode = UIViewContentModeScaleAspectFit
iv.layer.shadowColor = UIColor.blackColor.CGColor
iv.layer.shadowRadius = 3
iv.layer.shadowOpacity = 0.8
iv.layer.shadowOffset = [2, 2]
iv.clipsToBounds = false
end
addSubview(image_view)
end
end
end
6 changes: 5 additions & 1 deletion resources/default.css
Expand Up @@ -36,4 +36,8 @@ nav-buttons, bar-button-item {

#friend, #photos {
background-image: url(bundle://background.png);
}
}

#tutorial {
background-color: rgba(255, 255, 255, 0.1);
}
Binary file added resources/tutorial.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/tutorial@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d6fb07c

Please sign in to comment.