Giovanni
Giovanni

Reputation: 838

Need help understanding this line of code?

Ive come across this line of code in an example, But I dont know what it does!

[(CTView*)self.view setAttString: attString];

CTView is a custom class of type UIView and this line of code is in the main view controller. I understand that the setAttString:attString is passing the string attString to a method in CTView, but im not sure what the first half of the line of code is!

Upvotes: 2

Views: 94

Answers (1)

Rob
Rob

Reputation: 437882

The (CTView*) reference is a "cast", a way of simply informing the compiler that you believe that self.view, which is technically defined as a UIView, is really a CTView, and therefore you want the compiler to permit the setAttString method without generating a warning.

Upvotes: 6

Related Questions