Professional Documents
Culture Documents
by Lucas Newman
- sudo ln -s /System/Library/Frameworks/
ApplicationServices.framework/Frameworks/
CoreGraphics.framework/Headers /usr/local/arm-apple-darwin/
include/CoreGraphics
- sudo ln -s /System/Library/Frameworks/
CoreServices.framework/Frameworks/CFNetwork.framework/
Headers /usr/local/arm-apple-darwin/include/CFNetwork
Installing the toolchain
Last one, I promise.
[[window contentView]
setBackgroundColor:GSColorCreateColorWithDeviceRGBA(1.0,
0.0, 0.0, 1.0)]; // red background
[window orderFront:nil];
[window makeKey:nil];
}
Drawing in a view
The coordinate system is flipped!
- (void)drawRect:(CGRect)rect;
{
CGContextRef context = UICurrentContext();
CGContextSetRGBFillColor(context, 0.0, 1.0, 0.0, 1.0);
CGContextFillRect(context, rect);
}
Animating a view
- (void)animateFrameToSmallerSize;
{
[UIView beginAnimations:nil];
[UIView setAnimationDuration:1.0];
[self setFrame:CGRectInset([self frame], 20.0, 20.0)];
[UIView endAnimations];
}
Handling input
Tap & swipe the night away
- (void)mouseDown:(GSEventRef)event;
{
CGRect tapRect = GSEventGetLocationInWindow(event);
CGPoint mousePoint = [self convertPoint:tapRect.origin
fromView:nil];
...
}
- (int)swipe:(UIViewSwipeDirection)swipeDirection
withEvent:(GSEventRef)event;
{
CGRect swipeRect = GSEventGetLocationInWindow(event);
...
}
#import <CFNetwork/CFNetServices.h>