12 Oct '12, 1pm

Designing for iOS: Taming UIButton

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { // Set property _tapped = YES; // Force drawRect to be called (NEVER, EVER call drawRect directly) [self setNeedsDisplay]; // Superclass implementation [super touchesBegan:touches withEvent:event]; } -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { _tapped = NO; [self setNeedsDisplay]; [super touchesEnded:touches withEvent:event]; } // Distance from the button beyond which it should no longer be highlighted static CGFloat touchDistance = 70; -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { // Get the distance between the touch point and the button bounds CGPoint touchPoint = [[touches anyObject] locationInView:self]; // Define the touch area frame using the touch distance defined above CGRect touchArea = CGRectMake(0, - touchDistance, CGRectGetWidth(self.frame), CGRectGetHei...

Full article: http://robots.thoughtbot.com/post/33427366406/designing-f...

Tweets

Apple iOS 6 vs Android Jelly Bean: Which OS Bes...

sfluxe.com 12 Oct '12, 10pm

If you do not care much about mobile phone operating systems, you will not typically get to a detailed mobile OS compariso...