Skip to content

Commit 5d54c96

Browse files
committed
shake to toggle fullscreen feature
Press F11(or shake) shake to toggle fullscreen
1 parent da335dd commit 5d54c96

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

MIHTool for iPad.ipa

1.05 KB
Binary file not shown.

MIHTool for iPhone.ipa

1.06 KB
Binary file not shown.

MIHTool/MIHViewController.m

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ - (void)didReceiveMemoryWarning
2929
{
3030
[super didReceiveMemoryWarning];
3131
}
32+
-(BOOL) canBecomeFirstResponder
33+
{
34+
return YES;
35+
}
36+
37+
-(void) motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
38+
{
39+
if(event.subtype==UIEventSubtypeMotionShake)
40+
{
41+
if(self.tBar.hidden){
42+
[self showToolBars];
43+
}else{
44+
[self hideToolBars];
45+
}
46+
}
47+
}
3248
-(BOOL)shouldAutorotateToInterfaceOrientation:( UIInterfaceOrientation)interfaceOrientation
3349
{
3450
return YES;
@@ -81,17 +97,25 @@ -(IBAction) loadUrl:(id)sender{
8197
}
8298

8399
- (IBAction)hideToolbar:(id)sender {
84-
[self.tBar setHidden:YES];
85-
[self.bBar setHidden:YES];
86-
self.pageView.frame = self.view.bounds;
87-
[self.pageView reload];
100+
[self hideToolBars];
88101
}
89102

90103
- (IBAction)hideTBar:(id)sender {
104+
[self hideToolBars];
105+
}
106+
-(void)hideToolBars{
91107
[self.tBar setHidden:YES];
108+
[self.bBar setHidden:YES];
92109
self.pageView.frame = self.view.bounds;
93110
[self.pageView reload];
94111
}
112+
-(void)showToolBars{
113+
[self.tBar setHidden:NO];
114+
[self.bBar setHidden:NO];
115+
self.pageView.frame = CGRectMake(0,self.tBar.frame.size.height,
116+
self.view.bounds.size.width,self.view.bounds.size.height-self.bBar.frame.size.height-self.tBar.frame.size.height);
117+
[self.pageView reload];
118+
}
95119
- (void)viewDidUnload {
96120
[self setBBar:nil];
97121
[self setTBar:nil];

MIHTool/en.lproj/MainStoryboard_iPad.storyboard

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,24 @@
9191
</objects>
9292
</scene>
9393
</scenes>
94+
<classes>
95+
<class className="MIHViewController" superclassName="UIViewController">
96+
<source key="sourceIdentifier" type="project" relativePath="./Classes/MIHViewController.h"/>
97+
<relationships>
98+
<relationship kind="action" name="hideTBar:"/>
99+
<relationship kind="action" name="hideToolbar:"/>
100+
<relationship kind="action" name="launch:"/>
101+
<relationship kind="action" name="loadHome:"/>
102+
<relationship kind="action" name="loadUrl:"/>
103+
<relationship kind="action" name="switchWebKitDebugBorders:"/>
104+
<relationship kind="outlet" name="bBar" candidateClass="UIToolbar"/>
105+
<relationship kind="outlet" name="layerBorderSwitch" candidateClass="UISwitch"/>
106+
<relationship kind="outlet" name="pageView" candidateClass="UIWebView"/>
107+
<relationship kind="outlet" name="tBar" candidateClass="UIToolbar"/>
108+
<relationship kind="outlet" name="urlField" candidateClass="UITextField"/>
109+
</relationships>
110+
</class>
111+
</classes>
94112
<simulatedMetricsContainer key="defaultSimulatedMetrics">
95113
<simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackTranslucent"/>
96114
<simulatedOrientationMetrics key="orientation"/>

0 commit comments

Comments
 (0)