Skip to content

Commit

Permalink
Updated demo
Browse files Browse the repository at this point in the history
  • Loading branch information
hackiftekhar committed Aug 28, 2014
1 parent c1e185b commit 06980fe
Show file tree
Hide file tree
Showing 42 changed files with 217 additions and 211 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#import <UIKit/UITextInputTraits.h>

@class UITextField,UIView;
@class UITextField,UIView, UIViewController;

@interface IQKeyboardReturnKeyHandler : NSObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#import <Foundation/NSSet.h>

#import <UIKit/UIViewController.h>
#import <UIKit/UITextField.h>
#import <UIKit/UITextView.h>
#import <UIKit/UITableView.h>
Expand All @@ -46,7 +47,6 @@ @implementation IQKeyboardReturnKeyHandler
NSMutableSet *textFieldInfoCache;
}


-(id)initWithViewController:(UIViewController*)controller
{
self = [super init];
Expand Down Expand Up @@ -186,4 +186,16 @@ - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range r
return YES;
}

-(void)dealloc
{
for (NSDictionary *dict in textFieldInfoCache)
{
UITextField *textField = [dict objectForKey:kIQTextField];
textField.keyboardType = [[dict objectForKey:kIQTextFieldReturnKeyType] integerValue];
textField.delegate = [dict objectForKey:kIQTextFieldDelegate];
}

[textFieldInfoCache removeAllObjects];
}

@end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
#ifndef KeyboardManager_h
#define KeyboardManager_h

#import <KeyboardManager/IQBarButtonItem.h>
#import <KeyboardManager/IQKeyboardManager.h>
#import <KeyboardManager/IQKeyboardManagerConstants.h>
#import <KeyboardManager/IQSegmentedNextPrevious.h>
#import <KeyboardManager/IQTextView.h>
#import <KeyboardManager/IQTitleBarButtonItem.h>
#import <KeyboardManager/IQToolbar.h>
#import <KeyboardManager/IQUIView+Hierarchy.h>
#import <KeyboardManager/IQUIView+IQKeyboardToolbar.h>
#import <KeyboardManager/IQUIWindow+Hierarchy.h>
#import "IQBarButtonItem.h"
#import "IQKeyboardManager.h"
#import "IQKeyboardManagerConstants.h"
#import "IQKeyboardReturnKeyHandler.h"
#import "IQSegmentedNextPrevious.h"
#import "IQTextView.h"
#import "IQTitleBarButtonItem.h"
#import "IQToolbar.h"
#import "IQUIView+Hierarchy.h"
#import "IQUIView+IQKeyboardToolbar.h"
#import "IQUIWindow+Hierarchy.h"

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
#ifndef KeyboardManager_h
#define KeyboardManager_h

#import <KeyboardManager/IQBarButtonItem.h>
#import <KeyboardManager/IQKeyboardManager.h>
#import <KeyboardManager/IQKeyboardManagerConstants.h>
#import <KeyboardManager/IQSegmentedNextPrevious.h>
#import <KeyboardManager/IQTextView.h>
#import <KeyboardManager/IQTitleBarButtonItem.h>
#import <KeyboardManager/IQToolbar.h>
#import <KeyboardManager/IQUIView+Hierarchy.h>
#import <KeyboardManager/IQUIView+IQKeyboardToolbar.h>
#import <KeyboardManager/IQUIWindow+Hierarchy.h>
#import "IQBarButtonItem.h"
#import "IQKeyboardManager.h"
#import "IQKeyboardManagerConstants.h"
#import "IQKeyboardReturnKeyHandler.h"
#import "IQSegmentedNextPrevious.h"
#import "IQTextView.h"
#import "IQTitleBarButtonItem.h"
#import "IQToolbar.h"
#import "IQUIView+Hierarchy.h"
#import "IQUIView+IQKeyboardToolbar.h"
#import "IQUIWindow+Hierarchy.h"

#endif
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

263 changes: 131 additions & 132 deletions KeyboardTextFieldDemo/IQKeyboard.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,10 @@
</objects>
<point key="canvasLocation" x="1127" y="-2"/>
</scene>
<!--View Controller - Navigation Bar-->
<!--Navigation Bar View Controller - Navigation Bar-->
<scene sceneID="4DZ-Zn-3Xg">
<objects>
<viewController id="Trg-4t-Fsg" sceneMemberID="viewController">
<viewController id="Trg-4t-Fsg" customClass="NavigationBarViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="5sI-XJ-s2v" customClass="UIScrollView">
<rect key="frame" x="0.0" y="64" width="320" height="416"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
Expand Down Expand Up @@ -543,7 +543,7 @@
<textInputTraits key="textInputTraits" keyboardType="numberPad"/>
</textField>
<view contentMode="scaleToFill" id="SHK-82-xFg">
<rect key="frame" x="10" y="91" width="305" height="209.99999972377313"/>
<rect key="frame" x="10" y="91" width="305" height="209.99999971659423"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" id="k8L-Hj-hKb">
Expand All @@ -568,7 +568,7 @@
<color key="backgroundColor" red="1" green="0.50196081399917603" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</view>
<view contentMode="scaleToFill" id="uYv-to-iCC">
<rect key="frame" x="10" y="129" width="285" height="75.999999897593938"/>
<rect key="frame" x="10" y="129" width="285" height="75.999999894932486"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" tag="102" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="TextField 4" minimumFontSize="17" id="yDj-sx-3pn">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,28 @@
// IQKeyboard

