Skip to content

Instantly share code, notes, and snippets.

Ryan Poolos EmperiorEric

Block or report user

Report or block EmperiorEric

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
EmperiorEric / NSLayoutConstraint+StandardMetrics.swift
Created Aug 22, 2017
A simple extension I wrote that makes working with visual format for AutoLayout much more enjoyable.
View NSLayoutConstraint+StandardMetrics.swift
// NSLayoutConstraint+StandardMetrics.swift
// Created by Ryan Poolos on 4/22/15.
// Copyright (c) 2015 Frozen Fire Studios, Inc. All rights reserved.
import UIKit
extension Double {
EmperiorEric / UICollectionViewCellSubclass
Created Jul 13, 2013
Looking for an elegant way to make two views dependent on each other, without being the triggers that create them. Basically in a UITableViewCell I have two labels that appear side-by-side. Their frames are obviously dependent on each other for this reason, but either could be nonexistent based. I calling self.label would lazy init them so you'd…
View UICollectionViewCellSubclass
- (UILabel *)titleLabel
if (!_titleLabel) {
CGFloat width = CGRectGetMinX(_detailLabel.frame);
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, width, CGRectGetHeight(self.infoView.bounds))];
[self.infoView addSubview:_titleLabel];
EmperiorEric / ExampleA.m
Created Jun 16, 2013
So I've seen both of these options from time to time, and I'm wondering if there is something inherently wrong with an option, if there is some non obvious benefit, or if it is entirely a preference based decision.
View ExampleA.m
- (id)initWithProperty:(id)property
self = [super init];
if (self) { = property;
return self;
- (id)initWithProperty:(id)property otherProperty:(id)otherProperty
View UILabel+Fix.m
// By Erik Andersson
// Please help with this method to bring support for more UILineBreakModes and text alignment
@implementation UILabel (Fix)
- (CGRect)rectForLetterAtIndex:(NSUInteger)index
NSAssert(self.lineBreakMode != UILineBreakModeClip, @"UILabel.lineBreakMode cannot be UILineBreakModeClip to calculate the rect of a character. You might think that it's possible, seeing as UILineBreakModeWordWrap is supported, and they are almost the same. But the semantics are weird. Sorry.");
NSAssert(self.lineBreakMode != UILineBreakModeHeadTruncation, @"UILabel.lineBreakMode cannot be UILineBreakModeHeadTruncation to calculate the rect of a character. We can't have everything you know.");
NSAssert(self.lineBreakMode != UILineBreakModeMiddleTruncation, @"UILabel.lineBreakMode cannot be UILineBreakModeMiddleTruncation to calculate the rect of a character. We can't have everything you know.");
You can’t perform that action at this time.