Log in

View Full Version : Basic Objective-C help needed



MrPinkPanther
28-02-2009, 06:06 PM
Why does this piece of code not work?


- (IBAction)buttonpressed: (id)sender
{
MovingText.x = 100;
}

I want the button (when clicked) to move the text to the x value of 50. Instead it comes up with the following error


Error: Request for member "x" in something not a structure or a union

Any ideas would be welcome, cheers :).

maiden2k7
04-03-2009, 01:33 PM
Does "x" need to be declared as a variable?
I can do C# but not C :/

HotelUser
05-03-2009, 09:02 PM
Does "x" need to be declared as a variable?
I can do C# but not C :/

I don't know C either, however I assume x is a variable within the instance of MovingText.


If this is so, did you initialize the instance? If not it may be looking for a non-existent namespace or class called MovingText.

Dentafrice
05-03-2009, 09:50 PM
Well it most programming languages, that take after the C syntax, or most in general.. after the period it is a property of Moving Text.

MovingText.x
MovingText.y

Just like in a label (C# example):

this.lblBlah.Text = "blah";

Text being the property of lblBlah, and so on.

I can't tell too much from this, could you post some more code.

Want to hide these adverts? Register an account for free!