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
ios objective-c nsstring


source to share


No one has answered this question yet

Check out similar questions:

1665
How can I get the UITextField to move upward when there is a keyboard - when starting editing?
1264
How to check an active internet connection on iOS or macOS?
1180
How can I check if a string contains another string in Objective-C?
795
How do I check the iOS version?
421
How can I check if NSDictionary or NSMutableDictionary contains a key?
413
How to hide the bottom row of a UINavigationBar 1px
354
Fast and Fast PDF Viewer for iPhone / iPad / iOs - Tips and Tricks?
317
When to use NSInteger vs. int
193
How to check if NSString starts with a specific character
0
How do I tweak long nsstrings and present them in uitextview?



All Articles
Loading...
X
Show
Funny
Dev
Pics