我有一系列的uitextviews在一个分页scrollview中。我希望每个页面内的文本可以在一个倾斜的矩形 (平行四边形) 中流动。附上图片 (我希望文本在白色轮廓线内流动)。
下方是相关代码。
也许只是用来流动吗?也许我需要在右侧“绘制”一个倾斜的矩形,以限制内容?
下方是相关代码。
for (int i = 0; i < imageArray.count; i++) {
CGRect framee;
framee.origin.x = self.uis_scrollView.frame.size.width * i;
framee.origin.y = 0;
framee.size = self.uis_scrollView.frame.size;
UITextView *newTextView = [[UITextView alloc] initWithFrame:framee];
UIBezierPath* rectanglePath = [UIBezierPath bezierPath];
[rectanglePath moveToPoint: CGPointMake(652, 687)];
[rectanglePath addLineToPoint: CGPointMake(680, 687)];
[rectanglePath addLineToPoint: CGPointMake(746, 541)];
[rectanglePath addLineToPoint: CGPointMake(718, 541)];
[rectanglePath addLineToPoint: CGPointMake(652, 687)];
[rectanglePath closePath];
UIBezierPath * imgRect = rectanglePath;
newTextView.textContainer.exclusionPaths = @[imgRect];
[newTextView setBackgroundColor:[UIColor clearColor]];
[newTextView setTextColor:[UIColor whiteColor]];
[newTextView setFont:[UIFont systemFontOfSize:16]];
newTextView.text = [imageArray objectAtIndex:i];
newTextView.userInteractionEnabled = NO;
[_uis_scrollView addSubview:newTextView];
}
也许只是用来流动吗?也许我需要在右侧“绘制”一个倾斜的矩形,以限制内容?