1

I have a storyboard with two scenes, both scenes are handled by the same WKInterfaceController. In the second scene there are 3 WKInterfaceLabels

In the init() method of the interface controller I am able to change the Label with setText function. When I try to change the WKInterfaceLabel "Dienst" in

- (void)table:(WKInterfaceTable *)table didSelectRowAtIndex:(NSInteger)rowIndex
    NSManagedObject *dienst = [TableArray objectAtIndex:rowIndex];
    [self.Dienst setText:@"Selected"];
    NSError *error;
    NSString *MP = [self read_KC_Pass:&error];
    [self.Benutzer setText:[self get_Benutzer:[dienst valueForKey:@"dienst"]:MP]];
    [self pushControllerWithName:@"Detail" context:nil];

The Value of WKInterfaceLabel Dienst is nil. Does anybody has a clue? I am not used to storyboard The outlet is defined, can be accessed in the init() method, but not in another method

JSA986
  • 5,870
  • 9
  • 45
  • 91
  • Log if your `didSelectRowAtIndex` is being called `NSLog(@"didSelectRow was called");` – JSA986 Apr 19 '15 at 21:47
  • How are you creating or arriving at your scene? Is it a push segue or are you doing an `init`? – Michael Dautermann Apr 19 '15 at 21:47
  • I have added a watchkitApp to my existing IOS_Project. My WatchKit App contains a storyboard with 2 Scenes. The main Scenes is the main entry point and contains a WKInterfaceTable. When the "didSelectRowAtIndex:" method is called I want to show the 2nd Scene with 3 WKInterfaceLabels which I need to change. Everything works except that I manage not to change the labels. I choose for the Main Scene and the 2nd Scene the same InterfaceController and when a table row is pressed I call : [self.Dienst setText:@"Selected"]; and after that [self pushControllerWithName:@"Detail" context:nil]; – Stephan Köpge Apr 20 '15 at 19:40
  • nslog in init method for your lable – Chirag Shah Apr 21 '15 at 06:40
  • In the init method I can change the label Lable is not nil. When I try to change it later on in the table row selected method the lable is nil ! So at init I can access the object but later on the varianle is nil that is somthing I ca not understand. I will check to use another way and use a seperate Interface Controller for Scene 2 and will try to use "push segue with contex" method . The lable I want to change does not belong to a table ! So Imanage to update table rows but not a simple lable realy crazy !!!! – Stephan Köpge Apr 21 '15 at 10:50
  • So I have fixed it Now. I have created a new InterfaceController for Scene 2 and used the "contextForSegueWithIdentifier" and "awakeWithContext" methods with that I was able to set the text at the labels. So it seems that you can not change the user interface in the method – Stephan Köpge Apr 21 '15 at 20:44

0 Answers0