Two different ways to write allowsEditing?


#1

So I really don’t have a solid foundation for iOS, sorry if this may looks super stupid…

When I’m trying to do the Bronze Challenge with allowsEditing, I notice when I write this code:

[imagePicker allowsEditing:YES]
I will be warned in red like

but when I write it like this:

imagePicker.allowsEditing = YES;

Everything is fine.
I thought above two are just two different ways to do the same thing…but clearly they are quite different.
I wonder what happens to the [imagePicker allowsEditing:YES]? Is this forbidden only because of grammar or something???


#2

[quote][imagePicker allowsEditing:YES]
I will be warned in red like


[/quote]
You wanted to write but missed the prefix:

[imagePicker setAllowsEditing:YES]

Which is equivalent to:

imagePicker.allowsEditing = YES;

Names of setter methods always start with the set prefix, by convention.