-1
- (IBAction)B1:(id)sender {

    LastView *New;   
    New.Connection1=@"Salut";
}

LastView is my class to a viewcontroller that has a label T1. B1 is my button in another ViewController. I have declared in Lastview that T1.text=Connection1; but the label isn't changing when I press B1 which is my button in the other viewcontroller.

EmptyStack
  • 51,274
  • 23
  • 147
  • 178

1 Answers1

-1

Try writing a setter method for the string that you need to display in your label:

In your ListView.h:

 @interface ListView:UIViewController 

 @property (nonatomic,strong)NSString * t1Text;

 @end

In your ListView.m, write the setter for your string:

-(void)setT1Text:(NSString *)t1Text
 {
 yourLabel.text = t1Text;
 }

On your Button Click do the following

-(IBAction)B1:(id)sender 
 {
 LastView *New ; 
 New.t1Text=@"Salut";
 }
Jeff B
  • 8,572
  • 17
  • 61
  • 140
User1075
  • 819
  • 15
  • 36