views:

41

answers:

2

Good Morning to all,

i have a little question, in this following Code the self.viewDelegate is 0x0 and i don't know how to solve this problem. Should i have to go to the interface Builder??

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [[event allTouches] anyObject]; 
    if ([touch tapCount] == 2) {
        if ([self.viewDelegate respondsToSelector:@selector(openFlowView:doubleTapOnIndex:itemView:)])
            [self.viewDelegate openFlowView:self doubleTapOnIndex:selectedCoverView.number itemView:selectedCoverView];
        }
A: 

Yes, i had the same problem with another code construct a long time ago... i didn't find a solution.. and google didn't help me either.. at the end, i tried another way and expanded my code without so many nested if statements

Schnoesel15
+1  A: 

viewDelegate is not defined.
Usually, in Apple class, view delegate is just call delegate. You should have taken this code from somewhere. You have to defined viewDelegate in your code (not IB)

self.viewDelegate=xxxx;

xxxx must be your delegate. Delegate could be self !

See Apple doc for delegate explanation

Benoît
Yes but how can i define viewDelegate in my code, could you please help me o don't have a solution?
Marco
just self.viewDelegate=xxxx;
Benoît
i have found this line in the code @property (nonatomic, assign) id <AFOpenFlowViewDelegate> viewDelegate; yes but which what thing i have to define it?
Marco
please don't be angry but i don't know what you mean with self.viewDelegate = xxxxx; because i am very new in objective-C in which method i have to define this? and what do you mean with "delegate could be self"?
Marco
I don't want to be angry, but before using code you get on the net, you should understand it.
Benoît
Yes i understand a lot of objective-C i have a good book, but this problem is with an ready code from the internet (AFOpenFlow) and my App is going to be ready when i solved this problem, i work on this problem for 2 weeks now and i don't have a solution so i hope for help from you :) because i don't know in which method of this class i have to define self.viewDelegate and what i have to set on xxxxx?
Marco
replace xxxx by your delegate
Benoît
okay i will do that, when i know what is my delegate :D
Marco
The delegate must have the method openFlowView:doubleTapOnIndex:itemView:
Benoît
ahhhh okay so AFOpenFlowView.m is my delegate?
Marco
AFOpenFlowView.m is a file name. It should define AFOpenFlowView class. Then your delegate must be an instance of this class (that should be a view).
Benoît
The problem is the class is not from me, it is a class from the internet and i don't know what is the delegate there, you say delegate is like (AFOpenFlowView *) testView?
Marco