Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add Tutorial view #13

  • Loading branch information...
commit d6fb07c2c7790249f17f76db5d366318ae93689b 1 parent 20dc512
Satoshi Ebisawa authored
6 app/photos_controller.rb
View
@@ -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
18 app/tutorial_view.rb
View
@@ -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 resources/default.css
View
@@ -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);
+}
BIN  resources/tutorial.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  resources/tutorial@2x.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.