Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2007
    Posts
    2,807
    Tokens
    0

    Latest Awards:

    Default Basic Objective-C help needed

    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 .

  2. #2
    Join Date
    Dec 2006
    Posts
    627
    Tokens
    0

    Default

    Does "x" need to be declared as a variable?
    I can do C# but not C :/
    Find Meh - Coming Soon

  3. #3
    Join Date
    Jul 2004
    Location
    California
    Posts
    8,725
    Tokens
    3,789
    Habbo
    HotelUser

    Latest Awards:

    Default

    Quote Originally Posted by maiden2k7 View Post
    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.
    I'm not crazy, ask my toaster.

  4. #4
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •