不會說謊,我試圖按照一本書中的教程,我無法通過這個警告。不兼容的指針類型初始化'CGContextRef *'
Incompatible pointer types initializing 'CGContextRef *' (aka 'struct CGContext **') with an expression of type 'CGContextRef' (aka 'struct CGContext *')
有問題的行是:CGContextRef *imageContext = UIGraphicsGetCurrentContext();
- (IBAction)hide:(id)sender {
CGContextRef *imageContext = UIGraphicsGetCurrentContext();
if (_myIcon.alpha == 1) {
[UIView beginAnimations:nil context:imageContext];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration:3];
[UIView setAnimationDelegate:self];
_myIcon.alpha = 0.0;
[_hideButton setTitle:@"Show" forState:UIControlStateNormal];
} else if (_myIcon.alpha == 0.0) {
[UIView beginAnimations:nil context:imageContext];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:3];
[UIView setAnimationDelegate:self];
_myIcon.alpha = 1;
[_hideButton setTitle:@"Hide" forState:UIControlStateNormal];
}
[UIView commitAnimations];
}
順便說一句 - 你需要一本新書。不鼓勵使用'UIView beginAnimations:context:'和'UIView commitAnimations'。使用「UIView」的更新的基於塊的動畫方法要好得多。 – rmaddy
@rmaddy版權所有2013 ...這很糟糕。 – nipponese