Iphone 如何在iOS上使用libharu以2/3行显示字符串?
我有一根绳子,它比它出现的地方的宽度还要长。我要做的是在2或3行上显示字符串 我的代码如下:Iphone 如何在iOS上使用libharu以2/3行显示字符串?,iphone,ios,xcode,libharu,Iphone,Ios,Xcode,Libharu,我有一根绳子,它比它出现的地方的宽度还要长。我要做的是在2或3行上显示字符串 我的代码如下: for (int i=0; i<claimsCount; i++) { File_Claim *fileClaim = [claimsArray objectAtIndex:i]; [self checkCreateNewPage:font:10.0]; ////////////////////////////////////////////////////////
for (int i=0; i<claimsCount; i++)
{
File_Claim *fileClaim = [claimsArray objectAtIndex:i];
[self checkCreateNewPage:font:10.0];
///////////////////////////////////////////////////////////////////////////////////////
// if the current category is the same as the previous one then don't write it again
///////////////////////////////////////////////////////////////////////////////////////
if ([subcategory isEqualToString:fileClaim.subCategoryName])
{
}
else
{
// hold the old category to check if it is the same
subcategory = fileClaim.subCategoryName;
//HPDF_Page_SetRGBFill (_currentPage, 0, 0, 1);
posY -= PDF_SPACER_Y;
HPDF_Page_TextOut(_currentPage, PDF_BASE_DATA_LABELS_START_X, posY, [fileClaim.subCategoryName cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
}
//HPDF_Page_SetRGBFill (_currentPage, 0, 0, 0);
posY -= PDF_SPACER_Y;
HPDF_Page_TextOut(_currentPage, PDF_BASE_DATA_LABELS_START_X+15, posY, [fileClaim.name cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
HPDF_Page_TextOut(_currentPage, [self alignRightNumberX:fileClaim.unitPrice:260], posY, [[NSString stringWithFormat:@"%.2f €",fileClaim.unitPrice] cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
HPDF_Page_TextOut(_currentPage, 320, posY, [[fileClaim getCalcString] cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
HPDF_Page_TextOut(_currentPage, [self alignRightNumberX:fileClaim.totalPrice:483], posY, [[NSString stringWithFormat:@"%.2f €",fileClaim.totalPrice] cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
}
现在,这必须在2或3行上进行,而不是1行。我不知道该怎么做
提前感谢,
Lewion我已经使用LibHaru好几天了,我遇到了同样的问题。。我开始编写自己的C函数来处理换行和多行支持;然后今天我发现
HPDF\u Page\u textrct()
实际上可以帮你完成这项工作:)
它会自动将多行中由矩形定义的区域中的单词包装起来,并返回写入的字符数…我已经使用LibHaru好几天了,遇到了同样的问题。。我开始编写自己的C函数来处理换行和多行支持;然后今天我发现
HPDF\u Page\u textrct()
实际上可以帮你完成这项工作:)
它将自动在矩形定义的区域中的多行上换行,并返回写入的字符数
HPDF_Page_TextOut(_currentPage, PDF_BASE_DATA_LABELS_START_X+15, posY, [fileClaim.name cStringUsingEncoding:NSWindowsCP1252StringEncoding]);