Original address: http://www.aichengxu.com/article/%CF%B5%CD%B3%D3%C5%BB%AF/28797_12.html
Unity3d and iOS interactive design <viewcontroller jump, the need for friends can refer to the next.
This is also the first time to do such a demand, but also the needs of the company. It's long story to make this.
Brother is not mainly engaged in iOS development, has been developing Android, but yesterday was the boss called the past to do iOS QR code scan. A bit of iOS based on me, had to search everywhere. Then, two-dimensional code scanning is done, encountered a problem, is to do a good two-dimensional code scanning to unity3d up. This is so hard ...
Just start, have been looking not to hit Rootcontroller, tried many times, had to give up. Finally I inherited a view, imitation alertdialog fill full screen, this is considered quickie.
Here's how:
1. This is a button click Method provided by Unity3d < This method is based on Unity3d engineer brother provided, their own in the Unityappcontroller class manually added, as for why this, I am not very clear, anyway this method, The Unity3d class is called, and execution goes down >
extern "C" void Setupcamera () {
This is the creation of a view controller object, of course, in order to invoke the Stepc method inside it
Unityappcontroller *uni=[[unityappcontroller Alloc]init];
This is the method that needs to be called [uni STEPC];}
2. Implementing the Stepc method in Unityappcontroller
-(void) stepc{ //Create a view that needs to pop up Self.alert = [[Mlcaralert alloc]init]; Custom height self.alert.height = [UIScreen mainscreen].bounds.size.height; [Self initnav]; Show Alert [Self.alert show];
}
In this case, the view jump is achieved, of course, there is a problem is that the custom dialog did not get the focus, which makes me very headache. Fortunately button only one, so, in the creation of dialog, I then defined a navigation bar, through the navigation bar to add buttons, use this button to solve. < of course, if the layout control was added in Unityappcontroller, it wouldn't cause the problem of losing focus, which I didn't solve later, because there were too many things. Too busy to come. >
Today, the boss let me make an interface, this interface control is a lot of. So, the method above is not. What about the last?
Fortunately, found such a method.
Keep looking, keep on researching, keep searching, the back finally found in iphone_view.mm I need Rootviewcontroller, as follows:
Uiviewcontroller *unitygetglviewcontroller () <span style= "font-family:arial, Helvetica, Sans-serif;" >{</span>
<span style= "font-family:arial, Helvetica, Sans-serif;" ><span style= "White-space:pre" ></span> return Getappcontroller () .rootviewcontroller;</span>
<span style= "font-family:arial, Helvetica, Sans-serif;" >}</span>
<span style= "font-family:arial, Helvetica, Sans-serif;" > In this way, we get the rootviewcontroller</span> of Unity3d.
<span style= "font-family:arial, Helvetica, Sans-serif;" ></span>
<span style= "font-family:arial, Helvetica, Sans-serif;" > Then just do it, copy your viewcontroller to the project,</span>
<span style= "font-family:arial, Helvetica, Sans-serif;" > Created: Tableformviewcontroller *table=[[tableformviewcontroller alloc]init];</span>
<span style= "font-family:arial, Helvetica, Sans-serif;" > Jump: [Unitygetglviewcontroller () presentviewcontroller:table Animated:yes completion:nil];</span>
In this way, you can go into your own viewcontroller operation.
If, there is a master passing, also please pointing fingers ah.