Superclass problem

Posts: 1
Joined: 2009.04
Post: #1
Hello there, I need access the my superclass but I can't, my problem:

UIImageView ClassA
UIImageView ClassB

In ClassA I declared the "a" attribute and I access that into ClassB on TouchBegan event, but I can't. How do I can access it ?
My "ClassA.h":#import <UIKit/UIKit.h>

@interface ClassA : UIImageView {

int last_pos;


@property(nonatomic, readwrite) int last_pos;


Quote this message in a reply
Posts: 3,591
Joined: 2003.06
Post: #2
I can't understand your question. Maybe someone else can, but it might be helpful if you try to write it again.

I'm guessing you might be looking for the @class directive. That is, instead of using #import in your header in ClassA to reference ClassB, use @class ClassB; instead. You'll still need to use #import "ClassB.h" in your ClassA.m file though.
Quote this message in a reply
Posts: 93
Joined: 2008.11
Post: #3

It's indeed hard to understand the question but I think your problem is "accessing the super class's _some_message_"...
[super _yourMessageHere_] doesn't work for you?
If not.. are you sure your ClassB is derived from ClassA?

You can also try to override the message like this in ClassB:
-(void) message {
[super message];

EDIT: Read the initial message over and over again and I guess now I'm kinda got it Rasp
So you should look for the @protected directive.. might help. Or declare "a" as property..


TapMania - iPhone StepMania // Human knowledge belongs to the world!
Quote this message in a reply
Post Reply