Skip to content

need to redo FBPop custom presentation #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
526 changes: 412 additions & 114 deletions MarsWater/MarsWater.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions MarsWater/MarsWater.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions MarsWater/MarsWater/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// AppDelegate.h
// MarsWater
//
// Created by Michael Kavouras on 10/4/15.
// Copyright © 2015 Michael Kavouras. All rights reserved.
// Created by Varindra Hart on 10/4/15.
// Copyright © 2015 Varindra Hart. All rights reserved.
//

#import <UIKit/UIKit.h>
Expand Down
6 changes: 3 additions & 3 deletions MarsWater/MarsWater/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// AppDelegate.m
// MarsWater
//
// Created by Michael Kavouras on 10/4/15.
// Copyright © 2015 Michael Kavouras. All rights reserved.
// Created by Varindra Hart on 10/4/15.
// Copyright © 2015 Varindra Hart. All rights reserved.
//

#import "AppDelegate.h"
Expand Down Expand Up @@ -51,7 +51,7 @@ - (void)applicationWillTerminate:(UIApplication *)application {
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator;

- (NSURL *)applicationDocumentsDirectory {
// The directory the application uses to store the Core Data store file. This code uses a directory named "com.mikekavouras.MarsWater" in the application's documents directory.
// The directory the application uses to store the Core Data store file. This code uses a directory named "nyc.c4q.vhart.MarsWater" in the application's documents directory.
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,36 @@
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
Expand Down
4 changes: 2 additions & 2 deletions MarsWater/MarsWater/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8173.3" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8142"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand Down
404 changes: 276 additions & 128 deletions MarsWater/MarsWater/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions MarsWater/MarsWater/CustomModalViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// CustomModalViewController.h
// MarsWater
//
// Created by Varindra Hart on 10/9/15.
// Copyright © 2015 Varindra Hart. All rights reserved.
//

#import <UIKit/UIKit.h>
@protocol CustomModalDelegate;
@interface CustomModalViewController : UIViewController

@property (nonatomic, weak) id <CustomModalDelegate> delegate;

@end

@protocol CustomModalDelegate <NSObject>

- (void)makeNewTaskWithString:(NSString *)description;


@end
68 changes: 68 additions & 0 deletions MarsWater/MarsWater/CustomModalViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//
// CustomModalViewController.m
// MarsWater
//
// Created by Varindra Hart on 10/9/15.
// Copyright © 2015 Varindra Hart. All rights reserved.
//

#import "CustomModalViewController.h"
#import "pop/POP.h"

@interface CustomModalViewController ()
@property (weak, nonatomic) IBOutlet UILabel *warningLabel;
@property (weak, nonatomic) IBOutlet UITextField *taskTextField;


@end

@implementation CustomModalViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.warningLabel.hidden = YES;
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)cancelButtonTapped:(UIButton *)sender {

[self dismissViewControllerAnimated:YES completion:nil];

}
- (IBAction)doneButtonTapped:(UIButton *)sender {

if ([self.taskTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length==0) {

self.warningLabel.hidden = NO;

POPSpringAnimation *shake = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerPositionX];

shake.springBounciness = 20;
shake.velocity = @(1000);

[self.taskTextField.layer pop_addAnimation:shake forKey:@"shakePassword"];

return;
}

[self.delegate makeNewTaskWithString:self.taskTextField.text];

[self dismissViewControllerAnimated:YES completion:nil];

}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/

@end
16 changes: 16 additions & 0 deletions MarsWater/MarsWater/DismissingAnimationController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// DismissingAnimationController.h
// FBPopDemo
//
// Created by Varindra Hart on 10/9/15.
// Copyright © 2015 Varindra Hart. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "pop/POP.h"
#import <UIKit/UIKit.h>

@interface DismissingAnimationController : NSObject
<UIViewControllerAnimatedTransitioning>

@end
39 changes: 39 additions & 0 deletions MarsWater/MarsWater/DismissingAnimationController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// DismissingAnimationController.m
// FBPopDemo
//
// Created by Varindra Hart on 10/9/15.
// Copyright © 2015 Varindra Hart. All rights reserved.
//

#import "DismissingAnimationController.h"

@implementation DismissingAnimationController
- (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext {
return 0.5f;
}

- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext {

UIView *toView = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey].view;
toView.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;
toView.userInteractionEnabled = YES;

UIView *fromView = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey].view;


POPBasicAnimation *closeAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerPositionY];
closeAnimation.toValue = @(-fromView.layer.position.y);
[closeAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
[transitionContext completeTransition:YES];
}];

