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
// | |
// SeparatorView.swift | |
// | |
// Created by Stuart Moore on 1/26/19. | |
// Copyright © 2019 Stuart J. Moore. All rights reserved. | |
// | |
// Adapted from http://www.figure.ink/blog/2016/9/11/hairlines. | |
// Published by jemmons on 9/11/16. | |
// |
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
//: Playground - noun: a place where people can play | |
import XCPlayground | |
import UIKit | |
// MARK: - Paragraph Styles | |
let headlineParagraphStyle = NSMutableParagraphStyle() | |
headlineParagraphStyle.lineHeightMultiple = 0.8 |
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
Moved to https://github.com/stuartjmoore/Keyboard-Resources to allow for images and more files. |
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
- (CGFloat)heightThatFits { | |
if(!self.text || [self.text isEqualToString:@""]) | |
return 0; | |
if([self respondsToSelector:@selector(attributedText)]) { | |
CGSize maxSize = (CGSize){ self.frame.size.width, MAXFLOAT }; | |
CGRect frame = [self.attributedText boundingRectWithSize:maxSize | |
options:(NSStringDrawingUsesLineFragmentOrigin| | |
NSStringDrawingUsesFontLeading) | |
context: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
// | |
// WPTextAttachment.h | |
// ReadArticle | |
// | |
// Created by Moore, Stuart on 12/27/13. | |
// Copyright (c) 2013 The Washington Post. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
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)loadOrResizeOrSometing { | |
/* | |
* After creating the text view or resizing the font, set the quoteWidth and contentInset. | |
*/ | |
WPTextContainer *textContainer = (WPTextContainer*)paragraphView.textContainer; | |
textContainer.spaceWidth = [self widthForCharacter:@" "]; | |
textContainer.charWidths = @{ | |
@(8220) : @([self widthForCharacter:@"“"]), | |
@(8216) : @([self widthForCharacter:@"‘"]), | |
@('"') : @([self widthForCharacter:@"\""]), |
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
// When you init your view | |
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(scrollViewDidScroll:) name:NSViewBoundsDidChangeNotification object:scrollView.contentView]; | |
// The methods | |
- (void)scrollViewDidBeginScrolling | |
{ | |
// Do stuff | |
} |
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
/* | |
* This code doesn't work, I'm hoping for some help. | |
* | |
* I'm trying to use reflection to dig into Android's @hide classes that store screenshots | |
* of the currently running apps. | |
* | |
* The code compiles and runs perfectly, but mThumbnailReceiver is never called back with | |
* the bitmaps. | |
* | |
* I've never done Android development before (I'm an iOS dev) but I'd love to get this |
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)showCard:(id)sender | |
{ | |
UIGraphicsBeginImageContext(self.view.window.frame.size); | |
[self.view.window.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
UIViewControllerSubclass *card = [[UIViewControllerSubclass alloc] init]; | |
card.background = screenshot; | |
[self presentModalViewController:card animated:NO]; |
NewerOlder