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 - iPhone Development Wiki

UIWindow

From iPhone Development Wiki
Revision as of 21:40, 5 November 2009 by KennyTM~ (talk | contribs) (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 …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 –

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