Reputation: 1047
This statement
drawTimebar *drawView = [drawTimebarView initWithFrame:drawTimebarView.frame];
was working just fine in iOS 4, but with the iOS 5 SDK gives a warning:
Incompatible pointer types initializing 'drawTimebar *' with an expression of type 'UIView *'
Why has this changed, and what can I do to solve it?
Upvotes: 0
Views: 451
Reputation: 48398
First, Class names should always begin with a capital latter and be CamelCased. This helps others read your code and helps you keep track of instances versus classes.
Second, you are declaring that drawView
is an instance of drawTimeBar
(presumably this is a class, so it really should be DrawTimeBar
) with this bit
drawTimebar *drawView
However, when you initialize the pointer, you are creating an instance of drawTimeBarView
(presumably also a class, and hence should be DrawTimeBarView
) with this bit
[drawTimebarView initWithFrame:drawTimebarView.frame];
The warning is letting you know that you are inconsistent. My guess is that you really mean to have
drawTimebarView *drawView = [drawTimebarView initWithFrame:drawTimebarView.frame];
Upvotes: 3
Reputation: 8772
One thing that stands out is that you are declare the variable as drawTimebar
but initializing and assigning a drawTimebarView
.
Upvotes: 3