KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This question is not a "how do I" but rather a "why is this" concerning some Class properties in Objective-C. I understand that the two examples below are not allowed and result in an error ("expression not assignable"): self.myUIView.frame.origin.x = 50; self.myUIView.frame.origin = CGPointMake(50,50); and that the proper way to do this is to create a new CGRect, set the values desired and then assign it: CGRect rect = self.myUIView.frame; rect.origin = CGPointMake(50, 50); self.myUIView.frame = rect; I'd like to understand why this is. CGRect is a struct containing two structs. Does the restriction have to do with how structs are allocated, to prevent an assignment which might overflow that memory? Or is it more of a convention concerning public and private properties? I realize this seems like a minor/basic question but I think it is important to clear up muddy/bad understandings of these fundamental sort of things.
Tags (comma-separated)
Save Edits
Cancel