Passing data back from a modal view in WatchKit

前端 未结 6 1699
耶瑟儿~
耶瑟儿~ 2020-12-03 09:41

When modally presenting, or pushing, an interface controller we can specify the context parameter to pass some data to the new controller as follows.

         


        
6条回答
  •  北海茫月
    2020-12-03 10:25

    maybe there is some other ways but i prefer to use pushControllerWithName: method.

    Root controller:

    - (IBAction)GoToChildControllerButton {
        [self pushControllerWithName:@"TableInterfaceController" context:@"pass some data to child controller here..."];
    }
    

    Child controller:

    - (IBAction)BackToRootControllerButton {
        [self pushControllerWithName:@"TableInterfaceController" context:@"pass some data back to root controller here..."];
    }
    

提交回复
热议问题