Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2108507
  • 博文数量: 413
  • 博客积分: 10926
  • 博客等级: 上将
  • 技术积分: 3862
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-09 18:14
文章分类

全部博文(413)

文章存档

2015年(5)

2014年(1)

2013年(5)

2012年(6)

2011年(138)

2010年(85)

2009年(42)

2008年(46)

2007年(26)

2006年(59)

分类: 嵌入式

2009-07-15 17:56:05

1, Transform
  Just write following codes to scale (also called zoom in/out, or transform) your view:
    float scaleX = xxx, scaleY = xxx;
    CGAffineTransform transform = CGAffineTransformMakeScale(scaleX, scaleY];
    yourView.transform = transform;
 After scaled, you can set scaleX, and scaleY to scale to original size.
2, Animation
 - (void) transformYourView()
 {
      float scaleX = xxx, scaleY = xxx;
      [UIView beginAnimations:nil context:nil];
      [UIView setAnimationDuration:0.15]; //The default value is 0.2
      [UIView setAnimationDelegate:self];
      [UIView setAnimationDidStopSelector:@selector(animationFinshed:finsihed:context:)];
      CGAffineTransform transform = CGAffineTransformMakeScale(scaleX, scaleY];
      yourView.transform = transform;
      [UIView commitAnimations];
  }

- (void) animationFinshed:(NSString *) animationID finished:(NSNumber *)finished context:(void *)context
{
    //To here, animation is finshed
}

3, Handle touch tap event;
You must customize UIView, and handle event.
//UICView.h
@interface UICView : UIView
@end


//UICView.m
@implementation UICView
//Handle touches began event
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    printf("members count=%i\r\n", touches.count);
    for (UITouch *touch in touches)
    {
        printf("tap count = %i\r\n", touch.tapCount); //for dragging event, touch.tapCount is 0
    }
   
    [self touchesBegin:touches withEvent:event]; //You must invoke this interface, otherwise, application may can't handle event correctly.
}

@end
阅读(1260) | 评论(0) | 转发(0) |
0

上一篇:[iPhone] Nib File

下一篇:补血的食物清单 (ZT)

给主人留下些什么吧!~~