Permalink
Browse files

Prevent toast from overlapping the tab bar

  • Loading branch information...
1 parent 6fdcee1 commit 38b5c7a6211261d2701210d34745c5cc782152f3 @Narmo Narmo committed Dec 30, 2011
Showing with 41 additions and 252 deletions.
  1. +2 −6 Classes/WToastAppDelegate.h
  2. +13 −6 Classes/WToastAppDelegate.m
  3. +3 −3 Classes/WToastViewController.m
  4. +0 −198 MainWindow.xib
  5. +0 −2 WToast-Info.plist
  6. +0 −4 WToast.xcodeproj/project.pbxproj
  7. +20 −32 WToast/WToast.m
  8. +3 −1 main.m
@@ -2,13 +2,9 @@
* @class WToastAppDelegate
*/
-@class WToastViewController;
-
-@interface WToastAppDelegate : NSObject <UIApplicationDelegate, UITextFieldDelegate> {
+@interface WToastAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
- WToastViewController *v;
+ UITabBarController *tabBarController;
}
-@property (nonatomic, retain) IBOutlet UIWindow *window;
-
@end
@@ -8,12 +8,19 @@
@implementation WToastAppDelegate
-@synthesize window;
-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- v = [[WToastViewController alloc] init];
- [self.window addSubview:v.view];
- [self.window makeKeyAndVisible];
+ window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
+ window.backgroundColor = [UIColor whiteColor];
+
+ tabBarController = [[UITabBarController alloc] init];
+
+ WToastViewController *v = [[WToastViewController alloc] init];
+ v.tabBarItem.title = @"Test tab";
+ tabBarController.viewControllers = [NSArray arrayWithObject:v];
+ [v release];
+
+ [window addSubview:tabBarController.view];
+ [window makeKeyAndVisible];
return YES;
}
@@ -37,7 +44,7 @@ - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
- (void)dealloc {
[window release];
- [v release];
+ [tabBarController release];
[super dealloc];
}
@@ -8,10 +8,10 @@
@implementation WToastViewController
-- (void)redrawInterface {
+- (void)redrawInterface:(UIInterfaceOrientation)orientation {
CGRect screenFrame = [UIScreen mainScreen].bounds;
float width, height;
- if (UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
+ if (UIInterfaceOrientationIsLandscape(orientation)) {
width = MAX(screenFrame.size.width, screenFrame.size.height);
height = MIN(screenFrame.size.width, screenFrame.size.height);
}
@@ -90,7 +90,7 @@ - (BOOL)textFieldShouldReturn:(UITextField *)aTextField {
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
- [self redrawInterface];
+ [self redrawInterface:toInterfaceOrientation];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
View
@@ -1,198 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
- <data>
- <int key="IBDocument.SystemTarget">800</int>
- <string key="IBDocument.SystemVersion">10D540</string>
- <string key="IBDocument.InterfaceBuilderVersion">760</string>
- <string key="IBDocument.AppKitVersion">1038.29</string>
- <string key="IBDocument.HIToolboxVersion">460.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">81</string>
- </object>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="2"/>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBProxyObject" id="841351856">
- <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- </object>
- <object class="IBProxyObject" id="427554174">
- <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- </object>
- <object class="IBUICustomObject" id="664661524">
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- </object>
- <object class="IBUIWindow" id="380026005">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">1316</int>
- <object class="NSPSMatrix" key="NSFrameMatrix"/>
- <string key="NSFrameSize">{320, 480}</string>
- <reference key="NSSuperview"/>
- <object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MSAxIDEAA</bytes>
- </object>
- <bool key="IBUIOpaque">NO</bool>
- <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
- <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <bool key="IBUIResizesToFullScreen">YES</bool>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="841351856"/>
- <reference key="destination" ref="664661524"/>
- </object>
- <int key="connectionID">4</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="664661524"/>
- <reference key="destination" ref="380026005"/>
- </object>
- <int key="connectionID">5</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <reference key="object" ref="0"/>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">2</int>
- <reference key="object" ref="380026005"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="parent" ref="0"/>
- </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">3</int>
- <reference key="object" ref="664661524"/>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="427554174"/>
- <reference key="parent" ref="0"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>-1.CustomClassName</string>
- <string>-2.CustomClassName</string>
- <string>2.IBAttributePlaceholdersKey</string>
- <string>2.IBEditorWindowLastContentRect</string>
- <string>2.IBPluginDependency</string>
- <string>3.CustomClassName</string>
- <string>3.IBPluginDependency</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>UIApplication</string>
- <string>UIResponder</string>
- <object class="NSMutableDictionary">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <string>{{198, 376}, {320, 480}}</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>WToastAppDelegate</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">9</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">WToastAppDelegate</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">window</string>
- <string key="NS.object.0">UIWindow</string>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Classes/WToastAppDelegate.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">WToastAppDelegate</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBUserSource</string>
- <string key="minorKey"/>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
- <integer value="3100" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">WToast.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">81</string>
- </data>
-</archive>
View
@@ -24,7 +24,5 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
- <key>NSMainNibFile</key>
- <string>MainWindow</string>
</dict>
</plist>
@@ -11,7 +11,6 @@
1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
- 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
AF5198C8142BBC41003E97EE /* WToastViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AF5198C7142BBC41003E97EE /* WToastViewController.m */; };
AF53D3C5134F4EAB00519C3A /* WToast.m in Sources */ = {isa = PBXBuildFile; fileRef = AF53D3C4134F4EAB00519C3A /* WToast.m */; };
AF53D486134F5CE200519C3A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF53D485134F5CE200519C3A /* QuartzCore.framework */; };
@@ -25,7 +24,6 @@
1D3623250D0F684500981E51 /* WToastAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WToastAppDelegate.m; sourceTree = "<group>"; };
1D6058910D05DD3D006BFB54 /* WToast.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WToast.app; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
- 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* WToast_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WToast_Prefix.pch; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* WToast-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "WToast-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
@@ -97,7 +95,6 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
- 28AD733E0D9D9553002E5188 /* MainWindow.xib */,
AFA2273D1361D9BD005139AD /* test.png */,
8D1107310486CEB800E47090 /* WToast-Info.plist */,
);
@@ -176,7 +173,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
AFA2273E1361D9BD005139AD /* test.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Oops, something went wrong.

0 comments on commit 38b5c7a

Please sign in to comment.