Translate
2013年8月4日 星期日
2013年7月11日 星期四
讓UIView或UIScrollView的動畫暫停跟繼續動畫
-(void)pauseLayer:(CALayer*)layer {
CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil];
layer.speed = 0.0;
layer.timeOffset = pausedTime;
}
-(void)resumeLayer:(CALayer*)layer{
CFTimeInterval pausedTime = [layer timeOffset];
layer.speed = 1.0;
layer.timeOffset = 0.0;
layer.beginTime = 0.0;
CFTimeInterval timeSincePause = [layer convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime;
layer.beginTime = timeSincePause;
}
2013年7月8日 星期一
2013年7月1日 星期一
iPad willAnimateRotationToInterfaceOrientation
這幾天再寫個ipad專案
發現有時候willAnimateRotationToInterfaceOrientation沒有被呼叫到
所以上網查了一下資料
參考link
This is expected behavior as I see it. If the UIVC is not on the top of the stack, then willAnimateRotationToInterfaceOrientation shouldn't be called as no rotation is being animated at that time. The way I've been handling this in the app I am working on now is similar to the above poster. Any UIVC that supports all orientations gets a new method
- (void) updateLayoutForNewOrientation: (UIInterfaceOrientation) orientation;
This method is called from two places:
The new method is simple:
發現有時候willAnimateRotationToInterfaceOrientation沒有被呼叫到
所以上網查了一下資料
參考link
This is expected behavior as I see it. If the UIVC is not on the top of the stack, then willAnimateRotationToInterfaceOrientation shouldn't be called as no rotation is being animated at that time. The way I've been handling this in the app I am working on now is similar to the above poster. Any UIVC that supports all orientations gets a new method
- (void) updateLayoutForNewOrientation: (UIInterfaceOrientation) orientation;
This method is called from two places:
-(void) viewWillAppear: (BOOL) animated {
[super viewWillAppear: animated];
[self updateLayoutForNewOrientation: self.interfaceOrientation];
}
-(void) willAnimateRotationToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation duration: (NSTimeInterval) duration {
[self updateLayoutForNewOrientation: interfaceOrientation];
}
The new method is simple:
- (void) updateLayoutForNewOrientation: (UIInterfaceOrientation) orientation {
if (UIInterfaceOrientationIsLandscape(orientation)) {
// Do some stuff
} else {
// Do some other stuff
}
}
2013年6月13日 星期四
Xcode 4.6.2常莫名crash
国外有人有解决办法了:
since yesterday's OSX update, every other run on the simulator is crashing on start. It appears to work fine when compiling and running on hardware.
I thought it could be useful for your to warn other developers to hold off from performing the update if they want to work on the simulator."
I've experienced the same issue, but found that switching from LLDB to GDB (on the advice of Tony Arnold from Apple's Dev Forums) seems to fix the problem for the moment.
Update your scheme by selecting Product > Scheme > Edit Scheme, and choose the GDB debugger for your debug scheme.
简单的说,就是把Scheme里的LLDB换成GDB,就解决这个问题了!
since yesterday's OSX update, every other run on the simulator is crashing on start. It appears to work fine when compiling and running on hardware.
I thought it could be useful for your to warn other developers to hold off from performing the update if they want to work on the simulator."
I've experienced the same issue, but found that switching from LLDB to GDB (on the advice of Tony Arnold from Apple's Dev Forums) seems to fix the problem for the moment.
Update your scheme by selecting Product > Scheme > Edit Scheme, and choose the GDB debugger for your debug scheme.
简单的说,就是把Scheme里的LLDB换成GDB,就解决这个问题了!
2013年6月10日 星期一
2013年6月4日 星期二
Xcode files ARC setting
To see which files override the ARC setting:
Select your project in the navigator. This will open the project editor.
In the project editor, select your target.
In the project editor, click Build Phases (not Build Settings).
Expand the Compile Sources build phase.
Here, you can see the compiler flags for each file. Files with that set whether or not to use ARC will include either -fno-objc-arc or -fobjc-arc, for specifying MRR or ARC respectively.
Select your project in the navigator. This will open the project editor.
In the project editor, select your target.
In the project editor, click Build Phases (not Build Settings).
Expand the Compile Sources build phase.
Here, you can see the compiler flags for each file. Files with that set whether or not to use ARC will include either -fno-objc-arc or -fobjc-arc, for specifying MRR or ARC respectively.
訂閱:
文章 (Atom)