diff options
author | Mikkel Krautz <mikkel@krautz.dk> | 2013-03-16 16:09:19 +0400 |
---|---|---|
committer | Mikkel Krautz <mikkel@krautz.dk> | 2013-03-16 16:09:19 +0400 |
commit | 3b3cdf10aa19a09e5154fb66bea800e3f4677e7c (patch) | |
tree | 2786405791b0c0325918efa5899bd8b41f9a0bd2 | |
parent | 47bf012ab71a87732ce62c04951cd3f3503e8a1f (diff) |
MUWelcomeScreenPad: fix rotation on iPad.
-rwxr-xr-x | Mumble.xcodeproj/project.pbxproj | 4 | ||||
-rw-r--r-- | Source/Classes/MUWelcomeScreenPad.m | 63 | ||||
-rw-r--r-- | Source/Classes/MUWelcomeScreenPad.xib | 251 | ||||
-rw-r--r-- | Source/Info.plist | 7 |
4 files changed, 61 insertions, 264 deletions
diff --git a/Mumble.xcodeproj/project.pbxproj b/Mumble.xcodeproj/project.pbxproj index 3bcbd74..931ff00 100755 --- a/Mumble.xcodeproj/project.pbxproj +++ b/Mumble.xcodeproj/project.pbxproj @@ -53,7 +53,6 @@ 2861C2B6116BE9BA002B8514 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2861C2B5116BE9BA002B8514 /* Security.framework */; }; 286A3CA0158BB17E00C817D1 /* MUAudioSidetonePreferencesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 286A3C9F158BB17E00C817D1 /* MUAudioSidetonePreferencesViewController.m */; }; 286A3CA4158CCF9F00C817D1 /* MUWelcomeScreenPad.m in Sources */ = {isa = PBXBuildFile; fileRef = 286A3CA2158CCF9D00C817D1 /* MUWelcomeScreenPad.m */; }; - 286A3CA5158CCF9F00C817D1 /* MUWelcomeScreenPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 286A3CA3158CCF9E00C817D1 /* MUWelcomeScreenPad.xib */; }; 286A3CA7158CD05A00C817D1 /* BackgroundTextureBlackGradientPad@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 286A3CA6158CD05A00C817D1 /* BackgroundTextureBlackGradientPad@2x.png */; }; 286A3CA9158CD12E00C817D1 /* LogoBigShadow@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 286A3CA8158CD12E00C817D1 /* LogoBigShadow@2x.png */; }; 286A3CAB158CD55700C817D1 /* LogoBigShadow.png in Resources */ = {isa = PBXBuildFile; fileRef = 286A3CAA158CD55700C817D1 /* LogoBigShadow.png */; }; @@ -306,7 +305,6 @@ 286A3C9F158BB17E00C817D1 /* MUAudioSidetonePreferencesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MUAudioSidetonePreferencesViewController.m; sourceTree = "<group>"; }; 286A3CA1158CCF9D00C817D1 /* MUWelcomeScreenPad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MUWelcomeScreenPad.h; sourceTree = "<group>"; }; 286A3CA2158CCF9D00C817D1 /* MUWelcomeScreenPad.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MUWelcomeScreenPad.m; sourceTree = "<group>"; }; - 286A3CA3158CCF9E00C817D1 /* MUWelcomeScreenPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MUWelcomeScreenPad.xib; sourceTree = "<group>"; }; 286A3CA6158CD05A00C817D1 /* BackgroundTextureBlackGradientPad@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "BackgroundTextureBlackGradientPad@2x.png"; path = "Resources/BackgroundTextureBlackGradientPad@2x.png"; sourceTree = "<group>"; }; 286A3CA8158CD12E00C817D1 /* LogoBigShadow@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "LogoBigShadow@2x.png"; path = "Resources/LogoBigShadow@2x.png"; sourceTree = "<group>"; }; 286A3CAA158CD55700C817D1 /* LogoBigShadow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = LogoBigShadow.png; path = Resources/LogoBigShadow.png; sourceTree = "<group>"; }; @@ -588,7 +586,6 @@ 2861C271116BE905002B8514 /* MUWelcomeScreenPhone.m */, 286A3CA1158CCF9D00C817D1 /* MUWelcomeScreenPad.h */, 286A3CA2158CCF9D00C817D1 /* MUWelcomeScreenPad.m */, - 286A3CA3158CCF9E00C817D1 /* MUWelcomeScreenPad.xib */, 287BA33E11B97EEE0010E031 /* MUFavouriteServerListController.h */, 287BA33F11B97EEE0010E031 /* MUFavouriteServerListController.m */, 287BA3A411B996D90010E031 /* MUFavouriteServerEditViewController.h */, @@ -1227,7 +1224,6 @@ 287172AC151A041A00153D74 /* certificatecell-intermediate@2x.png in Resources */, 28529B3B1541C043003DD813 /* certificatecreation.png in Resources */, 28529B3C1541C043003DD813 /* certificatecreation@2x.png in Resources */, - 286A3CA5158CCF9F00C817D1 /* MUWelcomeScreenPad.xib in Resources */, 286A3CA7158CD05A00C817D1 /* BackgroundTextureBlackGradientPad@2x.png in Resources */, 286A3CA9158CD12E00C817D1 /* LogoBigShadow@2x.png in Resources */, 286A3CAB158CD55700C817D1 /* LogoBigShadow.png in Resources */, diff --git a/Source/Classes/MUWelcomeScreenPad.m b/Source/Classes/MUWelcomeScreenPad.m index 0cc1bf1..cf56683 100644 --- a/Source/Classes/MUWelcomeScreenPad.m +++ b/Source/Classes/MUWelcomeScreenPad.m @@ -10,9 +10,12 @@ #import "MUFavouriteServerListController.h" #import "MULanServerListController.h" -@interface MUWelcomeScreenPad () <UIPopoverControllerDelegate> { +@interface MUWelcomeScreenPad () <UIPopoverControllerDelegate, UITableViewDataSource, UITableViewDelegate> { UIPopoverController *_prefsPopover; - IBOutlet UITableView *_tableView; + UIView *_view; + UIImageView *_backgroundView; + UITableView *_tableView; + UIImageView *_logoView; } @end @@ -24,16 +27,58 @@ return self; } -- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return UIInterfaceOrientationIsLandscape(interfaceOrientation); -} - -- (void) viewDidLoad { +- (void) loadView { + _view = [[UIView alloc] initWithFrame:CGRectZero]; + _view.frame = CGRectMake(0, 0, 768, 1024); + self.view = _view; + [_view release]; + + _backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BackgroundTextureBlackGradientPad"]]; + [_backgroundView setFrame:_view.frame]; + [_view addSubview:_backgroundView]; + [_backgroundView release]; + + _logoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"LogoBigShadow"]]; + [_view addSubview:_logoView]; + [_logoView release]; + + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; + _tableView.delegate = self; + _tableView.dataSource = self; _tableView.backgroundColor = [UIColor clearColor]; _tableView.opaque = NO; _tableView.backgroundView = nil; _tableView.scrollEnabled = NO; - _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // doesn't work? + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + [_view addSubview:_tableView]; + [_tableView release]; +} + +- (void) setViewPositions { + CGRect pr = self.view.frame; + CGFloat pw = pr.size.width; + + CGFloat lw = 259; + CGFloat lh = 259; + + CGFloat tw = 320; + CGFloat th = 210; + + [_backgroundView setFrame:_view.frame]; + [_logoView setFrame:CGRectMake(pw/2 - lw/2, 50, lw, lh)]; + [_tableView setFrame:CGRectMake(pw/2 - tw/2, 2*50 + lh, tw, th)]; +} + +- (void) viewWillLayoutSubviews { + [self setViewPositions]; +} + +- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return YES; +} + +- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { + [self setViewPositions]; } - (void) viewWillAppear:(BOOL)animated { @@ -161,7 +206,7 @@ UINavigationController *navCtrl = [[[UINavigationController alloc] initWithRootViewController:prefs] autorelease]; UIPopoverController *popOver = [[UIPopoverController alloc] initWithContentViewController:navCtrl]; popOver.popoverBackgroundViewClass = [MUPopoverBackgroundView class]; - [popOver setDelegate:self]; + popOver.delegate = self; [popOver presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; _prefsPopover = popOver; diff --git a/Source/Classes/MUWelcomeScreenPad.xib b/Source/Classes/MUWelcomeScreenPad.xib deleted file mode 100644 index 63316f0..0000000 --- a/Source/Classes/MUWelcomeScreenPad.xib +++ /dev/null @@ -1,251 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00"> - <data> - <int key="IBDocument.SystemTarget">1296</int> - <string key="IBDocument.SystemVersion">11E53</string> - <string key="IBDocument.InterfaceBuilderVersion">2182</string> - <string key="IBDocument.AppKitVersion">1138.47</string> - <string key="IBDocument.HIToolboxVersion">569.00</string> - <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> - <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="NS.object.0">1181</string> - </object> - <array key="IBDocument.IntegratedClassDependencies"> - <string>IBUITableView</string> - <string>IBUIImageView</string> - <string>IBUIView</string> - <string>IBProxyObject</string> - </array> - <array key="IBDocument.PluginDependencies"> - <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - </array> - <object class="NSMutableDictionary" key="IBDocument.Metadata"> - <string key="NS.key.0">PluginDependencyRecalculationVersion</string> - <integer value="1" key="NS.object.0"/> - </object> - <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> - <object class="IBProxyObject" id="841351856"> - <string key="IBProxiedObjectIdentifier">IBFilesOwner</string> - <string key="targetRuntimeIdentifier">IBIPadFramework</string> - </object> - <object class="IBProxyObject" id="606714003"> - <string key="IBProxiedObjectIdentifier">IBFirstResponder</string> - <string key="targetRuntimeIdentifier">IBIPadFramework</string> - </object> - <object class="IBUIView" id="766721923"> - <reference key="NSNextResponder"/> - <int key="NSvFlags">292</int> - <array class="NSMutableArray" key="NSSubviews"> - <object class="IBUIImageView" id="117208701"> - <reference key="NSNextResponder" ref="766721923"/> - <int key="NSvFlags">274</int> - <string key="NSFrameSize">{1024, 704}</string> - <reference key="NSSuperview" ref="766721923"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="88545328"/> - <string key="NSReuseIdentifierKey">_NS:9</string> - <bool key="IBUIUserInteractionEnabled">NO</bool> - <string key="targetRuntimeIdentifier">IBIPadFramework</string> - <object class="NSCustomResource" key="IBUIImage"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">BackgroundTextureBlackGradientPad.png</string> - </object> - </object> - <object class="IBUIImageView" id="88545328"> - <reference key="NSNextResponder" ref="766721923"/> - <int key="NSvFlags">292</int> - <string key="NSFrame">{{383, 49}, {259, 259}}</string> - <reference key="NSSuperview" ref="766721923"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView"/> - <string key="NSReuseIdentifierKey">_NS:9</string> - <bool key="IBUIUserInteractionEnabled">NO</bool> - <string key="targetRuntimeIdentifier">IBIPadFramework</string> - <object class="NSCustomResource" key="IBUIImage"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">LogoBigShadow.png</string> - </object> - </object> - <object class="IBUITableView" id="729396796"> - <reference key="NSNextResponder" ref="766721923"/> - <int key="NSvFlags">274</int> - <string key="NSFrame">{{352, 368}, {320, 209}}</string> - <reference key="NSSuperview" ref="766721923"/> - <reference key="NSWindow"/> - <string key="NSReuseIdentifierKey">_NS:9</string> - <object class="NSColor" key="IBUIBackgroundColor"> - <int key="NSColorSpace">1</int> - <bytes key="NSRGB">MCAwIDAgMAA</bytes> - </object> - <bool key="IBUIClipsSubviews">YES</bool> - <string key="targetRuntimeIdentifier">IBIPadFramework</string> - <bool key="IBUIAlwaysBounceVertical">YES</bool> - <int key="IBUIStyle">1</int> - <int key="IBUISectionIndexMinimumDisplayRowCount">0</int> - <bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool> - <float key="IBUIRowHeight">44</float> - <float key="IBUISectionHeaderHeight">10</float> - <float key="IBUISectionFooterHeight">10</float> - </object> - </array> - <string key="NSFrame">{{0, 64}, {1024, 704}}</string> - <reference key="NSSuperview"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="117208701"/> - <object class="NSColor" key="IBUIBackgroundColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MQA</bytes> - <object class="NSColorSpace" key="NSCustomColorSpace"> - <int key="NSID">2</int> - </object> - </object> - <bool key="IBUIClearsContextBeforeDrawing">NO</bool> - <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"> - <int key="IBUIStatusBarStyle">2</int> - </object> - <object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics"> - <int key="IBUIBarStyle">1</int> - <bool key="IBUIPrompted">NO</bool> - </object> - <object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics"> - <int key="IBUIInterfaceOrientation">3</int> - <int key="interfaceOrientation">3</int> - </object> - <string key="targetRuntimeIdentifier">IBIPadFramework</string> - </object> - </array> - <object class="IBObjectContainer" key="IBDocument.Objects"> - <array class="NSMutableArray" key="connectionRecords"> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">view</string> - <reference key="source" ref="841351856"/> - <reference key="destination" ref="766721923"/> - </object> - <int key="connectionID">3</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">_tableView</string> - <reference key="source" ref="841351856"/> - <reference key="destination" ref="729396796"/> - </object> - <int key="connectionID">13</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">dataSource</string> - <reference key="source" ref="729396796"/> - <reference key="destination" ref="841351856"/> - </object> - <int key="connectionID">11</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">delegate</string> - <reference key="source" ref="729396796"/> - <reference key="destination" ref="841351856"/> - </object> - <int key="connectionID">12</int> - </object> - </array> - <object class="IBMutableOrderedSet" key="objectRecords"> - <array key="orderedObjects"> - <object class="IBObjectRecord"> - <int key="objectID">0</int> - <array key="object" id="0"/> - <reference key="children" ref="1000"/> - <nil key="parent"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">-1</int> - <reference key="object" ref="841351856"/> - <reference key="parent" ref="0"/> - <string key="objectName">File's Owner</string> - </object> - <object class="IBObjectRecord"> - <int key="objectID">-2</int> - <reference key="object" ref="606714003"/> - <reference key="parent" ref="0"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">2</int> - <reference key="object" ref="766721923"/> - <array class="NSMutableArray" key="children"> - <reference ref="88545328"/> - <reference ref="117208701"/> - <reference ref="729396796"/> - </array> - <reference key="parent" ref="0"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">4</int> - <reference key="object" ref="117208701"/> - <reference key="parent" ref="766721923"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">5</int> - <reference key="object" ref="88545328"/> - <reference key="parent" ref="766721923"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">10</int> - <reference key="object" ref="729396796"/> - <reference key="parent" ref="766721923"/> - </object> - </array> - </object> - <dictionary class="NSMutableDictionary" key="flattenedProperties"> - <string key="-1.CustomClassName">MUWelcomeScreenPad</string> - <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="-2.CustomClassName">UIResponder</string> - <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/> - <nil key="activeLocalization"/> - <dictionary class="NSMutableDictionary" key="localizations"/> - <nil key="sourceID"/> - <int key="maxID">13</int> - </object> - <object class="IBClassDescriber" key="IBDocument.Classes"> - <array class="NSMutableArray" key="referencedPartialClassDescriptions"> - <object class="IBPartialClassDescription"> - <string key="className">MUWelcomeScreenPad</string> - <string key="superclassName">UIViewController</string> - <object class="NSMutableDictionary" key="outlets"> - <string key="NS.key.0">_tableView</string> - <string key="NS.object.0">UITableView</string> - </object> - <object class="NSMutableDictionary" key="toOneOutletInfosByName"> - <string key="NS.key.0">_tableView</string> - <object class="IBToOneOutletInfo" key="NS.object.0"> - <string key="name">_tableView</string> - <string key="candidateClassName">UITableView</string> - </object> - </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/MUWelcomeScreenPad.h</string> - </object> - </object> - </array> - </object> - <int key="IBDocument.localizationMode">0</int> - <string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string> - <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> - <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string> - <real value="1296" key="NS.object.0"/> - </object> - <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> - <int key="IBDocument.defaultPropertyAccessControl">3</int> - <dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes"> - <string key="BackgroundTextureBlackGradientPad.png">{1024, 768}</string> - <string key="LogoBigShadow.png">{259, 259}</string> - </dictionary> - <string key="IBCocoaTouchPluginVersion">1181</string> - </data> -</archive> diff --git a/Source/Info.plist b/Source/Info.plist index e623a50..6e3b5aa 100644 --- a/Source/Info.plist +++ b/Source/Info.plist @@ -81,5 +81,12 @@ <array> <string>UIInterfaceOrientationPortrait</string> </array> + <key>UISupportedInterfaceOrientations~ipad</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>UIInterfaceOrientationLandscapeRight</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + </array> </dict> </plist> |