Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
UIWindow: Difference between revisions - iPhone Development Wiki

UIWindow: Difference between revisions

From iPhone Development Wiki
(Created page with 'UIWindow is a specialized UIView that represents a root node in the view hierarchy. There may be multiple UIWindows. == Non-rectangular windows == {{Function signature …')
 
mNo edit summary
Line 4: Line 4:
{{Function signature
{{Function signature
|signature=-(BOOL)acceptsGlobalPoint:(CGPoint)point;
|signature=-(BOOL)acceptsGlobalPoint:(CGPoint)point;
|firmware=2.0 –
|firmware=2.0 – 3.1
}}
}}



Revision as of 20:11, 3 March 2010

UIWindow is a specialized UIView that represents a root node in the view hierarchy. There may be multiple UIWindows.

Non-rectangular windows

Signature -(BOOL)acceptsGlobalPoint:(CGPoint)point;
Available in 2.0 – 3.1

By default UIWindows are rectangular. While you may modify the interaction shape of a UIView by overriding -pointInside:withEvent:, this method will be ignored in UIWindow. Instead, there is an undocumented method -acceptsGlobalPoint: that does this job:

@interface MyWindow : UIWindow { ... }
-(BOOL)acceptsGlobalPoint:(CGPoint)pt;
@end

@implementation MyWindow
// Makes the window interacts like a circle.
-(BOOL)acceptsGlobalPoint:(CGPoint)pt {
  CGFloat dx = pt.x - 160, dy = pt.y - 240;
  return (dx*dx+dy*dy <= 100*100);
}
@end

The global point is always in portrait coordinate.

References