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
CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; | |
keyboardFrame = [self.view.window convertRect:keyboardFrame fromWindow:nil]; | |
keyboardFrame = [self.view convertRect:keyboardFrame fromView: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
-(void)removeDataStoreAtURL:(NSURL*)url | |
{ | |
// Need to remove anything matching the first part - there are also logging files alongside the SQLite file itself. | |
// Typical directory contents are: | |
// Name.sqlite, Name.sqlite-shm, Name.sqlite-wal | |
NSURL *folderURL = [url URLByDeletingLastPathComponent]; | |
NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:folderURL includingPropertiesForKeys:nil options:0 error: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
let renderer = UIGraphicsImageRenderer(size: CGSize(width: 400, height: 400)) | |
let image = renderer.image { | |
context in | |
UIColor.lightGray.setFill() | |
UIRectFill(context.format.bounds) | |
UIColor.black.set() | |
UIRectFrame(context.format.bounds) | |
let text = "TEST IMAGE \n\(Date())" as NSString | |
let paragraph = NSMutableParagraphStyle() | |
paragraph.alignment = .center |
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 UIKit | |
// Snapshot utilities | |
extension UIView { | |
func snapshotView(view: UIView, afterUpdates: Bool) -> UIView { | |
let snapshot = view.snapshotViewAfterScreenUpdates(afterUpdates) | |
self.addSubview(snapshot) | |
snapshot.frame = convertRect(view.bounds, fromView: view) | |
return snapshot |
OlderNewer