You can see that after my line I add 40 spaces, but it starts at index 0. Can I do the same with the "\ t" tab instead of spaces? "?
NSString *firstString = [[NSString stringWithFormat:@"%@",stringToWrite] stringByPaddingToLength:40 withString:@" " startingAtIndex:0];
Yes @"\t" will put a tab instead of spaces.Also, your line might be a little simpler:
@"\t"
NSString *firstString = [stringToWrite stringByPaddingToLength:40 withString:@" " startingAtIndex:0];