Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed memory issues with 'self' in blocks.

Updated demo application for iOS 7.
WToast requires ARC now.
  • Loading branch information...
commit 9624650ad39718287e6638ed721ea066a5556aec 1 parent 94a6b4d
@Narmo Narmo authored
Showing with 755 additions and 895 deletions.
  1. +1 −0  .gitignore
  2. +0 −10 Classes/WToastAppDelegate.h
  3. +0 −45 Classes/WToastAppDelegate.m
  4. +0 −10 Classes/WToastTestViewController.h
  5. +0 −57 Classes/WToastTestViewController.m
  6. +0 −358 Classes/WToastTestViewController.xib
  7. BIN  Images/Default-568h@2x.png
  8. BIN  Images/Default-Landscape@2x~ipad.png
  9. BIN  Images/Default-Landscape~ipad.png
  10. BIN  Images/Default-Portrait@2x~ipad.png
  11. BIN  Images/Default-Portrait~ipad.png
  12. BIN  Images/Default.png
  13. BIN  Images/Default@2x.png
  14. BIN  Images/test.png
  15. 0  test.png → Images/test@2x.png
  16. +3 −2 README.md
  17. +0 −28 WToast-Info.plist
  18. +0 −289 WToast.xcodeproj/project.pbxproj
  19. +13 −7 WToast/WToast.h
  20. +72 −76 WToast/WToast.m
  21. +353 −0 WToastDemo.xcodeproj/project.pbxproj
  22. +1 −1  {WToast.xcodeproj → WToastDemo.xcodeproj}/project.xcworkspace/contents.xcworkspacedata
  23. +13 −0 WToastDemo/WAppDelegate.h
  24. +44 −0 WToastDemo/WAppDelegate.m
  25. +13 −0 WToastDemo/WTestViewController.h
  26. +55 −0 WToastDemo/WTestViewController.m
  27. +90 −0 WToastDemo/WTestViewController.xib
  28. +68 −0 WToastDemo/WToastDemo-Info.plist
  29. +14 −0 WToastDemo/WToastDemo-Prefix.pch
  30. +15 −0 WToastDemo/main.m
  31. +0 −4 WToast_Prefix.pch
  32. +0 −8 main.m
