I’m developing an in iOS6 and using Xcode 4.5.2.
I’ve a UIViewController,let’s say its name is aViewController. In this UIViewController, i’ve a BOOL pointer declared as a property using this code. Actually, it’s not a piece of code i’ve implemented, so i don’t really know why BOOL pointer is used.
Now, when assigning a value to this BOOL pointer, i got this famous warning Incompatible integer to pointer conversion assigning to 'BOOL *' (aka 'signed char *') from 'signed char' which is totally understandable because in my case,BOOL points to a boolean variable.
To resolve this problem, i’ve tried this one.So my code was like this:
aViewController.aBoolPointer = YES;
Then, i’ve tried ,
aViewController.(*aBoolPointer) = YES;
As Objective-c is a super set of C, i remember that in C .* notation is equal to ->. And the above notation gives an error.Error description : Identifier expected .
If i change code to like this :
aViewController->aBoolPointer = YES ;
I got this error Instance variable aBoolPointer is protected.
Here is the weird issue, if i use this code
aViewController.aBoolPointer = NO ;
Then, i got no warning.
So my questions are :
1-Why i got no warning when i assign NO value to a BOOL pointer ?
2-How can i properly assign YES value to BOOL pointer ?
3-What is the difference between YES or NO by considering the steps i explained ?
Thank you,all.
Because
NOis the same as0, orNULL, so it’s like assigning aNULLto the pointer, as in:If the property is defined as:
Then:
I don’t understand the question.