Implicit Conversion from Enumeration Type 'Enum Cgimagealphainfo' to Different Enumeration Type 'Cgbitmapinfo' (Aka) 'Enum Cgbitmapinfo')

Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGBitmapinfo' (aka) 'enum CGBitmapInfo')

From the docs:

The constants for specifying the alpha channel information are declared with the CGImageAlphaInfo type but can be passed to this parameter safely.

So you can just use a cast to suppress the warning:

CGBitmapInfo bitmapInfo = (CGBitmapInfo) kBitmapInfo;

Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGBitmapinfo' (aka) 'enum CGBitmapInfo') ios 7

Syntax for CGBitmapContextCreate

CGContextRef CGBitmapContextCreate (
void *data,
size_t width,
size_t height,
size_t bitsPerComponent,
size_t bytesPerRow,
CGColorSpaceRef colorspace,
CGBitmapInfo bitmapInfo
);

See the last argument which belong to CGBitmapInfo. But you're using kCGImageAlphaPremultipliedLast which belong to CGImageAlphaInfo. So just cast type to CGBitmapInfo

Implicit conversion from enumeration type 'enum UIControlEvents' to different enumeration type 'UIControlState' (aka 'enum UIControlState')

You should use UIControlState enumeration, for example:

[searchBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];

Option you can choose from:

enum {
UIControlStateNormal = 0,
UIControlStateHighlighted = 1 << 0,
UIControlStateDisabled = 1 << 1,
UIControlStateSelected = 1 << 2,
UIControlStateApplication = 0x00FF0000,
UIControlStateReserved = 0xFF000000
};

UIControlEvent you should use when you want to add events to the control, for example handle button press.

Implicit conversion from enumeration type 'enum UIDeviceOrientation' to different enum type 'UIInterfaceOrientation' 'enum UIInterfaceOrientation

It means that you have used the wrong enum type: You have used UIDeviceOrientation instead of UIInterfaceOrientation.
To fix this, simply replace UIDeviceOrientationPortrait with UIInterfaceOrientationPortrait.

Implicit conversion from enum type 'NSTextAlignment' aka 'enum NSTextAlignment' to diff. enumeration type 'UITextAlignment' aka 'enum UITextAlignment'

In iOS 6+ UILabel's textAlignment property is of type NSTextAlignment (prior to that it was of type UITextAlignment). If you're compiling for iOS 6 or greater, simply switch to use NSTextAlignmentToCTTextAlignment() instead.

Xcode warning - Implicit conversion from enumeration type

The error says it all. You aren't using the proper enumeration type.

You should be using UITableViewScrollPositionTop.

Reference: Table View Scroll Position

Xcode 5.0.1 on Mavericks: How do I get rid of this warning?

The problem is that you're making the compiler make an implicit conversion. The fix is to make the conversion explicit via a cast:

CGBitmapContextCreate(alphaData, width, height, 8, rowBytes, NULL, (CGBitmapInfo)kCGImageAlphaOnly);

Just because a function is implemented to allow values of multiple types for a given parameter (as noted in the documentation) doesn't mean that it can be defined such that the compiler won't complain about it. C doesn't let you define a param as taking multiple types, you have to pick one. In this case, CGBitmapContextCreate is defined as:

CGContextRef CGBitmapContextCreate (
void *data,
size_t width,
size_t height,
size_t bitsPerComponent,
size_t bytesPerRow,
CGColorSpaceRef colorspace,
CGBitmapInfo bitmapInfo
);

Note the CGBitmapInfo type at the bottom there. That means, even if CGImageAlphaInfo values are technically legal, they'll still need to be cast to make it through the type checker.



Related Topics



Leave a reply



Submit