close
此範例要介紹的是當iOS使用螢幕截圖時,
瞬間所閃爍的白光特效,
首先在interface範圍中宣告一個property
@property (strong, nonatomic) IBOutlet UIView *flashView;
接著viewdidload中初始化閃屏畫面
/*initalize the flash frame*/
self.flashView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
[self.flashView setAlpha:0];
[self.view addSubview:self.flashView];
最後再加入以下method就能在你想要觸發的地方使用此特效
-(void)fleshDefaultEffect
{
[self.flashView setAlpha:1];
[UIView beginAnimations:@"flash screen" context:nil];
[UIView setAnimationDuration:0.6f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[self.flashView setAlpha:0.0f];
[UIView commitAnimations];
}
文章標籤
全站熱搜
留言列表