I hereby claim:
- I am d-ronnqvist on github.
- I am ronnqvist (https://keybase.io/ronnqvist) on keybase.
- I have a public key whose fingerprint is 710B 9F42 55FC B0E9 DB06 9C2A 563F 6E00 ACB3 4F92
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
@interface Foo : NSObject | |
// some read-only property ... | |
@property (nonatomic, copy, readonly) NSString *bar; | |
@end | |
@implementation Foo | |
// ... with a custom accessor | |
- (NSString *)bar | |
{ | |
return @"Foo"; |
The UIView animation API results in different CAAnimations being added to the layer on iOS 7 and 8. Changing the bounds of a view like this:
[UIView animateWithDuration:0.3
animations:^{
self.myView.bounds = CGRectMake(0, 0, 100, 100); // was (0,0) (200, 200)
}];
will result in one animation for the bounds
key path being added to the backing layer if you are running iOS 7:
- (NSURL *) writeImage:(NSImage *)image | |
withSceneDocumentURL:(NSURL *)documentURL | |
originalImageURL:(NSURL *)originalImageURL | |
{ | |
if (!originalImageURL) { | |
// Let the default exporter write this image | |
return nil; | |
} | |
NSString *sceneFileName = | |
[documentURL lastPathComponent]; |
// I'm designing something where there are multiple different objects that can hold | |
// exactly _one_ out of a couple of different other types, and I don't know what style I prefer. | |
// | |
// For example, an Input always has a name and it can hold a Symbol, a Target, or a Texture. | |
// It should always hold exactly one of them. In just the same way, a Symbol has a name and can | |
// hold different data of exactly exactly _one_ type of many. | |
// | |
// Which one of the following alternatives do you prefer? |
import Foundation | |
import UIKit | |
class MyView: UIView { | |
override func drawRect(rect: CGRect) { | |
// just some path | |
let path = UIBezierPath(roundedRect: CGRectMake(10, 10, 200, 100), byRoundingCorners: .TopLeft | .BottomRight, cornerRadii: CGSizeMake(30, 60)) | |
// fill with red | |
UIColor.redColor().setFill() |
// | |
// TextHitTestingLabel.m | |
// rotate | |
// | |
// Created by David Rönnqvist on 2013-06-29. | |
// | |
#import "TextHitTestingLabel.h" | |
#import <CoreText/CoreText.h> |
// The purpose of this gist is to provide examples of many real life date computations | |
// This is uploaded as a gist so that it can be copy and pasted into either a OS X or | |
// iOS project. You can either take it all "[Cmd]+[A], [Cmd]+[C]" or just a small piece. | |
// The results are fairly well formattes as log output and I recommend that you run this | |
// code to see the actual results yourself. Change some of the values and see what happens. | |
#pragma mark - Setup | |
NSString *line = @"–––––––––––––––––––––––––––––––––––––––––––––––––––––––"; |
I wanted to use enums, structs, and classes to create small, elegant objects for a basic chess game.
It started with the small squares in the chess board, and created the logic part in the main definition and an extension that is use for rendering
enum Row: Character {
case A = "A"
case B = "B"
case C = "C"
case D = "D"
There was [a tweet][tweetSoto] a couple of days ago that resulted in a discussion/question about what it wrong with the usage of removedOnCompletion = NO
in the [SparkRecordingCircle code][code] for that [Subjective-C post][post].
We all kept saying that the explanation doesn't fit in a tweet, so here is my rough explanation about the issues.
But, let me first say that I think that the Subjective-C articles are reallt cool and useful to learn from. This is trying to reason about the general usage of removedOnCompletion = NO
, using that code as an example, since that was what was discussed on twitter.
The root problem, as [Nacho Soto pointed out][rootProblem], is that removedOnCompletion = NO
in combination with fillMode = kCAFillModeForwards
is almost always used when you are not updating the model layer. This means that after the animation has finished, what you see on screen is not reflected in the property of the layer. The biggest issue that this can cause is that all the