Wiki source for NotificationCenterKeyboard


Show raw source

WikiServer shows a button bar above the keyboard. How this happens is by catching the NSNotification for keyboard will show
%%(language-ref)
setupKeyboardObservers
| defaultCenter selectorString nameString |

selectorString := 'keyboardWillShow:'.
nameString := ObjectiveCBridge fetchObjectCObjectConstantCalled: 'UIKeyboardWillShowNotification'.
defaultCenter := (ObjectiveCBridge classObjectForName: #NSNotificationCenter) defaultCenter.
self squeakProxy addSigViaString: selectorString aSignature: 'v@:@'.
defaultCenter addObserver: squeakProxy squeakProxy
selector: (ObjectiveCBridge findSelectorCalled: selectorString)
name: nameString
object: 0.

selectorString := 'keyboardWillHide:'.
nameString := ObjectiveCBridge fetchObjectCObjectConstantCalled: 'UIKeyboardWillHideNotification'.
defaultCenter := (ObjectiveCBridge classObjectForName: #NSNotificationCenter) defaultCenter.
defaultCenter addObserver: self prPageViewController
selector: (ObjectiveCBridge findSelectorCalled: selectorString)
name: nameString
object: 0.
%%

In the proxy we have more work:
%%(language-ref)
keyboardWillShow: aNotfication
| keyboardKey keyboard keyboardSize |

self keyboardShows: true.
keyboardKey := ObjectiveCBridge fetchObjectCObjectConstantCalled: 'UIKeyboardBoundsUserInfoKey'.
keyboard := aNotfication userInfo objectForKey: keyboardKey.
keyboardSize := keyboard CGRectValue.
keyboardSize primitiveChangeClassTo: CGRect new.
keyboardHeight := keyboardSize height.

? Actually we don't implement keyboardWillHide: in Smalltalk we cheat and implement in on the prPageViewController Objective-C class
We also then in postLockProcessing call keyboardWillShowInPRPageEditView: keyboardHeightValue which does the magic of moving the
button bar into place.



%%
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki