I program on Xcode. How to add a category?

  • one
    Uncle, chessword, you will soon begin to be ignored with such a formulation of questions. Specify the situation. What categories? In what? Where? Is the database used? In what form, if yes. Where are the categories stored? What is your category in general? - zhenyab
  • From the site netcoder.ru "The category is used if you want to add behavior to a class without inheriting from it. That is, the category allows you to extend the class and add new methods to it without requiring source code for the class, as well as the added methods automatically become available to all classes inherited from the changeable. As usual, you start by creating a pair of files containing the @interface interface and the @implementation implementation. The category has its own name, list of methods, and the name of the class it expands. " - Sergey4590
  • one
  • And in your own words how? - Sergey4590

1 answer 1

New File-> Cocoa Touch-> Objective-c category -> category name: name & category on: NSString (in your case) So it was all the way!

  • What is your xcode? - x86-64
  • version 3.2.5 - Sergey4590
  • And why is it so old, you can say antediluvian why not 4.3.3? If you cannot create a category, create an NSObject class and in the .h file write the #import <Foundation / Foundation.h> @interface NSString (pars) @end and in the .m file write the #import "NSString + pars.h" @implementation NSString ( pars) @end just name your class NSString + pars. May the force be with you! - x86-64
  • Are the brackets, punctuation marks right? And then I swear import <Foundation / Foundation.h> @interface NSString (pars) @ end - Sergey4590
  • I write as you say. I swear at the line - (NSString *) stringBetweenString: (NSString *) start andString: (NSString *) end {Writes the following> Expected ';' before '{' token - Sergey4590