POPSpringAnimation *scaleDownAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerScaleXY];
scaleDownAnimation.springBounciness = 20;
scaleDownAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(0, 0)];

[fromView.layer pop_addAnimation:closeAnimation forKey:@"closeAnimation"];
[fromView.layer pop_addAnimation:scaleDownAnimation forKey:@"scaleDown"];

}
@end
7 changes: 7 additions & 0 deletions MarsWater/MarsWater/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,12 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
29 changes: 22 additions & 7 deletions MarsWater/MarsWater/List+CoreDataProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// List+CoreDataProperties.h
// MarsWater
//
// Created by Michael Kavouras on 10/4/15.
// Copyright © 2015 Michael Kavouras. All rights reserved.
// Created by Varindra Hart on 10/9/15.
// Copyright © 2015 Varindra Hart. All rights reserved.
//
// Choose "Create NSManagedObject Subclass…" from the Core Data editor menu
// to delete and recreate this implementation file for your updated model.
// Delete this file and regenerate it using "Create NSManagedObject Subclass…"
// to keep your implementation up to date with your model.
//

#import "List.h"
Expand All @@ -15,10 +15,25 @@ NS_ASSUME_NONNULL_BEGIN

@interface List (CoreDataProperties)

@property (nullable, nonatomic, retain) NSString *title;
@property (nullable, nonatomic, retain) NSDate *createdAt;
@property (nullable, nonatomic, retain) id color;
@property (nullable, nonatomic, retain) NSArray *task;
@property (nullable, nonatomic, retain) NSDate *createdAt;
@property (nullable, nonatomic, retain) NSString *title;
@property (nullable, nonatomic, retain) NSOrderedSet<Task *> *task;

@end

@interface List (CoreDataGeneratedAccessors)

- (void)insertObject:(Task *)value inTaskAtIndex:(NSUInteger)idx;
- (void)removeObjectFromTaskAtIndex:(NSUInteger)idx;
- (void)insertTask:(NSArray<Task *> *)value atIndexes:(NSIndexSet *)indexes;
- (void)removeTaskAtIndexes:(NSIndexSet *)indexes;
- (void)replaceObjectInTaskAtIndex:(NSUInteger)idx withObject:(Task *)value;
- (void)replaceTaskAtIndexes:(NSIndexSet *)indexes withTask:(NSArray<Task *> *)values;
- (void)addTaskObject:(Task *)value;
- (void)removeTaskObject:(Task *)value;
- (void)addTask:(NSOrderedSet<Task *> *)values;
- (void)removeTask:(NSOrderedSet<Task *> *)values;

@end

Expand Down
21 changes: 0 additions & 21 deletions MarsWater/MarsWater/List+CoreDataProperties.m

This file was deleted.

6 changes: 4 additions & 2 deletions MarsWater/MarsWater/List.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
// List.h
// MarsWater
//
// Created by Michael Kavouras on 10/4/15.
// Copyright © 2015 Michael Kavouras. All rights reserved.
// Created by Varindra Hart on 10/9/15.
// Copyright © 2015 Varindra Hart. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

@class Task;

NS_ASSUME_NONNULL_BEGIN

@interface List : NSManagedObject
Expand Down
5 changes: 3 additions & 2 deletions MarsWater/MarsWater/List.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// List.m
// MarsWater
//
// Created by Michael Kavouras on 10/4/15.
// Copyright © 2015 Michael Kavouras. All rights reserved.
// Created by Varindra Hart on 10/9/15.
// Copyright © 2015 Varindra Hart. All rights reserved.
//

#import "List.h"
#import "Task.h"

@implementation List

Expand Down
4 changes: 2 additions & 2 deletions MarsWater/MarsWater/ListCreationTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// ListCreationTableViewController.h
// MarsWater
//
// Created by Michael Kavouras on 10/4/15.
// Copyright © 2015 Michael Kavouras. All rights reserved.
// Created by Varindra Hart on 10/4/15.
// Copyright © 2015 Varindra Hart. All rights reserved.
//

#import <UIKit/UIKit.h>
Expand Down
Loading