background image
C H A P T E R 3
Using Views
Animating Views
There are four view methods that perform special animation effects on views. They
are summarized here:
--performs any animation that can be specified in the
--slides a whole view or its contents up or down.
--slides part of a view up or down.
--crumples a view and tosses it into a trash can.
Note that these animation methods only move bits around on the screen. They do
not change the actual bounds of a view, or do anything to a view that would change
its contents. When you use any of these methods, you are responsible for supplying
another method that actually changes the view bounds or contents. Your method is
called just before the animation occurs.
Dragging a View
Dragging a view means allowing the user to move the view by tapping on it,
holding the pen down, and dragging it to a new location on the screen. To drag a
view, send the view a
Dragging and Dropping with Views
Dragging and dropping a view means allowing a user to drag an item and drop it
into another view.
To enable dragging and dropping capability, you must first create a frame that
contains slots that specify how the drop will behave. For example, you specify the
types of objects that can be dropped into a view, if any. Examples include
. See the dragInfo parameter to the
(page 2-46) in the Newton Programmer's Reference for a complete description
of the slots.
You must set up code to handle a drag and drop in one of two ways: either add
code to create a frame and code to call
's view method in each
source and destination view that accepts a drag and drop message, or you can
create a proto and use it as a template for each view.
Each view must also have the following methods. The system calls these methods
in the order listed.
-- is sent to the destination view. It is called
repeatedly while the pen is down.
is passed the
current location as the dragged item is moved from its source location to its
destination location. An array of object types is also returned. In this method,
you must return an array of object types that can be accepted by that location.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна