Check if the line ends

I have an NSString that is long. as shown below. How can I check if a line ends to start a new one, without a separate word, and align it under C :?

enter image description here

Here is the code that I used to create what you can see in the image. This is used to create content in pdf.

NSString *truckDesc=truckDescriptionArray[ii];
            truckDesc=[truckDesc uppercaseString];

            if (truckDesc.length>0) {
               string41=[NSString stringWithFormat:@"CAMION %d : %@ \r               C : %@", ii+1,truckName ,truckDesc];

            }
 [string41 drawInRect:textRect5 withFont:font lineBreakMode:NSLineBreakByCharWrapping alignment:NSTextAlignmentLeft];
            CGContextSetFillColorWithColor(context, [UIColor blackColor].CGColor);

      

+3


source to share





All Articles