This question was originally asked for the objective-c programming language. At the time of writing, swift didn't even exist yet.
Question
Is it possible to change only one property of a CGRect
?
For example:
self.frame.size.width = 50;
instead of
self.frame = CGRectMake(self.frame.origin.x,
self.frame.origin.y,
self.frame.size.width,
50);
of course I understand that self.frame.size.width
is read only so I'm wondering how to do this?
CSS ANALOGY proceed at your own risk
for those of you who are familiar with CSS
, the idea is very similar to using:
margin-left: 2px;
instead of having to change the whole value:
margin: 5px 5px 5px 2px;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…