Skip to content

Instantly share code, notes, and snippets.

@fmtonakai
fmtonakai / UITextViewSubclass.m
Last active August 29, 2015 14:00
TextViewのリンクのところだけ反応させてあとはスルーする
// implementation of UITextView subclass
// editableプロパティをNO, selectableプロパティをYESにする
// リンクのところ以外のタッチを透過する
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
CGPoint p = point;
p.y -= self.textContainerInset.top;
p.x -= self.textContainerInset.left;
NSInteger i = [self.layoutManager characterIndexForPoint:p inTextContainer:self.textContainer fractionOfDistanceBetweenInsertionPoints:NULL];
@fmtonakai
fmtonakai / AttributedString.swift
Last active August 6, 2023 21:27
AttributedString with String Interpolation
//
// AttributedString.swift
//
// Created by fm.tonakai on 2019/04/08.
//
import UIKit
public struct AttributedString: ExpressibleByStringLiteral, ExpressibleByStringInterpolation, CustomStringConvertible {
public struct StringInterpolation: StringInterpolationProtocol {