俺是一个瓜娃!!!
xiaozhao-521 · 共 254 篇文章
时间运算之Dates
Creating Date Objects NSTimeInterval secondsPerDay = 24 * 60 * 60; NSDate *tomorrow = [NSDate dateWithTimeIntervalSinceNow:secondsPerDay]; NSDate *yesterday = [NSDate dateWithTimeIntervalSinceNow:-secondsPerDay]; To get new date objects with date-and-time values adjusted from existing date objects,…
2011-02-24 16:49 · objective-c · 评论(0) · C · C++ · Objective-C · C#
NSScanner类参考
NSString *string = @"Product: Acme Potato Peeler; Cost: 0.98 73\nProduct: Chef Pierre Pasta Fork; Cost: 0.75 19\nProduct: Chef Pierre Colander; Cost: 1.27 2\n"; NSCharacterSet *semicolonSet; NSScanner *theScanner; NSString *PRODUCT = @"Product:"; NSString *COST = @"Cost:"; NSString *productName; fl…
2011-02-24 16:35 · objective-c · 评论(0)
UISwipeGestureRecognizer ---手指动作
tap是指轻触手势。类似鼠标操作的点击。从iOS 3.2版本开始支持完善的手势api: tap:轻触 long press:在一点上长按 pinch:两个指头捏或者放的操作 pan:手指的拖动 swipe:手指在屏幕上很快的滑动 rotation:手指反向操作 这为开发者编写手势识别操作,提供了很大的方便,想想之前用android写手势滑动的代码( 编写android简单的手势切换视图示例 ),尤其感到幸福。 这里写一个简单的tap操作。在下面视图的蓝色视图内增加对tap的识别: 当用手指tap蓝色视图的时候,打印日志输出: 代码很简单,首先要声明tap的recognizer: UITapG…
2011-01-15 16:48 · objective-c · 评论(0) · Cache · iOS · 数据结构 · Android · SQLite
使用手指動態來切換UIView(採用UISwipeGestureRecognizer)
使用手指動態來切換UIView,意思就是說當手指頭接觸螢幕然後橫向或是縱向劃過螢幕後,就可以切換不同的畫面。 關於手指動態偵測的API,主要是UIGestureRecognizer,他衍生的subclass包含, UITapGestureRecognizer UIPinchGestureRecognizer UIRotationGestureRecognizer UISwipeGestureRecognizer UIPanGestureRecognizer UILongPressGestureRecognizer 以UISwipeGestureRecognizer為例,若要讓UIView具備…
2011-01-15 16:39 · objective-c · 评论(0)
Chaining Animations
- (void)right { -// photo1 is going to move to where photo2 is NSPoint newOrigin = [photo2 frame].origin; CABasicAnimation *animation = [self basicAnimationNamed:@"photo1" duration:1.0f]; animation.delegate = self; [photo1 setAnimations: [NSDictionary dictionaryWithObject:animation forKey:@"frameOr…
2010-12-10 14:32 · core animation · 评论(0)
Cocoa Animation Timing
You change the default animation timing by setting the current animation context’s duration like this: [NSAnimationContext beginGrouping]; [[NSAnimationContext currentContext] setDuration:2.0f]; // your code here [NSAnimationContext endGrouping]; 注意 The NSAnimationContext duration affects only the …
2010-12-10 14:27 · core animation · 评论(0) · Cocoa
Animation Timing
一:Animation Timing Curves 1:Linear Animation Timing 2:Ease-In Animation Timing 3:Ease-Out Animation Timing 4:Ease-In Ease-Out Animation Timing 5:Custom Animation Timing 自定义动画执行曲线设置 We create a custom timing with the initWithControlPoints :::: method on CAMediaTimingFunction like this: - (CAMediaTim…
2010-12-10 14:06 · core animation · 评论(0)
Animating Transitions
- (void)keyDown:(NSEvent *)event { if(nil != [self.beach superview]) { [[self animator] replaceSubview:self.beach with:self.snow]; } else if(nil != [self.snow superview]) { [[self animator] replaceSubview:self.snow with:self.beach]; } } - (CATransition *)animation { CATransition *trans = [CATransit…
2010-12-10 13:50 · core animation · 评论(0)
Animation Types----Grouping Animations
- (id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { CGFloat xInset = 3.0f * (NSWidth(frame) / 8.0f); CGFloat yInset = 3.0f * (NSHeight(frame) / 8.0f); NSRect moverFrame = NSInsetRect(frame, xInset, yInset); moverFrame.origin.x = NSMidX([self bounds]) -(NSWidth(moverF…
2010-12-10 13:40 · core animation · 评论(0)
Animation Types
3.1 Basic Animation CABasicAnimation 3.2 Keyframe Animations 我最近进行了一些关于关键桢动画方面的研究,感觉不错。关键桢动画其实是一个很酷的东西,因为它们会在你创建的层进行动作时给你提供更加精确的控制。基本动画在“开始”和“结束”点之间进行线性插值,在很多情况下,你都可以使用基本动画。但是有时候,如果你希望进行一些不一样或者更复杂的动画时,基本动画就不够用了。本文介绍的关键桢动画可以允许你在动画的过程中进行精确控制。 与基本动画进行线性插值不同,关键桢动画允许你在特定时间指定不同的数值,这样你可以在动画的全过程控制动画的展示和动作。…
2010-12-10 11:29 · core animation · 评论(0)
Introducing Cocoa Animation
Smooth Moves you first ask mover for its animator, and you then send setFrame: to that instead. - (void)move { if(isRight) { [[mover animator] setFrame:leftFramePosition]; } else { [[mover animator] setFrame:rightFramePosition]; } isRight = !isRight; } animator: The image now smoothly animates betw…
2010-12-10 11:08 · core animation · 评论(0) · Cocoa