iOS7 テキストの回り込み

iOS 7からUITextViewでテキストの回り込みが指定できるようになった。 NSTextContainerのexclusionPathsプロパティに、回り込みさせたい領域のパスを指定すると、文字がパスに沿って表示される。


- (void)_updateTextView
{
    UIBezierPath*   bezierPath;
    bezierPath = [UIBezierPath bezierPathWithRect:self.imageView.frame];
    
    UIBezierPath*   bezierPath2;
    bezierPath2 = [UIBezierPath bezierPathWithOvalInRect:_circleView.frame];
    
    self.textView.textContainer.exclusionPaths = @[bezierPath, bezierPath2];
}

f:id:nkmrh:20131220072626p:plain

参考サイト

Alberto Pasca

頭と尻尾はくれてやる!

double