#import "NavigationBarViewController.h"
#import "IQKeyboardReturnKeyHandler.h"

@interface NavigationBarViewController ()

@end

@implementation NavigationBarViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
IQKeyboardReturnKeyHandler *returnKeyHandler;
}

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
returnKeyHandler = [[IQKeyboardReturnKeyHandler alloc] initWithViewController:self];
[returnKeyHandler setLastTextFieldReturnKeyType:UIReturnKeyDone];
}

/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
-(void)dealloc
{
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
returnKeyHandler = nil;
}
*/

@end
12 changes: 12 additions & 0 deletions KeyboardTextFieldDemo/KeyboardTextFieldDemo/ScrollViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,32 @@
// KeyboardTextFieldDemo

#import "ScrollViewController.h"
#import "IQKeyboardReturnKeyHandler.h"

@implementation ScrollViewController
{
IQKeyboardReturnKeyHandler *returnKeyHandler;
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
[super viewDidLoad];

returnKeyHandler = [[IQKeyboardReturnKeyHandler alloc] initWithViewController:self];
[returnKeyHandler setLastTextFieldReturnKeyType:UIReturnKeyDone];

[scrollViewDemo setContentSize:CGSizeMake(0,321)];
[scrollViewInsideScrollView setContentSize:CGSizeMake(0,321)];
// [scrollViewOfTableViews setContentSize:CGSizeMake(0,scrollViewOfTableViews.bounds.size.height)];
}

-(void)dealloc
{
returnKeyHandler = nil;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@ @interface SpecialCaseViewController ()<UISearchBarDelegate>

@implementation SpecialCaseViewController
{
IQKeyboardReturnKeyHandler *handler;
IQKeyboardReturnKeyHandler *returnKeyHandler;
}

-(void)viewDidLoad
{
[super viewDidLoad];

handler = [[IQKeyboardReturnKeyHandler alloc] initWithViewController:self];
[handler setLastTextFieldReturnKeyType:UIReturnKeyDone];
returnKeyHandler = [[IQKeyboardReturnKeyHandler alloc] initWithViewController:self];
[returnKeyHandler setLastTextFieldReturnKeyType:UIReturnKeyDone];
}

-(void)dealloc
{
returnKeyHandler = nil;
}

- (IBAction)showAlertClicked:(UIButton *)sender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

@implementation TextFieldViewController
{
IQKeyboardReturnKeyHandler *handler;
IQKeyboardReturnKeyHandler *returnKeyHandler;
}

#pragma mark - View lifecycle
Expand All @@ -27,7 +27,8 @@ - (void)viewDidLoad
{
[super viewDidLoad];

handler = [[IQKeyboardReturnKeyHandler alloc] initWithViewController:self];
returnKeyHandler = [[IQKeyboardReturnKeyHandler alloc] initWithViewController:self];
[returnKeyHandler setLastTextFieldReturnKeyType:UIReturnKeyDone];

if (!self.navigationController)
{
Expand All @@ -37,6 +38,11 @@ - (void)viewDidLoad
}
}

-(void)dealloc
{
returnKeyHandler = nil;
}

-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

#import "TextViewSpecialCaseViewController.h"
#import "IQKeyboardManager.h"
#import "IQKeyboardReturnKeyHandler.h"

@implementation TextViewSpecialCaseViewController
{
IQKeyboardReturnKeyHandler *returnKeyHandler;
}

-(IBAction)canAdjustTextView:(UIBarButtonItem*)barButton
{
Expand All @@ -27,6 +31,9 @@ - (void)viewDidLoad
{
[super viewDidLoad];

returnKeyHandler = [[IQKeyboardReturnKeyHandler alloc] initWithViewController:self];
[returnKeyHandler setLastTextFieldReturnKeyType:UIReturnKeyDone];

if ([[IQKeyboardManager sharedManager] canAdjustTextView])
{
[barButtonAdjust setTitle:@"Disable Adjust"];
Expand All @@ -44,6 +51,11 @@ - (void)viewDidLoad
}
}

-(void)dealloc
{
returnKeyHandler = nil;
}

-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
Expand Down

0 comments on commit 06980fe

Please sign in to comment.