3
我在分頁滾動視圖中有一系列uitextviews。我希望每個頁面中的文本在傾斜的矩形(平行四邊形)內流動。附圖(我希望文字在白色輪廓內流動)。下面平行四邊形形狀內的流uitextview(iOS7)
代碼。
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];
}
也許它只是爲了四處流動?也許我需要在右側畫一個傾斜的矩形來限制內容?
完美的解釋 - 謝謝! – malaki1974