i am developing an iphone application in which i have 3 classes => main class , abc class, pqr class. On main view , i have imageview on which i am displaying image. when user touch at the center of image on main view , new view will be pushed (depending on condition mentioned below)
a) if user came from abc view then
new view will not be pushed
b) if user came from pqr view then i
have to push new view .
My problem is how can i detect from which view user came to main view.
I create 1 class in which i have following code in .h file
typedef enum {
abcViewSelected,
pqrViewSelected
} SelectedViewType;
@interface Enumeration : NSObject {
SelectedViewType selectedViewType;
}
@property(nonatomic) SelectedViewType selectedViewType;
In . m file i have
@synthesize selectedViewType;
When user select table cell from abcView & pqrView , i am pushing main view & setting view type in didSelectRowAtIndexPath as follows :-
enumObj.selectedViewType = abcViewSelected;
enumObj.selectedViewType = pqrViewSelected;
In main view’s touchBegan method i am compairing which view is selected by writing this
if(enum.selectedViewType == pqrViewSelected) => push new view
else do nothing.
But this is not compairing & in none of case new view is pushed. I have imported all the required header files everywhere.
Plz help me ….Thanks in advance.
The problem must be in this line:
Here you do not compare current type value, but rather assign pqrViewSelected to it (you have ‘=’ instead of ‘==’). Try changing that line to:
Note that having constant expression as first parameter in comparison makes it impossible to mistakingly use assignment (‘=’) instead of comparison (‘==’).