Permalink
Browse files

Added duration customization. Added ARC support.

  • Loading branch information...
1 parent 67e32bb commit 8e454153a38d9a08af3c47de4c1ed9ba9435e574 @Narmo Narmo committed Jul 3, 2012
@@ -4,7 +4,7 @@
*/
#import "WToastAppDelegate.h"
-#import "WToastViewController.h"
+#import "WToastTestViewController.h"
@implementation WToastAppDelegate
@@ -14,10 +14,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
tabBarController = [[UITabBarController alloc] init];
- WToastViewController *v = [[WToastViewController alloc] init];
+ WToastTestViewController *v = [[WToastTestViewController alloc] initWithNibName:@"WToastTestViewController" bundle:nil];
v.tabBarItem.title = @"Test tab";
tabBarController.viewControllers = [NSArray arrayWithObject:v];
- [v release];
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
@@ -42,10 +41,5 @@ - (void)applicationWillTerminate:(UIApplication *)application {
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
}
-- (void)dealloc {
- [window release];
- [tabBarController release];
- [super dealloc];
-}
@end
@@ -0,0 +1,10 @@
+/**
+ * @class WToastTestViewController
+ * @author Nik S Dyonin <wolf.step@gmail.com>
+ */
+
+@interface WToastTestViewController : UIViewController <UITextFieldDelegate>
+
+@property (retain, nonatomic) IBOutlet UITextField *textField;
+
+@end
@@ -0,0 +1,57 @@
+/**
+ * @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
Oops, something went wrong.

0 comments on commit 8e45415

Please sign in to comment.