View
1  .gitignore
@@ -5,3 +5,4 @@ build/
*.perspectivev3
xcuserdata/
.DS_Store
+*.xccheckout
View
10 Classes/WToastAppDelegate.h
@@ -1,10 +0,0 @@
-/**
- * @class WToastAppDelegate
- */
-
-@interface WToastAppDelegate : NSObject <UIApplicationDelegate> {
- UIWindow *window;
- UITabBarController *tabBarController;
-}
-
-@end
View
45 Classes/WToastAppDelegate.m
@@ -1,45 +0,0 @@
-/**
- * @class WToastAppDelegate
- * @author Nik S Dyonin <wolf.step@gmail.com>
- */
-
-#import "WToastAppDelegate.h"
-#import "WToastTestViewController.h"
-
-@implementation WToastAppDelegate
-
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- window.backgroundColor = [UIColor whiteColor];
-
- tabBarController = [[UITabBarController alloc] init];
-
- WToastTestViewController *v = [[WToastTestViewController alloc] initWithNibName:@"WToastTestViewController" bundle:nil];
- v.tabBarItem.title = @"Test tab";
- tabBarController.viewControllers = [NSArray arrayWithObject:v];
-
- [window addSubview:tabBarController.view];
- [window makeKeyAndVisible];
- return YES;
-}
-
-- (void)applicationWillResignActive:(UIApplication *)application {
-}
-
-- (void)applicationDidEnterBackground:(UIApplication *)application {
-}
-
-- (void)applicationWillEnterForeground:(UIApplication *)application {
-}
-
-- (void)applicationDidBecomeActive:(UIApplication *)application {
-}
-
-- (void)applicationWillTerminate:(UIApplication *)application {
-}
-
-- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
-}
-
-
-@end
View
10 Classes/WToastTestViewController.h
@@ -1,10 +0,0 @@
-/**
- * @class WToastTestViewController
- * @author Nik S Dyonin <wolf.step@gmail.com>
- */
-
-@interface WToastTestViewController : UIViewController <UITextFieldDelegate>
-
-@property (retain, nonatomic) IBOutlet UITextField *textField;
-
-@end
View
57 Classes/WToastTestViewController.m
@@ -1,57 +0,0 @@
-/**
- * @class WToastTestViewController
- * @author Nik S Dyonin <wolf.step@gmail.com>
- */
-
-#import "WToastTestViewController.h"
-#import "WToast.h"
-
-@implementation WToastTestViewController
-
-@synthesize textField = _textField;
-
-- (void)viewDidLoad {
- [super viewDidLoad];
- self.textField.delegate = self;
-}
-
-- (BOOL)textFieldShouldReturn:(UITextField *)textField {
- [textField resignFirstResponder];
- return NO;
-}
-
-- (IBAction)showShortMessage {
- [self.textField resignFirstResponder];
- NSString *text = self.textField.text;
- if (!text || ![text length]) {
- text = @"No text!";
- }
- [WToast showWithText:text];
-}
-
-- (IBAction)showLongMessage {
- [self.textField resignFirstResponder];
- NSString *text = self.textField.text;
- if (!text || ![text length]) {
- text = @"No text!";
- }
- [WToast showWithText:text length:kWTLong];
-}
-
-- (IBAction)showShortImage {
- [WToast showWithImage:[UIImage imageNamed:@"test.png"]];
-}
-
-- (IBAction)showLongImage {
- [WToast showWithImage:[UIImage imageNamed:@"test.png"] length:kWTLong];
-}
-
-- (void)dealloc {
- self.textField = nil;
-}
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
- return YES;
-}
-
-@end
View
358 Classes/WToastTestViewController.xib
@@ -1,358 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.CocoaTouch.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>IBUIButton</string>
- <string>IBUIView</string>
- <string>IBUITextField</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="372490531">
- <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- </object>
- <object class="IBProxyObject" id="975951072">
- <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- </object>
- <object class="IBUIView" id="191373211">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">274</int>
- <array class="NSMutableArray" key="NSSubviews">
- <object class="IBUITextField" id="85812643">
- <reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">293</int>
- <string key="NSFrame">{{20, 20}, {280, 31}}</string>
- <reference key="NSSuperview" ref="191373211"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="929239091"/>
- <string key="NSReuseIdentifierKey">_NS:9</string>
- <bool key="IBUIOpaque">NO</bool>
- <bool key="IBUIClipsSubviews">YES</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <int key="IBUIContentVerticalAlignment">0</int>
- <string key="IBUIText"/>
- <int key="IBUIBorderStyle">3</int>
- <string key="IBUIPlaceholder">Type message here</string>
- <object class="NSColor" key="IBUITextColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MAA</bytes>
- <object class="NSColorSpace" key="NSCustomColorSpace" id="1062276086">
- <int key="NSID">2</int>
- </object>
- </object>
- <bool key="IBUIAdjustsFontSizeToFit">YES</bool>
- <float key="IBUIMinimumFontSize">17</float>
- <object class="IBUITextInputTraits" key="IBUITextInputTraits">
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- </object>
- <object class="IBUIFontDescription" key="IBUIFontDescription">
- <int key="type">1</int>
- <double key="pointSize">14</double>
- </object>
- <object class="NSFont" key="IBUIFont">
- <string key="NSName">Helvetica</string>
- <double key="NSSize">14</double>
- <int key="NSfFlags">16</int>
- </object>
- </object>
- <object class="IBUIButton" id="929239091">
- <reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">293</int>
- <string key="NSFrame">{{67, 64}, {186, 37}}</string>
- <reference key="NSSuperview" ref="191373211"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="1047793447"/>
- <string key="NSReuseIdentifierKey">_NS:9</string>
- <bool key="IBUIOpaque">NO</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <int key="IBUIContentHorizontalAlignment">0</int>
- <int key="IBUIContentVerticalAlignment">0</int>
- <int key="IBUIButtonType">1</int>
- <string key="IBUINormalTitle">Show short message</string>
- <object class="NSColor" key="IBUIHighlightedTitleColor" id="1066811319">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- </object>
- <object class="NSColor" key="IBUINormalTitleColor">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
- </object>
- <object class="NSColor" key="IBUINormalTitleShadowColor" id="993746344">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC41AA</bytes>
- </object>
- <object class="IBUIFontDescription" key="IBUIFontDescription" id="278947718">
- <int key="type">2</int>
- <double key="pointSize">15</double>
- </object>
- <object class="NSFont" key="IBUIFont" id="449476484">
- <string key="NSName">Helvetica-Bold</string>
- <double key="NSSize">15</double>
- <int key="NSfFlags">16</int>
- </object>
- </object>
- <object class="IBUIButton" id="1047793447">
- <reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">293</int>
- <string key="NSFrame">{{67, 109}, {186, 37}}</string>
- <reference key="NSSuperview" ref="191373211"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="183056902"/>
- <string key="NSReuseIdentifierKey">_NS:9</string>
- <bool key="IBUIOpaque">NO</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <int key="IBUIContentHorizontalAlignment">0</int>
- <int key="IBUIContentVerticalAlignment">0</int>
- <int key="IBUIButtonType">1</int>
- <string key="IBUINormalTitle">Show long message</string>
- <reference key="IBUIHighlightedTitleColor" ref="1066811319"/>
- <object class="NSColor" key="IBUINormalTitleColor">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
- </object>
- <reference key="IBUINormalTitleShadowColor" ref="993746344"/>
- <reference key="IBUIFontDescription" ref="278947718"/>
- <reference key="IBUIFont" ref="449476484"/>
- </object>
- <object class="IBUIButton" id="183056902">
- <reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">293</int>
- <string key="NSFrame">{{67, 154}, {186, 37}}</string>
- <reference key="NSSuperview" ref="191373211"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="399686425"/>
- <string key="NSReuseIdentifierKey">_NS:9</string>
- <bool key="IBUIOpaque">NO</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <int key="IBUIContentHorizontalAlignment">0</int>
- <int key="IBUIContentVerticalAlignment">0</int>
- <int key="IBUIButtonType">1</int>
- <string key="IBUINormalTitle">Show short image</string>
- <reference key="IBUIHighlightedTitleColor" ref="1066811319"/>
- <object class="NSColor" key="IBUINormalTitleColor">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
- </object>
- <reference key="IBUINormalTitleShadowColor" ref="993746344"/>
- <reference key="IBUIFontDescription" ref="278947718"/>
- <reference key="IBUIFont" ref="449476484"/>
- </object>
- <object class="IBUIButton" id="399686425">
- <reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">293</int>
- <string key="NSFrame">{{67, 199}, {186, 37}}</string>
- <reference key="NSSuperview" ref="191373211"/>
- <reference key="NSWindow"/>
- <string key="NSReuseIdentifierKey">_NS:9</string>
- <bool key="IBUIOpaque">NO</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <int key="IBUIContentHorizontalAlignment">0</int>
- <int key="IBUIContentVerticalAlignment">0</int>
- <int key="IBUIButtonType">1</int>
- <string key="IBUINormalTitle">Show long image</string>
- <reference key="IBUIHighlightedTitleColor" ref="1066811319"/>
- <object class="NSColor" key="IBUINormalTitleColor">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
- </object>
- <reference key="IBUINormalTitleShadowColor" ref="993746344"/>
- <reference key="IBUIFontDescription" ref="278947718"/>
- <reference key="IBUIFont" ref="449476484"/>
- </object>
- </array>
- <string key="NSFrame">{{0, 20}, {320, 460}}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="85812643"/>
- <object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- <reference key="NSCustomColorSpace" ref="1062276086"/>
- </object>
- <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</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="372490531"/>
- <reference key="destination" ref="191373211"/>
- </object>
- <int key="connectionID">3</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">textField</string>
- <reference key="source" ref="372490531"/>
- <reference key="destination" ref="85812643"/>
- </object>
- <int key="connectionID">9</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchEventConnection" key="connection">
- <string key="label">showShortMessage</string>
- <reference key="source" ref="929239091"/>
- <reference key="destination" ref="372490531"/>
- <int key="IBEventType">7</int>
- </object>
- <int key="connectionID">10</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchEventConnection" key="connection">
- <string key="label">showLongMessage</string>
- <reference key="source" ref="1047793447"/>
- <reference key="destination" ref="372490531"/>
- <int key="IBEventType">7</int>
- </object>
- <int key="connectionID">11</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchEventConnection" key="connection">
- <string key="label">showShortImage</string>
- <reference key="source" ref="183056902"/>
- <reference key="destination" ref="372490531"/>
- <int key="IBEventType">7</int>
- </object>
- <int key="connectionID">12</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchEventConnection" key="connection">
- <string key="label">showLongImage</string>
- <reference key="source" ref="399686425"/>
- <reference key="destination" ref="372490531"/>
- <int key="IBEventType">7</int>
- </object>
- <int key="connectionID">13</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="191373211"/>
- <array class="NSMutableArray" key="children">
- <reference ref="85812643"/>
- <reference ref="929239091"/>
- <reference ref="1047793447"/>
- <reference ref="183056902"/>
- <reference ref="399686425"/>
- </array>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="372490531"/>
- <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="975951072"/>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">4</int>
- <reference key="object" ref="85812643"/>
- <reference key="parent" ref="191373211"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5</int>
- <reference key="object" ref="929239091"/>
- <reference key="parent" ref="191373211"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">6</int>
- <reference key="object" ref="1047793447"/>
- <reference key="parent" ref="191373211"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">7</int>
- <reference key="object" ref="183056902"/>
- <reference key="parent" ref="191373211"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">8</int>
- <reference key="object" ref="399686425"/>
- <reference key="parent" ref="191373211"/>
- </object>
- </array>
- </object>
- <dictionary class="NSMutableDictionary" key="flattenedProperties">
- <string key="-1.CustomClassName">WToastTestViewController</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="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="8.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">WToastTestViewController</string>
- <string key="superclassName">UIViewController</string>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">textField</string>
- <string key="NS.object.0">UITextField</string>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <string key="NS.key.0">textField</string>
- <object class="IBToOneOutletInfo" key="NS.object.0">
- <string key="name">textField</string>
- <string key="candidateClassName">UITextField</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/WToastTestViewController.h</string>
- </object>
- </object>
- </array>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</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>
- <string key="IBCocoaTouchPluginVersion">1181</string>
- </data>
-</archive>
View
BIN  Images/Default-568h@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Images/Default-Landscape@2x~ipad.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Images/Default-Landscape~ipad.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Images/Default-Portrait@2x~ipad.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Images/Default-Portrait~ipad.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Images/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Images/Default@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Images/test.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  test.png → Images/test@2x.png
File renamed without changes
View
5 README.md
@@ -1,9 +1,10 @@
Info messages for iOS inspired by Android Toast object.
Features:
+
* Show toast object with custom text
* Show toast object with custom image
-Demo: http://www.youtube.com/watch?v=oVlfD-kRSsc
+Demo: http://www.youtube.com/watch?v=clTe6-MGqVQ
-The library is public domain. Written by Nik S Dyonin.
+The library is public domain. Created by Nik S Dyonin.
View
28 WToast-Info.plist
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleDisplayName</key>
- <string>${PRODUCT_NAME}</string>
- <key>CFBundleExecutable</key>
- <string>${EXECUTABLE_NAME}</string>
- <key>CFBundleIconFile</key>
- <string></string>
- <key>CFBundleIdentifier</key>
- <string>com.briteapps.${PRODUCT_NAME:rfc1034identifier}</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>${PRODUCT_NAME}</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0</string>
- <key>LSRequiresIPhoneOS</key>
- <true/>
-</dict>
-</plist>
View
289 WToast.xcodeproj/project.pbxproj
@@ -1,289 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 46;
- objects = {
-
-/* Begin PBXBuildFile section */
- 1D3623260D0F684500981E51 /* WToastAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* WToastAppDelegate.m */; };
- 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 */; };
- AF1AA29415A305A500C87E9E /* WToastTestViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1AA29215A305A500C87E9E /* WToastTestViewController.m */; };
- AF1AA29515A305A500C87E9E /* WToastTestViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = AF1AA29315A305A500C87E9E /* WToastTestViewController.xib */; };
- AF53D3C5134F4EAB00519C3A /* WToast.m in Sources */ = {isa = PBXBuildFile; fileRef = AF53D3C4134F4EAB00519C3A /* WToast.m */; };
- AF53D486134F5CE200519C3A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF53D485134F5CE200519C3A /* QuartzCore.framework */; };
- AF53D4A1134F5CF100519C3A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF53D4A0134F5CF100519C3A /* CoreGraphics.framework */; };
- AFA2273E1361D9BD005139AD /* test.png in Resources */ = {isa = PBXBuildFile; fileRef = AFA2273D1361D9BD005139AD /* test.png */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXFileReference section */
- 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
- 1D3623240D0F684500981E51 /* WToastAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WToastAppDelegate.h; sourceTree = "<group>"; };
- 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; };
- 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>"; };
- AF1AA29115A305A500C87E9E /* WToastTestViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WToastTestViewController.h; sourceTree = "<group>"; };
- AF1AA29215A305A500C87E9E /* WToastTestViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WToastTestViewController.m; sourceTree = "<group>"; };
- AF1AA29315A305A500C87E9E /* WToastTestViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WToastTestViewController.xib; sourceTree = "<group>"; };
- AF53D3C3134F4EAB00519C3A /* WToast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WToast.h; sourceTree = "<group>"; };
- AF53D3C4134F4EAB00519C3A /* WToast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WToast.m; sourceTree = "<group>"; };
- AF53D485134F5CE200519C3A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
- AF53D4A0134F5CF100519C3A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
- AFA2273D1361D9BD005139AD /* test.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = test.png; sourceTree = "<group>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
- 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
- AF53D486134F5CE200519C3A /* QuartzCore.framework in Frameworks */,
- AF53D4A1134F5CF100519C3A /* CoreGraphics.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 080E96DDFE201D6D7F000001 /* Classes */ = {
- isa = PBXGroup;
- children = (
- 1D3623240D0F684500981E51 /* WToastAppDelegate.h */,
- 1D3623250D0F684500981E51 /* WToastAppDelegate.m */,
- AF1AA29115A305A500C87E9E /* WToastTestViewController.h */,
- AF1AA29215A305A500C87E9E /* WToastTestViewController.m */,
- AF1AA29315A305A500C87E9E /* WToastTestViewController.xib */,
- );
- path = Classes;
- sourceTree = "<group>";
- };
- 19C28FACFE9D520D11CA2CBB /* Products */ = {
- isa = PBXGroup;
- children = (
- 1D6058910D05DD3D006BFB54 /* WToast.app */,
- );
- name = Products;
- sourceTree = "<group>";
- };
- 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
- isa = PBXGroup;
- children = (
- AF53D3C2134F4EAB00519C3A /* WToast */,
- 080E96DDFE201D6D7F000001 /* Classes */,
- 29B97315FDCFA39411CA2CEA /* Other Sources */,
- 29B97317FDCFA39411CA2CEA /* Resources */,
- 29B97323FDCFA39411CA2CEA /* Frameworks */,
- 19C28FACFE9D520D11CA2CBB /* Products */,
- );
- name = CustomTemplate;
- sourceTree = "<group>";
- };
- 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
- isa = PBXGroup;
- children = (
- 32CA4F630368D1EE00C91783 /* WToast_Prefix.pch */,
- 29B97316FDCFA39411CA2CEA /* main.m */,
- );
- name = "Other Sources";
- sourceTree = "<group>";
- };
- 29B97317FDCFA39411CA2CEA /* Resources */ = {
- isa = PBXGroup;
- children = (
- AFA2273D1361D9BD005139AD /* test.png */,
- 8D1107310486CEB800E47090 /* WToast-Info.plist */,
- );
- name = Resources;
- sourceTree = "<group>";
- };
- 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
- isa = PBXGroup;
- children = (
- AF53D4A0134F5CF100519C3A /* CoreGraphics.framework */,
- 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
- 1D30AB110D05D00D00671497 /* Foundation.framework */,
- AF53D485134F5CE200519C3A /* QuartzCore.framework */,
- );
- name = Frameworks;
- sourceTree = "<group>";
- };
- AF53D3C2134F4EAB00519C3A /* WToast */ = {
- isa = PBXGroup;
- children = (
- AF53D3C3134F4EAB00519C3A /* WToast.h */,
- AF53D3C4134F4EAB00519C3A /* WToast.m */,
- );
- path = WToast;
- sourceTree = "<group>";
- };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
- 1D6058900D05DD3D006BFB54 /* WToast */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "WToast" */;
- buildPhases = (
- 1D60588D0D05DD3D006BFB54 /* Resources */,
- 1D60588E0D05DD3D006BFB54 /* Sources */,
- 1D60588F0D05DD3D006BFB54 /* Frameworks */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = WToast;
- productName = WToast;
- productReference = 1D6058910D05DD3D006BFB54 /* WToast.app */;
- productType = "com.apple.product-type.application";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 29B97313FDCFA39411CA2CEA /* Project object */ = {
- isa = PBXProject;
- attributes = {
- LastUpgradeCheck = 0420;
- };
- buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "WToast" */;
- compatibilityVersion = "Xcode 3.2";
- developmentRegion = English;
- hasScannedForEncodings = 1;
- knownRegions = (
- English,
- Japanese,
- French,
- German,
- );
- mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 1D6058900D05DD3D006BFB54 /* WToast */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
- 1D60588D0D05DD3D006BFB54 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- AFA2273E1361D9BD005139AD /* test.png in Resources */,
- AF1AA29515A305A500C87E9E /* WToastTestViewController.xib in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
- 1D60588E0D05DD3D006BFB54 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 1D60589B0D05DD56006BFB54 /* main.m in Sources */,
- 1D3623260D0F684500981E51 /* WToastAppDelegate.m in Sources */,
- AF53D3C5134F4EAB00519C3A /* WToast.m in Sources */,
- AF1AA29415A305A500C87E9E /* WToastTestViewController.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin XCBuildConfiguration section */
- 1D6058940D05DD3E006BFB54 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ENABLE_OBJC_ARC = YES;
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = WToast_Prefix.pch;
- GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- INFOPLIST_FILE = "WToast-Info.plist";
- PRODUCT_NAME = WToast;
- };
- name = Debug;
- };
- 1D6058950D05DD3E006BFB54 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ENABLE_OBJC_ARC = YES;
- COPY_PHASE_STRIP = YES;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = WToast_Prefix.pch;
- GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- INFOPLIST_FILE = "WToast-Info.plist";
- PRODUCT_NAME = WToast;
- VALIDATE_PRODUCT = YES;
- };
- name = Release;
- };
- C01FCF4F08A954540054247B /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- CLANG_ENABLE_OBJC_ARC = YES;
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- GCC_C_LANGUAGE_STANDARD = c99;
- GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 4.0;
- SDKROOT = iphoneos;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Debug;
- };
- C01FCF5008A954540054247B /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- CLANG_ENABLE_OBJC_ARC = YES;
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- GCC_C_LANGUAGE_STANDARD = c99;
- GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 4.0;
- OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
- SDKROOT = iphoneos;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "WToast" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 1D6058940D05DD3E006BFB54 /* Debug */,
- 1D6058950D05DD3E006BFB54 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Debug;
- };
- C01FCF4E08A954540054247B /* Build configuration list for PBXProject "WToast" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- C01FCF4F08A954540054247B /* Debug */,
- C01FCF5008A954540054247B /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Debug;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
-}
View
20 WToast/WToast.h
@@ -1,21 +1,27 @@
-/**
- * @class WToast
- */
+//
+// WToast.h
+// WToast
+//
+// Small popup message inspired by Android Toast object
+//
+// Created by Nik S Dyonin on 08.04.11.
+// Copyright (c) 2011 Nik S Dyonin. All rights reserved.
+//
#define RGB(a, b, c) [UIColor colorWithRed:(a / 255.0f) green:(b / 255.0f) blue:(c / 255.0f) alpha:1.0f]
#define RGBA(a, b, c, d) [UIColor colorWithRed:(a / 255.0f) green:(b / 255.0f) blue:(c / 255.0f) alpha:d]
-typedef enum {
+typedef NS_ENUM(NSInteger, WToastDuration) {
kWTShort = 1,
kWTLong = 5
-} WToastLength;
+};
@interface WToast : UIView
+ (void)showWithText:(NSString *)text;
+ (void)showWithImage:(UIImage *)image;
-+ (void)showWithText:(NSString *)text length:(WToastLength)length;
-+ (void)showWithImage:(UIImage *)image length:(WToastLength)length;
++ (void)showWithText:(NSString *)text duration:(WToastDuration)duration;
++ (void)showWithImage:(UIImage *)image duration:(WToastDuration)duration;
@end
View
148 WToast/WToast.m
@@ -1,101 +1,109 @@
-/**
- * @class WToast
- * @author Nik S Dyonin <wolf.step@gmail.com>
- * Small popup message inspired by Android Toast object
- */
+//
+// WToast.m
+// WToast
+//
+// Small popup message inspired by Android Toast object
+//
+// Created by Nik S Dyonin on 08.04.11.
+// Copyright (c) 2011 Nik S Dyonin. All rights reserved.
+//
#import "WToast.h"
-#import <QuartzCore/QuartzCore.h>
+
+@import QuartzCore;
+
+#if !__has_feature(objc_arc)
+#error WToast requires ARC
+#endif
#define TABBAR_OFFSET 44.0f
@interface WToast()
-@property (nonatomic) NSInteger length;
+@property (nonatomic) NSInteger duration;
@end
@implementation WToast
-@synthesize length = _length;
-
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame]) != nil) {
- _length = kWTShort;
+ _duration = kWTShort;
+ self.userInteractionEnabled = NO;
}
return self;
}
- (void)__show {
- [UIView animateWithDuration:0.2f
- animations:^{
- self.alpha = 1.0f;
- }
- completion:^(BOOL finished) {
- [self performSelector:@selector(__hide) withObject:nil afterDelay:_length];
- }];
+ __weak typeof(self) weakSelf = self;
+
+ [UIView
+ animateWithDuration:0.2f
+ animations:^{
+ weakSelf.alpha = 1.0f;
+ }
+ completion:^(BOOL finished) {
+ [weakSelf performSelector:@selector(__hide) withObject:nil afterDelay:_duration];
+ }];
}
- (void)__hide {
- [UIView animateWithDuration:0.8f
- animations:^{
- self.alpha = 0.0f;
- }
- completion:^(BOOL finished) {
- [self removeFromSuperview];
-#if !__has_feature(objc_arc)
- [self release];
-#endif
-
- }];
+ __weak typeof(self) weakSelf = self;
+
+ [UIView
+ animateWithDuration:0.8f
+ animations:^{
+ weakSelf.alpha = 0.0f;
+ }
+ completion:^(BOOL finished) {
+ [weakSelf removeFromSuperview];
+ }];
}
+ (WToast *)__createWithText:(NSString *)text {
- float screenWidth, screenHeight;
+ CGFloat screenWidth;
CGSize screenSize = [UIScreen mainScreen].bounds.size;
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
switch (orientation) {
case UIInterfaceOrientationPortraitUpsideDown: {
screenWidth = MIN(screenSize.width, screenSize.height);
- screenHeight = MAX(screenSize.width, screenSize.height);
break;
}
case UIInterfaceOrientationLandscapeLeft: {
screenWidth = MAX(screenSize.width, screenSize.height);
- screenHeight = MIN(screenSize.width, screenSize.height);
break;
}
case UIInterfaceOrientationLandscapeRight: {
screenWidth = MAX(screenSize.width, screenSize.height);
- screenHeight = MIN(screenSize.width, screenSize.height);
break;
}
default: {
screenWidth = MIN(screenSize.width, screenSize.height);
- screenHeight = MAX(screenSize.width, screenSize.height);
break;
}
}
- float x = 10.0f;
- float width = screenWidth - x * 2.0f;
+ CGFloat x = 10.0f;
+ CGFloat width = screenWidth - x * 2.0f;
UILabel *textLabel = [[UILabel alloc] init];
textLabel.backgroundColor = [UIColor clearColor];
- textLabel.textAlignment = UITextAlignmentCenter;
+ textLabel.textAlignment = NSTextAlignmentCenter;
textLabel.font = [UIFont systemFontOfSize:14];
textLabel.textColor = RGB(255, 255, 255);
textLabel.numberOfLines = 0;
- textLabel.lineBreakMode = UILineBreakModeWordWrap;
- CGSize sz = [text sizeWithFont:textLabel.font
- constrainedToSize:CGSizeMake(width - 20.0f, 9999.0f)
- lineBreakMode:textLabel.lineBreakMode];
+ textLabel.lineBreakMode = NSLineBreakByWordWrapping;
- CGRect tmpRect = CGRectZero;
+ CGRect tmpRect = [text boundingRectWithSize:CGSizeMake(width - 20.0f, FLT_MAX)
+ options:NSStringDrawingUsesLineFragmentOrigin
+ attributes:@{NSFontAttributeName: textLabel.font}
+ context:nil];
+
+ tmpRect.origin = CGPointZero;
tmpRect.size.width = width;
- tmpRect.size.height = MAX(sz.height + 20.0f, 38.0f);
+ tmpRect.size.height = MAX(tmpRect.size.height + 20.0f, 38.0f);
WToast *toast = [[WToast alloc] initWithFrame:tmpRect];
toast.backgroundColor = RGBA(0, 0, 0, 0.8f);
@@ -104,50 +112,43 @@ + (WToast *)__createWithText:(NSString *)text {
layer.cornerRadius = 5.0f;
textLabel.text = text;
- tmpRect.origin.x = floor((toast.frame.size.width - sz.width) / 2.0f);
- tmpRect.origin.y = floor((toast.frame.size.height - sz.height) / 2.0f);
- tmpRect.size = sz;
+ tmpRect.origin.x = floor((toast.frame.size.width - tmpRect.size.width) / 2.0f);
+ tmpRect.origin.y = floor((toast.frame.size.height - tmpRect.size.height) / 2.0f);
textLabel.frame = tmpRect;
+
[toast addSubview:textLabel];
-#if !__has_feature(objc_arc)
- [textLabel release];
-#endif
-
+
toast.alpha = 0.0f;
return toast;
}
+ (WToast *)__createWithImage:(UIImage *)image {
- float screenWidth, screenHeight;
+ CGFloat screenWidth;
CGSize screenSize = [UIScreen mainScreen].bounds.size;
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
switch (orientation) {
case UIInterfaceOrientationPortraitUpsideDown: {
screenWidth = MIN(screenSize.width, screenSize.height);
- screenHeight = MAX(screenSize.width, screenSize.height);
break;
}
case UIInterfaceOrientationLandscapeLeft: {
screenWidth = MAX(screenSize.width, screenSize.height);
- screenHeight = MIN(screenSize.width, screenSize.height);
break;
}
case UIInterfaceOrientationLandscapeRight: {
screenWidth = MAX(screenSize.width, screenSize.height);
- screenHeight = MIN(screenSize.width, screenSize.height);
break;
}
default: {
screenWidth = MIN(screenSize.width, screenSize.height);
- screenHeight = MAX(screenSize.width, screenSize.height);
break;
}
}
- float x = 10.0f;
- float width = screenWidth - x * 2.0f;
+ CGFloat x = 10.0f;
+ CGFloat width = screenWidth - x * 2.0f;
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
CGSize sz = imageView.frame.size;
@@ -167,10 +168,7 @@ + (WToast *)__createWithImage:(UIImage *)image {
tmpRect.size = sz;
imageView.frame = tmpRect;
[toast addSubview:imageView];
-#if !__has_feature(objc_arc)
- [imageView release];
-#endif
-
+
toast.alpha = 0.0f;
return toast;
@@ -180,38 +178,36 @@ - (void)__flipViewAccordingToStatusBarOrientation {
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
CGFloat angle = 0.0;
CGSize screenSize = [UIScreen mainScreen].bounds.size;
- float x, y;
- float screenWidth, screenHeight;
+ CGFloat x;
+ CGFloat y;
switch (orientation) {
case UIInterfaceOrientationPortraitUpsideDown: {
angle = M_PI;
- screenWidth = MIN(screenSize.width, screenSize.height);
- screenHeight = MAX(screenSize.width, screenSize.height);
+ CGFloat screenWidth = MIN(screenSize.width, screenSize.height);
x = floor((screenWidth - self.bounds.size.width) / 2.0f);
y = 15.0f + TABBAR_OFFSET;
break;
}
case UIInterfaceOrientationLandscapeLeft: {
angle = - M_PI / 2.0f;
- screenWidth = MAX(screenSize.width, screenSize.height);
- screenHeight = MIN(screenSize.width, screenSize.height);
+ CGFloat screenWidth = MAX(screenSize.width, screenSize.height);
+ CGFloat screenHeight = MIN(screenSize.width, screenSize.height);
x = screenHeight - self.bounds.size.height - 15.0f - TABBAR_OFFSET;
y = floor((screenWidth - self.bounds.size.width) / 2.0f);
break;
}
case UIInterfaceOrientationLandscapeRight: {
angle = M_PI / 2.0f;
- screenWidth = MAX(screenSize.width, screenSize.height);
- screenHeight = MIN(screenSize.width, screenSize.height);
+ CGFloat screenWidth = MAX(screenSize.width, screenSize.height);
x = 15.0f + TABBAR_OFFSET;
y = floor((screenWidth - self.bounds.size.width) / 2.0f);
break;
}
default: {
angle = 0.0;
- screenWidth = MIN(screenSize.width, screenSize.height);
- screenHeight = MAX(screenSize.width, screenSize.height);
+ CGFloat screenWidth = MIN(screenSize.width, screenSize.height);
+ CGFloat screenHeight = MAX(screenSize.width, screenSize.height);
x = floor((screenWidth - self.bounds.size.width) / 2.0f);
y = screenHeight - self.bounds.size.height - 15.0f - TABBAR_OFFSET;
break;
@@ -230,7 +226,7 @@ - (void)__flipViewAccordingToStatusBarOrientation {
* @param text Text to print in toast window
*/
+ (void)showWithText:(NSString *)text {
- [WToast showWithText:text length:kWTShort];
+ [WToast showWithText:text duration:kWTShort];
}
/**
@@ -238,7 +234,7 @@ + (void)showWithText:(NSString *)text {
* @param image Image to show in toast window
*/
+ (void)showWithImage:(UIImage *)image {
- [WToast showWithImage:image length:kWTShort];
+ [WToast showWithImage:image duration:kWTShort];
}
/**
@@ -246,9 +242,9 @@ + (void)showWithImage:(UIImage *)image {
* @param text Text to print in toast window
* @param length Toast visibility duration
*/
-+ (void)showWithText:(NSString *)text length:(WToastLength)length {
++ (void)showWithText:(NSString *)text duration:(WToastDuration)duration {
WToast *toast = [WToast __createWithText:text];
- toast.length = length;
+ toast.duration = duration;
UIWindow *mainWindow = [[UIApplication sharedApplication] keyWindow];
[mainWindow addSubview:toast];
@@ -262,9 +258,9 @@ + (void)showWithText:(NSString *)text length:(WToastLength)length {
* @param image Image to show in toast window
* @param length Toast visibility duration
*/
-+ (void)showWithImage:(UIImage *)image length:(WToastLength)length {
++ (void)showWithImage:(UIImage *)image duration:(WToastDuration)duration {
WToast *toast = [WToast __createWithImage:image];
- toast.length = length;
+ toast.duration = duration;
UIWindow *mainWindow = [[UIApplication sharedApplication] keyWindow];
[mainWindow addSubview:toast];
View
353 WToastDemo.xcodeproj/project.pbxproj
@@ -0,0 +1,353 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ AF0C68741885D1F2000E4147 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AF0C686C1885D1F2000E4147 /* main.m */; };
+ AF0C68751885D1F2000E4147 /* WAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AF0C686E1885D1F2000E4147 /* WAppDelegate.m */; };
+ AF0C68761885D1F2000E4147 /* WTestViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AF0C68701885D1F2000E4147 /* WTestViewController.m */; };
+ AF0C68771885D1F2000E4147 /* WTestViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = AF0C68711885D1F2000E4147 /* WTestViewController.xib */; };
+ AF0C687C1885D248000E4147 /* test.png in Resources */ = {isa = PBXBuildFile; fileRef = AF0C687B1885D248000E4147 /* test.png */; };
+ AF0C68801885D250000E4147 /* WToast.m in Sources */ = {isa = PBXBuildFile; fileRef = AF0C687F1885D250000E4147 /* WToast.m */; };
+ AF0C68881885D3E7000E4147 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AF0C68811885D3E7000E4147 /* Default-568h@2x.png */; };
+ AF0C68891885D3E7000E4147 /* Default-Landscape@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = AF0C68821885D3E7000E4147 /* Default-Landscape@2x~ipad.png */; };
+ AF0C688A1885D3E7000E4147 /* Default-Landscape~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = AF0C68831885D3E7000E4147 /* Default-Landscape~ipad.png */; };
+ AF0C688B1885D3E7000E4147 /* Default-Portrait@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = AF0C68841885D3E7000E4147 /* Default-Portrait@2x~ipad.png */; };
+ AF0C688C1885D3E7000E4147 /* Default-Portrait~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = AF0C68851885D3E7000E4147 /* Default-Portrait~ipad.png */; };
+ AF0C688D1885D3E7000E4147 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = AF0C68861885D3E7000E4147 /* Default.png */; };
+ AF0C688E1885D3E7000E4147 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AF0C68871885D3E7000E4147 /* Default@2x.png */; };
+ AF0C68901885D441000E4147 /* test@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AF0C688F1885D441000E4147 /* test@2x.png */; };
+ AF0C68921885D772000E4147 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF0C68911885D772000E4147 /* CoreGraphics.framework */; };
+ AF0C68941885D778000E4147 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF0C68931885D778000E4147 /* Foundation.framework */; };
+ AF0C68961885D77C000E4147 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF0C68951885D77C000E4147 /* UIKit.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ AF0C68341885C946000E4147 /* WToastDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WToastDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ AF0C686C1885D1F2000E4147 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ AF0C686D1885D1F2000E4147 /* WAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WAppDelegate.h; sourceTree = "<group>"; };
+ AF0C686E1885D1F2000E4147 /* WAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WAppDelegate.m; sourceTree = "<group>"; };
+ AF0C686F1885D1F2000E4147 /* WTestViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTestViewController.h; sourceTree = "<group>"; };
+ AF0C68701885D1F2000E4147 /* WTestViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WTestViewController.m; sourceTree = "<group>"; };
+ AF0C68711885D1F2000E4147 /* WTestViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WTestViewController.xib; sourceTree = "<group>"; };
+ AF0C68721885D1F2000E4147 /* WToastDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "WToastDemo-Info.plist"; sourceTree = "<group>"; };
+ AF0C68731885D1F2000E4147 /* WToastDemo-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WToastDemo-Prefix.pch"; sourceTree = "<group>"; };
+ AF0C687B1885D248000E4147 /* test.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = test.png; sourceTree = "<group>"; };
+ AF0C687E1885D250000E4147 /* WToast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WToast.h; sourceTree = "<group>"; };
+ AF0C687F1885D250000E4147 /* WToast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WToast.m; sourceTree = "<group>"; };
+ AF0C68811885D3E7000E4147 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
+ AF0C68821885D3E7000E4147 /* Default-Landscape@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape@2x~ipad.png"; sourceTree = "<group>"; };
+ AF0C68831885D3E7000E4147 /* Default-Landscape~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape~ipad.png"; sourceTree = "<group>"; };
+ AF0C68841885D3E7000E4147 /* Default-Portrait@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait@2x~ipad.png"; sourceTree = "<group>"; };
+ AF0C68851885D3E7000E4147 /* Default-Portrait~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait~ipad.png"; sourceTree = "<group>"; };
+ AF0C68861885D3E7000E4147 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
+ AF0C68871885D3E7000E4147 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
+ AF0C688F1885D441000E4147 /* test@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "test@2x.png"; sourceTree = "<group>"; };
+ AF0C68911885D772000E4147 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ AF0C68931885D778000E4147 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ AF0C68951885D77C000E4147 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ AF0C68311885C946000E4147 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ AF0C68961885D77C000E4147 /* UIKit.framework in Frameworks */,
+ AF0C68941885D778000E4147 /* Foundation.framework in Frameworks */,
+ AF0C68921885D772000E4147 /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ AF0C682B1885C946000E4147 = {
+ isa = PBXGroup;
+ children = (
+ AF0C687D1885D250000E4147 /* WToast */,
+ AF0C686B1885D1F2000E4147 /* WToastDemo */,
+ AF0C687A1885D248000E4147 /* Images */,
+ AF0C68361885C946000E4147 /* Frameworks */,
+ AF0C68351885C946000E4147 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ AF0C68351885C946000E4147 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ AF0C68341885C946000E4147 /* WToastDemo.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ AF0C68361885C946000E4147 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ AF0C68951885D77C000E4147 /* UIKit.framework */,
+ AF0C68931885D778000E4147 /* Foundation.framework */,
+ AF0C68911885D772000E4147 /* CoreGraphics.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ AF0C686B1885D1F2000E4147 /* WToastDemo */ = {
+ isa = PBXGroup;
+ children = (
+ AF0C68791885D215000E4147 /* Supporting files */,
+ AF0C686D1885D1F2000E4147 /* WAppDelegate.h */,
+ AF0C686E1885D1F2000E4147 /* WAppDelegate.m */,
+ AF0C686F1885D1F2000E4147 /* WTestViewController.h */,
+ AF0C68701885D1F2000E4147 /* WTestViewController.m */,
+ AF0C68711885D1F2000E4147 /* WTestViewController.xib */,
+ );
+ path = WToastDemo;
+ sourceTree = "<group>";
+ };
+ AF0C68791885D215000E4147 /* Supporting files */ = {
+ isa = PBXGroup;
+ children = (
+ AF0C686C1885D1F2000E4147 /* main.m */,
+ AF0C68721885D1F2000E4147 /* WToastDemo-Info.plist */,
+ AF0C68731885D1F2000E4147 /* WToastDemo-Prefix.pch */,
+ );
+ name = "Supporting files";
+ sourceTree = "<group>";
+ };
+ AF0C687A1885D248000E4147 /* Images */ = {
+ isa = PBXGroup;
+ children = (
+ AF0C68811885D3E7000E4147 /* Default-568h@2x.png */,
+ AF0C68821885D3E7000E4147 /* Default-Landscape@2x~ipad.png */,
+ AF0C68831885D3E7000E4147 /* Default-Landscape~ipad.png */,
+ AF0C68841885D3E7000E4147 /* Default-Portrait@2x~ipad.png */,
+ AF0C68851885D3E7000E4147 /* Default-Portrait~ipad.png */,
+ AF0C68861885D3E7000E4147 /* Default.png */,
+ AF0C68871885D3E7000E4147 /* Default@2x.png */,
+ AF0C687B1885D248000E4147 /* test.png */,
+ AF0C688F1885D441000E4147 /* test@2x.png */,
+ );
+ path = Images;
+ sourceTree = "<group>";
+ };
+ AF0C687D1885D250000E4147 /* WToast */ = {
+ isa = PBXGroup;
+ children = (
+ AF0C687E1885D250000E4147 /* WToast.h */,
+ AF0C687F1885D250000E4147 /* WToast.m */,
+ );
+ path = WToast;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ AF0C68331885C946000E4147 /* WToastDemo */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = AF0C68601885C947000E4147 /* Build configuration list for PBXNativeTarget "WToastDemo" */;
+ buildPhases = (
+ AF0C68301885C946000E4147 /* Sources */,
+ AF0C68311885C946000E4147 /* Frameworks */,
+ AF0C68321885C946000E4147 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = WToastDemo;
+ productName = WToast;
+ productReference = AF0C68341885C946000E4147 /* WToastDemo.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ AF0C682C1885C946000E4147 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ CLASSPREFIX = W;
+ LastUpgradeCheck = 0500;
+ ORGANIZATIONNAME = "Nik S Dyonin";
+ };
+ buildConfigurationList = AF0C682F1885C946000E4147 /* Build configuration list for PBXProject "WToastDemo" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = AF0C682B1885C946000E4147;
+ productRefGroup = AF0C68351885C946000E4147 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ AF0C68331885C946000E4147 /* WToastDemo */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ AF0C68321885C946000E4147 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ AF0C688B1885D3E7000E4147 /* Default-Portrait@2x~ipad.png in Resources */,
+ AF0C68771885D1F2000E4147 /* WTestViewController.xib in Resources */,
+ AF0C687C1885D248000E4147 /* test.png in Resources */,
+ AF0C688E1885D3E7000E4147 /* Default@2x.png in Resources */,
+ AF0C688D1885D3E7000E4147 /* Default.png in Resources */,
+ AF0C688C1885D3E7000E4147 /* Default-Portrait~ipad.png in Resources */,
+ AF0C68901885D441000E4147 /* test@2x.png in Resources */,
+ AF0C68881885D3E7000E4147 /* Default-568h@2x.png in Resources */,
+ AF0C68891885D3E7000E4147 /* Default-Landscape@2x~ipad.png in Resources */,
+ AF0C688A1885D3E7000E4147 /* Default-Landscape~ipad.png in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ AF0C68301885C946000E4147 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ AF0C68751885D1F2000E4147 /* WAppDelegate.m in Sources */,
+ AF0C68801885D250000E4147 /* WToast.m in Sources */,
+ AF0C68741885D1F2000E4147 /* main.m in Sources */,
+ AF0C68761885D1F2000E4147 /* WTestViewController.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ AF0C685E1885C947000E4147 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ AF0C685F1885C947000E4147 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = YES;
+ ENABLE_NS_ASSERTIONS = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ AF0C68611885C947000E4147 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "WToastDemo/WToastDemo-Prefix.pch";
+ INFOPLIST_FILE = "$(SRCROOT)/WToastDemo/WToastDemo-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ PRODUCT_NAME = WToastDemo;
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ AF0C68621885C947000E4147 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "WToastDemo/WToastDemo-Prefix.pch";
+ INFOPLIST_FILE = "$(SRCROOT)/WToastDemo/WToastDemo-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ PRODUCT_NAME = WToastDemo;
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ AF0C682F1885C946000E4147 /* Build configuration list for PBXProject "WToastDemo" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ AF0C685E1885C947000E4147 /* Debug */,
+ AF0C685F1885C947000E4147 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ AF0C68601885C947000E4147 /* Build configuration list for PBXNativeTarget "WToastDemo" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ AF0C68611885C947000E4147 /* Debug */,
+ AF0C68621885C947000E4147 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = AF0C682C1885C946000E4147 /* Project object */;
+}
View
2  ...proj/project.xcworkspace/contents.xcworkspacedata → ...proj/project.xcworkspace/contents.xcworkspacedata
@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
- location = "self:WToast.xcodeproj">
+ location = "self:WToastDemo.xcodeproj">
</FileRef>
</Workspace>
View
13 WToastDemo/WAppDelegate.h
@@ -0,0 +1,13 @@
+//
+// WAppDelegate.h
+// WToast
+//
+// Created by Nik S Dyonin on 14.01.14.
+// Copyright (c) 2014 Brite Apps. All rights reserved.
+//
+
+@interface WAppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+@end
View
44 WToastDemo/WAppDelegate.m
@@ -0,0 +1,44 @@
+//
+// WAppDelegate.m
+// WToast
+//
+// Created by Nik S Dyonin on 14.01.14.
+// Copyright (c) 2014 Brite Apps. All rights reserved.
+//
+
+#import "WAppDelegate.h"
+#import "WTestViewController.h"
+
+@implementation WAppDelegate
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ self.window.backgroundColor = [UIColor whiteColor];
+
+ UITabBarController *tabBarController = [[UITabBarController alloc] init];
+
+ WTestViewController *v = [[WTestViewController alloc] initWithNibName:@"WTestViewController" bundle:[NSBundle mainBundle]];
+ v.tabBarItem.title = @"Test tab";
+ tabBarController.viewControllers = @[v];
+ _window.rootViewController = tabBarController;
+ [_window makeKeyAndVisible];
+
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application {
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application {
+}
+
+@end
View
13 WToastDemo/WTestViewController.h
@@ -0,0 +1,13 @@
+//
+// WTestViewController.h
+// WToast
+//
+// Created by Nik S Dyonin on 14.01.14.
+// Copyright (c) 2014 Brite Apps. All rights reserved.
+//
+
+@interface WTestViewController : UIViewController <UITextFieldDelegate>
+
+@property (weak, nonatomic) IBOutlet UITextField *textField;
+
+@end
View
55 WToastDemo/WTestViewController.m
@@ -0,0 +1,55 @@
+//
+// WTestViewController.m
+// WToast
+//
+// Created by Nik S Dyonin on 14.01.14.
+// Copyright (c) 2014 Nik S Dyonin. All rights reserved.
+//
+
+#import "WTestViewController.h"
+#import "WToast.h"
+
+@implementation WTestViewController
+
+- (void)viewDidLoad {
+ _textField.delegate = self;
+}
+
+- (BOOL)textFieldShouldReturn:(UITextField *)textField {
+ [textField resignFirstResponder];
+ return NO;
+}
+
+- (IBAction)showShortMessage {
+ [_textField resignFirstResponder];
+
+ NSString *text = _textField.text;
+
+ if (!text || ![text length]) {
+ text = @"No text!";
+ }
+
+ [WToast showWithText:text];
+}
+
+- (IBAction)showLongMessage {
+ [_textField resignFirstResponder];
+
+ NSString *text = _textField.text;
+
+ if (!text || ![text length]) {
+ text = @"No text!";
+ }
+
+ [WToast showWithText:text duration:kWTLong];
+}
+
+- (IBAction)showShortImage {
+ [WToast showWithImage:[UIImage imageNamed:@"test.png"]];
+}
+
+- (IBAction)showLongImage {
+ [WToast showWithImage:[UIImage imageNamed:@"test.png"] duration:kWTLong];
+}
+
+@end
View
90 WToastDemo/WTestViewController.xib
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="WTestViewController">
+ <connections>
+ <outlet property="textField" destination="1TJ-U8-rEQ" id="eEk-UC-62z"/>
+ <outlet property="view" destination="1" id="3"/>
+ </connections>
+ </placeholder>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <view contentMode="scaleToFill" id="1">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Type message here" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="1TJ-U8-rEQ">
+ <rect key="frame" x="20" y="29" width="280" height="30"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="30" id="JvW-hX-WzF"/>
+ <constraint firstAttribute="width" constant="280" id="SRk-5n-mOu"/>
+ </constraints>
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <textInputTraits key="textInputTraits"/>
+ </textField>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="buh-A4-p1W">
+ <rect key="frame" x="88" y="80" width="144" height="30"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <state key="normal" title="Show short message">
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <connections>
+ <action selector="showShortMessage" destination="-1" eventType="touchUpInside" id="zbv-Gm-T37"/>
+ </connections>
+ </button>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4EX-Hf-O1r">
+ <rect key="frame" x="91" y="118" width="139" height="30"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <state key="normal" title="Show long message">
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <connections>
+ <action selector="showLongMessage" destination="-1" eventType="touchUpInside" id="nVB-Pl-RZV"/>
+ </connections>
+ </button>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Y6H-Gq-iaE">
+ <rect key="frame" x="98" y="156" width="124" height="30"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <state key="normal" title="Show short image">
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <connections>
+ <action selector="showShortImage" destination="-1" eventType="touchUpInside" id="McL-Mj-doJ"/>
+ </connections>
+ </button>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="slx-mn-Jzr">
+ <rect key="frame" x="101" y="194" width="119" height="30"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <state key="normal" title="Show long image">
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <connections>
+ <action selector="showLongImage" destination="-1" eventType="touchUpInside" id="RNH-ii-ogA"/>
+ </connections>
+ </button>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstAttribute="centerX" secondItem="slx-mn-Jzr" secondAttribute="centerX" id="2bd-zM-jvf"/>
+ <constraint firstItem="1TJ-U8-rEQ" firstAttribute="top" secondItem="1" secondAttribute="top" constant="29" id="2mY-yU-EK5"/>
+ <constraint firstAttribute="centerX" secondItem="1TJ-U8-rEQ" secondAttribute="centerX" id="5Ji-Kg-y5v"/>
+ <constraint firstItem="1TJ-U8-rEQ" firstAttribute="centerX" secondItem="buh-A4-p1W" secondAttribute="centerX" id="AyG-PB-XTK"/>
+ <constraint firstItem="1TJ-U8-rEQ" firstAttribute="centerX" secondItem="slx-mn-Jzr" secondAttribute="centerX" id="Bfm-g1-YSB"/>
+ <constraint firstAttribute="centerX" secondItem="4EX-Hf-O1r" secondAttribute="centerX" id="DW6-HH-3Ht"/>
+ <constraint firstItem="1TJ-U8-rEQ" firstAttribute="centerX" secondItem="Y6H-Gq-iaE" secondAttribute="centerX" id="EG5-dZ-YI0"/>
+ <constraint firstAttribute="centerX" secondItem="slx-mn-Jzr" secondAttribute="centerX" id="Hq5-kK-88S"/>
+ <constraint firstAttribute="centerX" secondItem="buh-A4-p1W" secondAttribute="centerX" id="LHt-Dl-Pk9"/>
+ <constraint firstItem="buh-A4-p1W" firstAttribute="top" secondItem="1TJ-U8-rEQ" secondAttribute="bottom" constant="21" id="LpW-a0-B0q"/>
+ <constraint firstItem="4EX-Hf-O1r" firstAttribute="top" secondItem="buh-A4-p1W" secondAttribute="bottom" constant="8" symbolic="YES" id="OtT-qS-E4M"/>
+ <constraint firstItem="slx-mn-Jzr" firstAttribute="top" secondItem="Y6H-Gq-iaE" secondAttribute="bottom" constant="8" symbolic="YES" id="P4u-5E-kQq"/>
+ <constraint firstItem="Y6H-Gq-iaE" firstAttribute="top" secondItem="4EX-Hf-O1r" secondAttribute="bottom" constant="8" symbolic="YES" id="igt-N2-N6o"/>
+ <constraint firstAttribute="centerX" secondItem="Y6H-Gq-iaE" secondAttribute="centerX" id="nzV-UJ-DJj"/>
+ </constraints>
+ <simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
+ <simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
+ </view>
+ </objects>
+</document>
View
68 WToastDemo/WToastDemo-Info.plist
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.briteapps.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UILaunchImages~ipad</key>
+ <array>
+ <dict>
+ <key>UILaunchImageMinimumOSVersion</key>
+ <string>7.0</string>
+ <key>UILaunchImageName</key>
+ <string>Default-Landscape</string>
+ <key>UILaunchImageOrientation</key>
+ <string>Landscape</string>
+ <key>UILaunchImageSize</key>
+ <string>{768, 1024}</string>
+ </dict>
+ <dict>
+ <key>UILaunchImageMinimumOSVersion</key>
+ <string>7.0</string>
+ <key>UILaunchImageName</key>
+ <string>Default-Portrait</string>
+ <key>UILaunchImageOrientation</key>
+ <string>Portrait</string>
+ <key>UILaunchImageSize</key>
+ <string>{768, 1024}</string>
+ </dict>
+ </array>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
View
14 WToastDemo/WToastDemo-Prefix.pch
@@ -0,0 +1,14 @@
+//
+// Prefix header
+//
+// The contents of this file are implicitly included at the beginning of every source file.
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_7_0
+#warning "This project uses features only available in iOS SDK 7.0 and later."
+#endif
+
+@import Foundation;
+@import UIKit;
View
15 WToastDemo/main.m
@@ -0,0 +1,15 @@
+//
+// main.m
+// WToast
+//
+// Created by Nik S Dyonin on 14.01.14.
+// Copyright (c) 2014 Brite Apps. All rights reserved.
+//
+
+#import "WAppDelegate.h"
+
+int main(int argc, char * argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([WAppDelegate class]));
+ }
+}
View
4 WToast_Prefix.pch
@@ -1,4 +0,0 @@
-#ifdef __OBJC__
- #import <Foundation/Foundation.h>
- #import <UIKit/UIKit.h>
-#endif
View
8 main.m
@@ -1,8 +0,0 @@
-#import "WToastAppDelegate.h"
-
-int main(int argc, char *argv[]) {
- @autoreleasepool {
- int retVal = UIApplicationMain(argc, argv, nil, NSStringFromClass([WToastAppDelegate class]));
- return retVal;
- }
-}
Please sign in to comment.
Something went wrong with that request. Please try again.