[Solved] Can’t use a string in .m


Add a property for your string in viewController.h outside the interface like this

viewController.h

{
NSString *string;
}
@property (nonatomic, retain) NSString *string; 

and synthesize it in

viewController.m

@synthesize string;

So that you can access that string in other files where you imported your viewController.h

EDIT:

create an object for your viewController.h in file2 and access like this

file2.h
   {
viewController *viewCont;
}
    file2.m

 #import"viewController.h"

-(IBAction)changestring:(id)sender
  {
      viewCont.string=@"something";
}

2

solved Can’t use a string in .m