tags:

views:

83

answers:

1

Hi,

The following piece of code is giving me a compiler error: Invalid value in assignment, while changing the origin.

CGPoint switchOrigin = CGPointMake(currentOrigin.x, currentOrigin.y + kTweenMargin); UISwitch *choiceSwitch = [UISwitch alloc]; **choiceSwitch.frame.origin = switchOrigin;**

But when I change it to the following it works properly.

CGPoint switchOrigin = CGPointMake(currentOrigin.x, currentOrigin.y + kTweenMargin); UISwitch *choiceSwitch = [UISwitch alloc]; **CGRect switchFrame = choiceSwitch.frame; switchFrame.origin = switchOrigin;**

Can any one explain me the logic behind this.

Thanks and Regards, Pranathi

+1  A: 

You want to init your instances.

Nikolai Ruhe