What is the objective-c's ?, :?

Asked 1 years ago, Updated 1 years ago, 56 views

What does this code do? I don't know why I'm using ?and :p

label.frame = (inPseudoEditMode) ? kLabelIndentedRect : kLabelRect;

objective-c c syntax conditional-operator operator

2022-09-21 21:08

1 Answers

?: is the same function as the trinomial operator in C. Expressing it in the form of an if statement

if(inPseudoEditMode) {
 label.frame = kLabelIndentedRect;
} } else {
 label.frame = kLabelRect;
}

It's like that.


2022-09-21 21:08

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.