Revision [357]

This is an old revision of ViewTransition made by JohnMcIntosh on 2009-09-09 11:25:13.

 

A typical example is the Info button on the Fraction Calculator tape, you press the (i) and we rotate in
a custom UIWebView. This starts over in the subclass of SqueakProxy where pressing the (i) generates
a smalltalk message to trigger infoButtonWasPressed:

infoButtonWasPressed: aButton
	infoButtonPressed := true.


this lets us remember that the button was pressed but we can't do the UIKit work until the callback finishes
so we do that chore in postLockProcessing, where we look for the state change, reset and call the ui handler to do the
transition

postLockProcessing

	self infoButtonPressed ifTrue: 
		[self infoButtonPressed: false.
		ui doTransitionToInfoView].



doTransitionToInfoView
	| menuBar  infoViewDoneButton |
	
	ObjectiveCBridge performSelectorOnMainThread: 
		[self infoViewController ifNil: 
			[| infoViewDoneButtonString |
			self loadInfoNIBFile.
			menuBar := self infoViewController view viewWithTag: 5.
			infoViewDoneButton := menuBar topItem rightBarButtonItem.
			infoViewDoneButtonString := 'infoViewDoneButtonWasPressed:'.
			self squeakProxy addSigViaString: infoViewDoneButtonString aSignature: 'v@:@'.
			infoViewDoneButton setTarget: self squeakProxy squeakProxy.
			infoViewDoneButton setAction: (ObjectiveCBridge findSelectorCalled: infoViewDoneButtonString)].

		self sharedApplication delegate  
			rotateViewFrom: self keypadController view 
			toView: self infoViewController view 
			animationDuration: 0.75 
			animationTransition: 2
			curve: 3
			cached: true asObjc.
			self sharedApplication setStatusBarHidden: false asObjc animated: true asObjc].


Now there are a number of complex things going on here, obviously I could use lazy initialization method to initialize the infoViewController,
so when we first come in we have to create the controller.

loadInfoNIBFile
	| infoString |
	
	infoString := 'InfoView' asNSStringUTF8.
	infoViewController :=  (ObjectiveCBridge classObjectForName: #RotatingViewControllerWithUIWebDelegate)
			alloc 
			initWithNibName: infoString 
			bundle: (ObjectiveCBridge classObjectForName: 'NSBundle') mainBundle.
	infoString release.


To create the controller we just load the nib file "InfoView"

There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki