ios - How to set CATextLayer in video according to frame? -
i have try many think no success yet, question have 1 video on provide functionality write text on video , drag/drop text on video wand set catextlayer on video propper position set user not display on proper position please me.
this code used this.
catextlayer *titlelayer = [catextlayer layer];//<========code set text titlelayer.string = self.strtext; titlelayer.font = (__bridge cftyperef)(self.fonts);; titlelayer.fontsize = titlelayer.fontsize; titlelayer.position = cgpointmake (titlelayer.fontsize,titlelayer.fontsize); //?? titlelayer.shadowopacity = 0.5; titlelayer.alignmentmode = kcaalignmentcenter; titlelayer.bounds = cgrectmake(self.recttext.origin.x,self.recttext.origin.y-52, 480, 480); //you may need adjust proper display [titlelayer setbackgroundcolor:[uicolor redcolor].cgcolor]; [parentlayer addsublayer:titlelayer]; //only if added text
your code seems fine, not sure if frame provided wrong or right. if have provided right frame add code, in end:-
[titlelayer display];
it work now!
Comments
Post a Comment