【发布时间】:2014-06-20 11:26:55
【问题描述】:
我最近更新了我的 Xcode,并收到此警告。有人可以帮我解决它。隐式转换丢失整数精度:'NSUInteger'(又名'unsigned long')到'int'
- (UIImage *)reflectedImageRepresentationWithHeight:(NSUInteger)height {
CGContextRef mainViewContentContext;
CGColorSpaceRef colorSpace;
colorSpace = CGColorSpaceCreateDeviceRGB();
// create a bitmap graphics context the size of the image
mainViewContentContext = CGBitmapContextCreate (NULL, self.bounds.size.width,height, 8,0, colorSpace, kCGImageAlphaPremultipliedLast);
// create a 2 bit CGImage containing a gradient that will be used for masking the
// main view content to create the 'fade' of the reflection. The CGImageCreateWithMask
// function will stretch the bitmap image as required, so we can create a 1 pixel wide gradient
// WARING IS CAUSED BY LINE BELOW - height
CGImageRef gradientMaskImage = AEViewCreateGradientImage(1, height); // Implicit conversion loses integer precision: 'NSUInteger' (aka 'unsigned long') to 'int'
【问题讨论】:
-
之前添加 (int) 并没有解决问题。仍然收到相同的警告...
-
消息的含义是什么——将 NSUInteger 传递给期望 int 的方法(理论上)会失去精度。 AEViewCreateGradientImage 需要两个 int 值。
标签: ios objective-c xcode5