I am creating an application in Xcode, and running in some problems. I am using the gamekit framework to allow Bluetooth communication between two iOS devices. The application is set up so that one of the devices is "master" and the other is "slave", its screen content changes based on the data obtained from the "owner" device, the user can choose whether to be a master or slave , And when this option is made, the other device automatically becomes the opposite role. It is all done in a visual controller class. When a role is selected, a subview is added to the baseview controller.
What is my problem, is that when the subview is added, I would like to be able to send data using methods in the baseview controller. With the current setup, the action I have tried to do this so far, BASAUSEOU controller: MasterViewController: Most of the code in that code is a part of the standard apple documentation / examples, but I've included it to understand the flow of reasoning. I believe that the emergence of this problem can help anyone with the What type of accident do you get? and Keep in mind that the custom code for and you use --Build Master: (ID) sender { Data loss: @ "slave"]; // Peer device to be slave, because this tool is Master Master ViewController = [[MasterViewCentroler Alok] initWithNibName: @ "MasterViewController" bundle: zero]; [MasterViewController SetviewviewController: Self]; [Self.view addSubview: masterViewController.view]; } - (zero) datosound: (NSString *) direction {// - ???? - Change nsstating object to NSDATA - NSDTA * data; NSString * str = [NSString string withString: Direction]; Data = [St DataUnsing Encoding: NASCIITTN encoding]; [Myself reader: data]; } - (zero) datosound: (NSString *) direction {// - ???? - Change nsstating object to NSDATA - NSDTA * data; NSString * str = [NSString string withString: Direction]; Data = [St DataUnsing Encoding: NASCIITTN encoding]; [Myself reader: data]; } // ----------------------------------------------- ----------------------------- // - (zero) received data: (NSDT *) data from peer: (NSString *) co-worker Session: (GCASS *) Session Reference: (Zero *) Reference {// - ???? - Change NSData to NSStringa - NSString * str; Str = [[NSString alloc] initWithData: data encoding: NSASCIIStringEncoding]; [Data used for self: str]; [RR Release]; } - (Zero) Usage Data: (NSString *) str {if ([str isEqualToString: @ "forward"]) {[slaveViewController.view SetbackGram Color: [UIColor blackColor]]; }}
- (zero) Setbase VIPU controller: (Bseusewent Controller *) BVC {baseViewController = bvc; } - (IBAction) goForward: (ID) sender {actionLabel.text = @ "Outgoing Forward"; [Baseviewtranter datatused: @ "forward"]; }
master: sender and
setBaseViewController: bvc methods Fine? Thanks a lot!
EXC_BAD_ACCESS ? Try to turn on
NSZombieEnabled in your executable arguments It is difficult to say whether an accident can occur, but you can try to implement your
setBaseViewController: :
- (zero) Setbase VIPU controller: (baseview controller *) BVC [[VolunteeringValufor: @ "BaseviewCenter"]; [Baseweekentroller autoreage] BaseviewConverter = [retained BVC]; [Self-made variationTluFor: "@BasviewController"]; }
[baseViewController release]; Add
MasterViewController 's
-dealloc to .
baseViewController is not absolutely necessary if you have the following property announcement in your header file:
< Code> @property (nonatomic, retain) BaseViewController * baseViewController;
@inynthesize baseViewController , then the
-setBaseViewController: method is already generated for you, the key Designed with valuable observation support, if you are not familiar with the Objective-C 2.0 property, then I suggest reading.
Comments
Post a Comment