Should I put all my methods in one category (I mean for the same kind of object) or should I spli开发者_如何学Got them up in many files? (Something like NSStringAdditions vs. NSString+this and NSString+that)
That very much depends.
If they are closely related to each other, put them in the same category. If they solve quite different tasks, then splitting them is appropriate.
Also, reusing in different projects my be a point to consider.
Always treat categories with care, though. Although it is possible to extend existing classes, and in some cases it is justified use, don't abuse them. They come at a cost (performance, flexibility, maintenance). So if you have to decide to split your category, this is most of the time a sign for too much complexity here, and a subclass or other helper class is the better choice.
精彩评论