This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var alert = UIAlertController(title: "Title", message: "Alert view message", preferredStyle: UIAlertControllerStyle.Alert) | |
alert.addAction(UIAlertAction(title: "Save", style: .Default, handler: { (action: UIAlertAction!) in | |
println("Saved") | |
})) | |
alert.addAction(UIAlertAction(title: "Cancel", style: .Default, handler: { (action: UIAlertAction!) in | |
println("Cancel") | |
})) | |
presentViewController(alert, animated: true, completion: nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CoreData | |
class CoreDataManager { | |
var context:NSManagedObjectContext | |
var psc:NSPersistentStoreCoordinator | |
var model:NSManagedObjectModel | |
var store:NSPersistentStore? | |
init() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TPSpringyModalTransition.h | |
// iPeru | |
// | |
// Created by Pietro Rea on 5/4/14. | |
// Copyright (c) 2014 Pietro Rea. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface TPSpringyModalTransition : NSObject <UIViewControllerAnimatedTransitioning> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)keyboardWillShow:(NSNotification *)notification { | |
CGRect keyboardFrame = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]; | |
CGRect convertedFrame = [self.view convertRect:keyboardFrame fromView:self.view.window]; | |
CGFloat animationDuration = [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; | |
UIViewAnimationCurve animationCurve = [[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] integerValue]; | |
[UIView animateWithDuration:animationDuration delay:0 options:animationCurve animations:^{ | |
self.viewToMove.bottom = self.view.height - convertedFrame.size.height - 15; |
NewerOlder