Multitouch is default disabled in the UIView for firmware 2.0 SDK. To enable it
Code:
[myView setMultipleTouchEnabled:YES];
this method is not in the Open Toolchain header but in the class-dump of SDK and also in the property directives of the SDK header file here
Code:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIView.h
The property directives offer some convenient ways of getter and setter methods for the Objective C 2.0, such as
Code:
gameView.multipleTouchEnabled=YES;
xarrow.hidden = !debuginfo;
label1.hidden = imgView.hidden = NO;
imgView.center = mainView.center;
It is better to add these property directives to the project file, and once added, the property directives are available to the UIView class and its subclasses e.g. UIImageView
Code:
#import<UIKit/UIView.h>
typedef int NSInteger;
typedef enum {
UIViewAnimationCurveEaseInOut, // slow at beginning and end
UIViewAnimationCurveEaseIn, // slow at beginning
UIViewAnimationCurveEaseOut, // slow at end
UIViewAnimationCurveLinear
} UIViewAnimationCurve;
typedef enum {
UIViewContentModeScaleToFill,
UIViewContentModeScaleAspectFit, // contents scaled to fit with fixed aspect. remainder is transparent
UIViewContentModeScaleAspectFill, // contents scaled to fill with fixed aspect. some portion of content may be clipped.
UIViewContentModeRedraw, // redraw on bounds change (calls -setNeedsDisplay)
UIViewContentModeCenter, // contents remain same size. positioned adjusted.
UIViewContentModeTop,
UIViewContentModeBottom,
UIViewContentModeLeft,
UIViewContentModeRight,
UIViewContentModeTopLeft,
UIViewContentModeTopRight,
UIViewContentModeBottomLeft,
UIViewContentModeBottomRight,
} UIViewContentMode;
typedef enum {
UIViewAnimationTransitionNone,
UIViewAnimationTransitionFlipFromLeft,
UIViewAnimationTransitionFlipFromRight
} UIViewAnimationTransition;
enum {
UIViewAutoresizingNone = 0,
UIViewAutoresizingFlexibleLeftMargin = 1 << 0,
UIViewAutoresizingFlexibleWidth = 1 << 1,
UIViewAutoresizingFlexibleRightMargin = 1 << 2,
UIViewAutoresizingFlexibleTopMargin = 1 << 3,
UIViewAutoresizingFlexibleHeight = 1 << 4,
UIViewAutoresizingFlexibleBottomMargin = 1 << 5
};
@interface UIView(UIResponder)
@property(getter=isUserInteractionEnabled) BOOL userInteractionEnabled; // default is YES. if set to NO, user events (touch, keys) are ignored and removed from the event queue.
@property NSInteger tag; // default is 0
//@property(readonly, retain) CALayer *layer; // returns view's layer. Will always return a non-nil value. view is layer's delegate
@end
@interface UIView(UIViewGeometry)
// animatable. do not use frame if view is transformed since it will not correctly reflect the actual location of the view. use bounds + center instead.
@property CGRect frame;
// use bounds/center and not frame if non-identity transform. if bounds dimension is odd, center may be have fractional part
@property CGRect bounds; // default bounds is zero origin, frame size. animatable
@property CGPoint center; // center is center of frame. animatable
@property CGAffineTransform transform; // default is CGAffineTransformIdentity. animatable
@property(getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled; // default is NO
@property(getter=isExclusiveTouch) BOOL exclusiveTouch; // default is NO
@property BOOL autoresizesSubviews; // default NO. if set, subviews are adjust if self bounds change
//@property UIViewAutoresizing autoresizingMask; // simple resize. default is UIViewAutoresizingNone
@end
@interface UIView(UIViewHierarchy)
@property(readonly) UIView *superview;
@property(readonly, copy) NSArray *subviews;
@property(readonly) UIWindow *window;
@end
@interface UIView(UIViewRendering)
@property BOOL clipsToBounds; // When YES, content and subviews are clipped to the bounds of the view. Default is NO.
@property(retain) UIColor *backgroundColor; // animatable. default is nil
@property CGFloat alpha; // animatable. default is 1.0
@property(getter=isOpaque) BOOL opaque; // if opaque, assumes that draw will fill (implies clearsContextBeforeDrawing). default is YES
@property BOOL clearsContextBeforeDrawing; // says we draw full contents even if not opaque. otherwise context is cleared causing extra work. default is YES
@property(getter=isHidden) BOOL hidden; // default is NO. doesn't check superviews
@property UIViewContentMode contentMode; // default is UIViewContentModeScaleToFill
@end For the multitouch app of firmware 2.0, I have ported a game called T4Two to firmware 2.0 beta
The original project is at (with source and binary for 1.1.x)
http://www.iamas.ac.jp/~aka/iphone/#T4Two.app
This game allows two players to control the rackets on the multitouch screen with sound.
I have added the following enhancements:
(a) double tap on the screen to toggle debug touch position information on the screen
(b) triple tap on the screen to toggle sound (default is changed to no sound)
The Accelerometer is turned off, as this has problem with the multitouch for the beta, but you can turn it on by #define ENABLE_ACCELEROMETER in the source code and build again.
The program will run on firmware 2.0 beta 3 and has been tested on iPhone firmware 2.0 beta 3 (pwned). The source code and makefile will build on SDK beta 3 with Open Toolchain header. I think SDK beta 5 will also work, but I did not try.
The compiled binary T4Two.app folder (for firmware OS 2.0 beta 3 build 5A240d) is at
http://www.iphone.org.hk/attach/29958-T4Two.zip
MD5 (29958-T4Two.zip) = aa5c2868289cf53af7395d0f5dbdfc04
To install, just scp to the /Applications folder, or wget directly and unzip in iPhone.
If you don't have wget in iPhone, get it from here, this wget binary works in firmware 2.0 beta 3
http://ericasadun.com/ftp/PortedUtilities/
Code:
wget http://www.iphone.org.hk/attach/29958-T4Two.zip
unzip -oj 29958-T4Two.zip build/2.0/T4Two.app/* -d /Applications/T4Two.app
The source code, resources and Makefile are at
http://www.iphone.org.hk/attach/29959-T4Two_src.zip
MD5 (29959-T4Two_src.zip) = bebf039854480b48ae6a8758f7e00ced
Bookmarks