forked from organicmaps/organicmaps
[ios] Fixed bug with wrong text view height while editing.
This commit is contained in:
parent
cd19027e52
commit
49ab3116dc
2 changed files with 34 additions and 1 deletions
|
@ -58,6 +58,15 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
|
|||
self.state = BookmarkDescriptionStateViewHTML;
|
||||
else
|
||||
self.state = BookmarkDescriptionStateEditText;
|
||||
if (self.iPadOwnerNavigationController)
|
||||
return;
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(keyboardWillShown:)
|
||||
name:UIKeyboardWillShowNotification object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(keyboardWillBeHidden:)
|
||||
name:UIKeyboardWillHideNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
|
@ -177,6 +186,31 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
|
|||
self.state = BookmarkDescriptionStateEditHTML;
|
||||
}
|
||||
|
||||
#pragma mark - Notifications
|
||||
|
||||
- (void)keyboardWillShown:(NSNotification *)aNotification
|
||||
{
|
||||
NSDictionary * info = [aNotification userInfo];
|
||||
CGSize const kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
|
||||
CGFloat const externalHeight = self.navigationController.navigationBar.height + [UIApplication sharedApplication].statusBarFrame.size.height;
|
||||
self.textView.height -= (kbSize.height - externalHeight);
|
||||
}
|
||||
|
||||
- (void)keyboardWillBeHidden:(NSNotification *)aNotification
|
||||
{
|
||||
NSDictionary * info = [aNotification userInfo];
|
||||
CGSize const kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
|
||||
CGFloat const externalHeight = self.navigationController.navigationBar.height + [UIApplication sharedApplication].statusBarFrame.size.height;
|
||||
self.textView.height += (kbSize.height - externalHeight);
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
#pragma mark - UIWebViewDelegate
|
||||
|
||||
- (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType
|
||||
{
|
||||
if (inType == UIWebViewNavigationTypeLinkClicked)
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
<rect key="frame" x="10" y="5" width="300" height="494"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<inset key="contentInset" minX="0.0" minY="-6" maxX="0.0" maxY="0.0"/>
|
||||
<color key="textColor" red="0.12941176470588237" green="0.12941176470588237" blue="0.12941176470588237" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="17"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
||||
|
|
Loading…
Add table
Reference in a new issue