Skip to content
Browse files

Merge pull request #22 from wasigh/master

Return ScrollView to previous position after keyboard hides
  • Loading branch information...
2 parents 1fd096b + ffb6584 commit da5e1711b91b80a861e39e2d5e8a26bb2b21b9aa @michaeltyson committed
View
6 TPKeyboardAvoidingSample/FirstViewController.m
@@ -17,13 +17,15 @@ @implementation FirstViewController
@synthesize txtBogle;
@synthesize txtSplat;
-/*
+
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
+
+ [self.scrollView setContentSize:CGSizeMake(320, 520)];
}
-*/
+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
View
361 TPKeyboardAvoidingSample/en.lproj/FirstView.xib
@@ -1,33 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
- <int key="IBDocument.SystemTarget">1024</int>
- <string key="IBDocument.SystemVersion">10J869</string>
- <string key="IBDocument.InterfaceBuilderVersion">1305</string>
- <string key="IBDocument.AppKitVersion">1038.35</string>
- <string key="IBDocument.HIToolboxVersion">461.00</string>
+ <int key="IBDocument.SystemTarget">1552</int>
+ <string key="IBDocument.SystemVersion">12C60</string>
+ <string key="IBDocument.InterfaceBuilderVersion">3084</string>
+ <string key="IBDocument.AppKitVersion">1187.34</string>
+ <string key="IBDocument.HIToolboxVersion">625.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">300</string>
+ <string key="NS.object.0">2083</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>IBUITextField</string>
+ <string>IBProxyObject</string>
<string>IBUIButton</string>
- <string>IBUIView</string>
<string>IBUIScrollView</string>
- <string>IBProxyObject</string>
+ <string>IBUITextField</string>
+ <string>IBUIView</string>
</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>
- <reference key="dict.values" ref="0"/>
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -54,7 +51,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 30}, {280, 31}}</string>
<reference key="NSSuperview" ref="206876602"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="89122733"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -76,13 +72,21 @@
<int key="IBUIReturnKeyType">4</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
+ <object class="IBUIFontDescription" key="IBUIFontDescription" id="34819574">
+ <int key="type">1</int>
+ <double key="pointSize">12</double>
+ </object>
+ <object class="NSFont" key="IBUIFont" id="950728490">
+ <string key="NSName">Helvetica</string>
+ <double key="NSSize">12</double>
+ <int key="NSfFlags">16</int>
+ </object>
</object>
<object class="IBUITextField" id="325075817">
<reference key="NSNextResponder" ref="206876602"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 281}, {280, 31}}</string>
<reference key="NSSuperview" ref="206876602"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="283243135"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -102,23 +106,19 @@
<int key="IBUIReturnKeyType">9</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
+ <reference key="IBUIFontDescription" ref="34819574"/>
+ <reference key="IBUIFont" ref="950728490"/>
</object>
<object class="IBUIButton" id="283243135">
<reference key="NSNextResponder" ref="206876602"/>
<int key="NSvFlags">292</int>
- <string key="NSFrame">{{20, 354}, {280, 37}}</string>
+ <string key="NSFrame">{{20, 337}, {280, 37}}</string>
<reference key="NSSuperview" ref="206876602"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
+ <reference key="NSNextKeyView" ref="364961226"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
- <object class="NSFont" key="IBUIFont">
- <string key="NSName">Helvetica-Bold</string>
- <double key="NSSize">15</double>
- <int key="NSfFlags">16</int>
- </object>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Do A Thing</string>
<object class="NSColor" key="IBUIHighlightedTitleColor">
@@ -133,13 +133,23 @@
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
+ <object class="IBUIFontDescription" key="IBUIFontDescription">
+ <string key="name">Helvetica-Bold</string>
+ <string key="family">Helvetica</string>
+ <int key="traits">2</int>
+ <double key="pointSize">15</double>
+ </object>
+ <object class="NSFont" key="IBUIFont">
+ <string key="NSName">Helvetica-Bold</string>
+ <double key="NSSize">15</double>
+ <int key="NSfFlags">16</int>
+ </object>
</object>
<object class="IBUITextField" id="89122733">
<reference key="NSNextResponder" ref="206876602"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 94}, {280, 31}}</string>
<reference key="NSSuperview" ref="206876602"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="141163670"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -159,14 +169,15 @@
<int key="IBUIReturnKeyType">4</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
+ <reference key="IBUIFontDescription" ref="34819574"/>
+ <reference key="IBUIFont" ref="950728490"/>
</object>
<object class="IBUITextField" id="141163670">
<reference key="NSNextResponder" ref="206876602"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 156}, {280, 31}}</string>
<reference key="NSSuperview" ref="206876602"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="1024068394"/>
+ <reference key="NSNextKeyView" ref="331828899"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -185,13 +196,14 @@
<int key="IBUIReturnKeyType">4</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
+ <reference key="IBUIFontDescription" ref="34819574"/>
+ <reference key="IBUIFont" ref="950728490"/>
</object>
<object class="IBUITextField" id="1024068394">
<reference key="NSNextResponder" ref="206876602"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 218}, {280, 31}}</string>
<reference key="NSSuperview" ref="206876602"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="325075817"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -211,11 +223,66 @@
<int key="IBUIReturnKeyType">4</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
+ <reference key="IBUIFontDescription" ref="34819574"/>
+ <reference key="IBUIFont" ref="950728490"/>
+ </object>
+ <object class="IBUITextField" id="364961226">
+ <reference key="NSNextResponder" ref="206876602"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 400}, {280, 31}}</string>
+ <reference key="NSSuperview" ref="206876602"/>
+ <reference key="NSNextKeyView"/>
+ <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">Offscreen</string>
+ <object class="NSColor" key="IBUITextColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ <reference key="NSCustomColorSpace" ref="48319102"/>
+ </object>
+ <bool key="IBUIAdjustsFontSizeToFit">YES</bool>
+ <float key="IBUIMinimumFontSize">17</float>
+ <object class="IBUITextInputTraits" key="IBUITextInputTraits">
+ <int key="IBUIReturnKeyType">4</int>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <reference key="IBUIFontDescription" ref="34819574"/>
+ <reference key="IBUIFont" ref="950728490"/>
+ </object>
+ <object class="IBUITextField" id="331828899">
+ <reference key="NSNextResponder" ref="206876602"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 500}, {280, 31}}</string>
+ <reference key="NSSuperview" ref="206876602"/>
+ <reference key="NSNextKeyView" ref="1024068394"/>
+ <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">more Offscreen</string>
+ <object class="NSColor" key="IBUITextColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ <reference key="NSCustomColorSpace" ref="48319102"/>
+ </object>
+ <bool key="IBUIAdjustsFontSizeToFit">YES</bool>
+ <float key="IBUIMinimumFontSize">17</float>
+ <object class="IBUITextInputTraits" key="IBUITextInputTraits">
+ <int key="IBUIReturnKeyType">4</int>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <reference key="IBUIFontDescription" ref="34819574"/>
+ <reference key="IBUIFont" ref="950728490"/>
</object>
</object>
<string key="NSFrameSize">{320, 411}</string>
<reference key="NSSuperview" ref="191373211"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="696973480"/>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
@@ -224,38 +291,10 @@
</object>
<string key="NSFrame">{{0, 20}, {320, 411}}</string>
<reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="206876602"/>
<object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">10</int>
- <object class="NSImage" key="NSImage">
- <int key="NSImageFlags">549453824</int>
- <string key="NSSize">{84, 1}</string>
- <object class="NSMutableArray" key="NSReps">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="0"/>
- <object class="NSBitmapImageRep">
- <object class="NSData" key="NSTIFFRepresentation">
- <bytes key="NS.bytes">TU0AKgAAAVjFzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
-y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
-xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
-xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
-xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
-xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P8ADQEAAAMAAAABAFQAAAEB
-AAMAAAABAAEAAAECAAMAAAAEAAAB+gEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES
-AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABAAEAAAEXAAQAAAABAAABUAEcAAMAAAABAAEAAAFS
-AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
- </object>
- </object>
- </object>
- </object>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MCAwAA</bytes>
- </object>
- </object>
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDAgMAA</bytes>
<string key="IBUIColorCocoaTouchKeyPath">groupTableViewBackgroundColor</string>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
@@ -276,46 +315,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="696973480"/>
- <reference key="destination" ref="372490531"/>
- </object>
- <int key="connectionID">13</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="325075817"/>
- <reference key="destination" ref="372490531"/>
- </object>
- <int key="connectionID">14</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="89122733"/>
- <reference key="destination" ref="372490531"/>
- </object>
- <int key="connectionID">16</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="141163670"/>
- <reference key="destination" ref="372490531"/>
- </object>
- <int key="connectionID">18</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="1024068394"/>
- <reference key="destination" ref="372490531"/>
- </object>
- <int key="connectionID">20</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">scrollView</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="206876602"/>
@@ -362,13 +361,63 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<int key="connectionID">26</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="696973480"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">13</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="325075817"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">14</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="89122733"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">16</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="141163670"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">18</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="1024068394"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">20</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="364961226"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">28</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"/>
+ <object class="NSArray" key="object" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
@@ -403,6 +452,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference ref="141163670"/>
<reference ref="1024068394"/>
<reference ref="325075817"/>
+ <reference ref="364961226"/>
+ <reference ref="331828899"/>
</object>
<reference key="parent" ref="191373211"/>
</object>
@@ -436,6 +487,16 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference key="object" ref="1024068394"/>
<reference key="parent" ref="206876602"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">27</int>
+ <reference key="object" ref="364961226"/>
+ <reference key="parent" ref="206876602"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">29</int>
+ <reference key="object" ref="331828899"/>
+ <reference key="parent" ref="206876602"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -443,8 +504,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
+ <string>-1.IBPluginDependency</string>
<string>-2.CustomClassName</string>
- <string>1.IBEditorWindowLastContentRect</string>
+ <string>-2.IBPluginDependency</string>
<string>1.IBPluginDependency</string>
<string>10.IBPluginDependency</string>
<string>11.IBPluginDependency</string>
@@ -452,14 +514,19 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>15.IBPluginDependency</string>
<string>17.IBPluginDependency</string>
<string>19.IBPluginDependency</string>
+ <string>27.IBPluginDependency</string>
+ <string>29.IBPluginDependency</string>
<string>8.CustomClassName</string>
<string>8.IBPluginDependency</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>FirstViewController</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>UIResponder</string>
- <string>{{774, 676}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -483,94 +550,14 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">26</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">FirstViewController</string>
- <string key="superclassName">UIViewController</string>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>scrollView</string>
- <string>txtBogle</string>
- <string>txtIggle</string>
- <string>txtNiggle</string>
- <string>txtOggle</string>
- <string>txtSplat</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>TPKeyboardAvoidingScrollView</string>
- <string>UITextField</string>
- <string>UITextField</string>
- <string>UITextField</string>
- <string>UITextField</string>
- <string>UITextField</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>scrollView</string>
- <string>txtBogle</string>
- <string>txtIggle</string>
- <string>txtNiggle</string>
- <string>txtOggle</string>
- <string>txtSplat</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">scrollView</string>
- <string key="candidateClassName">TPKeyboardAvoidingScrollView</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">txtBogle</string>
- <string key="candidateClassName">UITextField</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">txtIggle</string>
- <string key="candidateClassName">UITextField</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">txtNiggle</string>
- <string key="candidateClassName">UITextField</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">txtOggle</string>
- <string key="candidateClassName">UITextField</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">txtSplat</string>
- <string key="candidateClassName">UITextField</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/FirstViewController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">TPKeyboardAvoidingScrollView</string>
- <string key="superclassName">UIScrollView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/TPKeyboardAvoidingScrollView.h</string>
- </object>
- </object>
- </object>
+ <int key="maxID">29</int>
</object>
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
<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>
- <integer value="1024" key="NS.object.0"/>
+ <real value="1552" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
@@ -578,6 +565,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">300</string>
+ <string key="IBCocoaTouchPluginVersion">2083</string>
</data>
</archive>
View
1 TPKeyboardAvoidingScrollView.h
@@ -13,6 +13,7 @@
BOOL _keyboardVisible;
CGRect _keyboardRect;
CGSize _originalContentSize;
+ CGPoint _originalContentOffset;
}
- (void)adjustOffsetToIdealIfNeeded;
View
22 TPKeyboardAvoidingScrollView.m
@@ -39,14 +39,14 @@ -(void)awakeFromNib {
-(void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
-#if !__has_feature(objc_arc)
+#if !__has_feature(objc_arc)
[super dealloc];
#endif
}
-(void)setFrame:(CGRect)frame {
[super setFrame:frame];
-
+
CGSize contentSize = _originalContentSize;
contentSize.width = MAX(contentSize.width, self.frame.size.width);
contentSize.height = MAX(contentSize.height, self.frame.size.height);
@@ -72,7 +72,7 @@ -(void)setContentSize:(CGSize)contentSize {
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[[self findFirstResponderBeneathView:self] resignFirstResponder];
[super touchesEnded:touches withEvent:event];
-}
+}
- (void)keyboardWillShow:(NSNotification*)notification {
_keyboardRect = [[[notification userInfo] objectForKey:_UIKeyboardFrameEndUserInfoKey] CGRectValue];
@@ -84,6 +84,8 @@ - (void)keyboardWillShow:(NSNotification*)notification {
return;
}
+ _originalContentOffset = self.contentOffset;
+
if (!_priorInsetSaved) {
_priorInset = self.contentInset;
_priorInsetSaved = YES;
@@ -93,10 +95,10 @@ - (void)keyboardWillShow:(NSNotification*)notification {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]];
[UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]];
-
+
self.contentInset = [self contentInsetForKeyboard];
- [self setContentOffset:CGPointMake(self.contentOffset.x,
- [self idealOffsetForView:firstResponder withSpace:[self keyboardRect].origin.y - self.bounds.origin.y])
+ [self setContentOffset:CGPointMake(self.contentOffset.x,
+ [self idealOffsetForView:firstResponder withSpace:[self keyboardRect].origin.y - self.bounds.origin.y])
animated:YES];
[self setScrollIndicatorInsets:self.contentInset];
@@ -106,13 +108,13 @@ - (void)keyboardWillShow:(NSNotification*)notification {
- (void)keyboardWillHide:(NSNotification*)notification {
_keyboardRect = CGRectZero;
_keyboardVisible = NO;
-
+
// Restore dimensions to prior size
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]];
[UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]];
self.contentInset = _priorInset;
- self.contentOffset = CGPointZero;
+ self.contentOffset = _originalContentOffset;
[self setScrollIndicatorInsets:self.contentInset];
_priorInsetSaved = NO;
[UIView commitAnimations];
@@ -170,9 +172,9 @@ -(void)adjustOffsetToIdealIfNeeded {
CGFloat visibleSpace = self.bounds.size.height - self.contentInset.top - self.contentInset.bottom;
- CGPoint idealOffset = CGPointMake(0, [self idealOffsetForView:[self findFirstResponderBeneathView:self] withSpace:visibleSpace]);
+ CGPoint idealOffset = CGPointMake(0, [self idealOffsetForView:[self findFirstResponderBeneathView:self] withSpace:visibleSpace]);
- [self setContentOffset:idealOffset animated:YES];
+ [self setContentOffset:idealOffset animated:YES];
}
- (CGRect)keyboardRect {

0 comments on commit da5e171

Please sign in to comment.
Something went wrong with that request. Please try again.