Permalink
Browse files

Add Tutorial view #13

  • Loading branch information...
1 parent 20dc512 commit d6fb07c2c7790249f17f76db5d366318ae93689b @satococoa committed Feb 9, 2013
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
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
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);
+}
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
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.