enums - Enumeration in iphone is not working -


i developing iphone application in have 3 classes => main class , abc class, pqr class. on main view , have imageview on displaying image. when user touch @ center of image on main view , new view pushed (depending on condition mentioned below)

a) if user came abc view new view not pushed

b) if user came pqr view have push new view .

my problem how can detect view user came main view.

i create 1 class in have following code in .h file

typedef enum {         abcviewselected,         pqrviewselected } selectedviewtype;  @interface enumeration : nsobject {     selectedviewtype selectedviewtype; }  @property(nonatomic) selectedviewtype selectedviewtype; 

in . m file have

@synthesize selectedviewtype; 

when user select table cell abcview & pqrview , pushing main view & setting view type in didselectrowatindexpath follows :-

enumobj.selectedviewtype = abcviewselected;  enumobj.selectedviewtype = pqrviewselected; 

in main view's touchbegan method compairing view selected writing this

if(enum.selectedviewtype == pqrviewselected) => push new view  

else nothing.

but not compairing & in none of case new view pushed. have imported required header files everywhere.

plz me ....thanks in advance.

the problem must in line:

if(enum.selectedviewtype = pqrviewselected) 

here not compare current type value, rather assign pqrviewselected (you have '=' instead of '=='). try changing line to:

if(pqrviewselected == enum.selectedviewtype){     // push view } 

note having constant expression first parameter in comparison makes impossible mistakingly use assignment ('=') instead of comparison ('==').


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -