1
enter image description here如何在iOS中添加多個文本到視頻中,如圖所示?
我有多個文本添加到視頻像輪廓page.there應該是正確對齊的text.i我對齊面臨的問題,並新增多個文字。幫我解決這個問題!
CALayer *parentLayer = [CALayer layer];
CALayer *videoLayer = [CALayer layer];
parentLayer.frame = CGRectMake(0, 0, videoSize.width, videoSize.height);
videoLayer.frame = CGRectMake(0, 0, videoSize.width, videoSize.height);
videoLayer.masksToBounds=YES;
[parentLayer addSublayer:videoLayer];
[parentLayer addSublayer:aLayer];
CATextLayer *titleLayer = [CATextLayer layer];
titleLayer.string = @" Candidate Name ";
titleLayer.font = CFBridgingRetain(@"Helvetica");
titleLayer.fontSize =15.0f;
[titleLayer setFrame:CGRectMake(20.0f, 20.0f, videoSize.width, 30)]; // CGRectMake(0.0f, 0.0f,videoSize.width, videoSize.height);
titleLayer.opacity=0.0;
//?? titleLayer.shadowOpacity = 0.5;
titleLayer.alignmentMode = kCAAlignmentCenter;
// titleLayer.bounds = CGRectMake(0.5f, 0.5f, videoSize.width, 30); //You may need to adjust this for proper display
[aLayer addSublayer:titleLayer]; //ONLY IF WE ADDED TEXT
CATextLayer *titleLayer1 = [CATextLayer layer];
titleLayer1.string = @" Raman Srivastava";
titleLayer1.font = CFBridgingRetain(@"Helvetica");
titleLayer1.fontSize =15.0f;
[titleLayer1 setFrame:CGRectMake(25.0f,20.0f,videoSize.width, 30)];
titleLayer1.opacity=0.0;
//?? titleLayer.shadowOpacity = 0.5;
titleLayer1.alignmentMode = kCAAlignmentLeft;
// titleLayer.bounds = CGRectMake(10, 10, videoSize.width, videoSize.height/6); //You may need to adjust this for proper display
[aLayer addSublayer:titleLayer1]; //ONLY IF WE ADDED TEXT
UITableView與自定義UITableViewCell? UIStackView? – Larme
@Larme看到我的更新問題 –