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 Foundation | |
import UIKit | |
import PlaygroundSupport | |
// Needs this settings first before using UIWebView to render web pages in Playground | |
// Also required to run Auto Layout | |
PlaygroundPage.current.needsIndefiniteExecution = true |
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 UIKit | |
import XCPlayground | |
// To continue running NSURLSession async download, make this playground page keep running | |
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true | |
let font = UIFont.systemFontOfSize(16.0) |
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
iOS 8 | |
2016-07-13 22:49:18.634 leading_broken[266:12919] font <UICTFont: 0x14f560af0> font-family: "HiraKakuProN-W6"; font-weight: bold; font-style: normal; font-size: 21.00pt | |
2016-07-13 22:49:18.635 leading_broken[266:12919] font pointSize 21.000000 | |
2016-07-13 22:49:18.635 leading_broken[266:12919] font lineHeight 21.000000 | |
2016-07-13 22:49:18.635 leading_broken[266:12919] font ascender 18.480000 | |
2016-07-13 22:49:18.635 leading_broken[266:12919] font descender -2.520000 | |
2016-07-13 22:49:18.636 leading_broken[266:12919] font leading 21.000000 | |
2016-07-13 22:49:18.636 leading_broken[266:12919] ctfont pointSize 21.000000 | |
2016-07-13 22:49:18.636 leading_broken[266:12919] ctfont boundingBox {{-9.072000000000001, -10.038}, {37.590000000000003, 37.590000000000003}} |
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 <Foundation/Foundation.h> | |
NS_ASSUME_NONNULL_BEGIN | |
/** | |
UITableViewやUICollectionPoolなどで使用するIdentifierをプールしてユニークに採番するためのユーティリティです。 | |
具体的には以下の様な挙動を示します。 | |
@li identifier発番回数がnumberOfUniqueIdentifiers未満の時、uniqueKeyに対して常にユニークなidentifierを発番します。 |
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
CLANG_ENABLE_MODULES = YES; | |
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; | |
SWIFT_OBJC_BRIDGING_HEADER = "myapp/myapp-Bridging-Header.h"; | |
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | |
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
- (CGSize)sizeThatFitsHiraginoCompatible:(CGSize)size | |
{ | |
// ヒラギノフォント(日本語)で正確に描画サイズを取得する | |
// http://qiita.com/yusuga_/items/2be8c55ca561bba44702 | |
// ヒラギノ (Hiragino Kaku Gothic, Hiragino Mincho) の時だけ補正をかける | |
CGSize s = [self sizeThatFits:size]; | |
UIFont *font = self.font; | |
if ([font.familyName hasPrefix:@"Hiragino"]) { | |
s.width = ceil(s.width); | |
s.height = ceil(s.height + fabs(font.descender)); |
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 Foundation | |
public enum JSONError: Int, ErrorType { | |
case UnsupportedType = 999 | |
case IndexOutOfBounds = 900 | |
case WrongType = 901 | |
case ErrorNotExist = 500 | |
} | |
public extension JSON { |
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
//////////////// | |
// on iPad Air 2 | |
//////////////// | |
// Boot as portrait | |
2015-06-15 19:57:47.597 ios9[16003:229076] viewDidLoad() | |
2015-06-15 19:57:47.598 ios9[16003:229076] viewWillAppear - false | |
2015-06-15 19:57:47.601 ios9[16003:229076] traitCollectionDidChange - nil | |
2015-06-15 19:57:47.602 ios9[16003:229076] viewWillLayoutSubviews() | |
2015-06-15 19:57:47.602 ios9[16003:229076] viewDidLayoutSubviews() |
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
// Basic example | |
let duration = 1.0 | |
self.animator = ParaMangar.renderViewForDuration(self.targetView, duration: duration, frameInterval: 2).toFile("Sample1", completion: {path in | |
self.animator = nil | |
println("Completed: \(path)") | |
}) | |
// More complex example | |
// Render UIView animations! |
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
public class MainActivity extends Activity { | |
@InjectView(R.id.container) | |
View mContainerView; | |
@InjectView(R.id.text) | |
TextView mTextView; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { |
NewerOlder