ios - How do i fix the warning -


i have 2 classes in project: siaviewcontroller.h, , sub-class cell.h.

in cell.h have

@interface cell : uiviewcontroller @property(nonatomic)cgrect frame; @property(assign,nonatomic)uiimage *image; @property(nonatomic)int tag; @property(nonatomic)bool userinteractionenabled; @property(retain,nonatomic)uitapgesturerecognizer *addgesturerecognizer; @end 

and in siaviewcontroller.m:

int x=20,y=50,t=1; cell *tank[9][9]; for(int i=1;i<=8;i++) { for(int j=1;j<=8;j++) { tank[i][j]=[[cell alloc]init]; tank[i][j].frame=cgrectmake(x, y, 35, 35); uiimage *myimage=[uiimage imagenamed:@"s.jpg"]; [tank[i][j] setimage:myimage]; tank[i][j].tag=t; tank[i][j].userinteractionenabled=yes; uitapgesturerecognizer * recognizer = [[uitapgesturerecognizer alloc]initwithtarget:self action:@selector(tapdetected:)]; tank[i][j]. addgesturerecognizer=recognizer; [self.view addsubview:tank[i][j]]; x+=35; t++; } y+=35; x=20; } 

and while running project i'm receiving thread incompatible pointer types sending cell __strong parameter of type uiview. can me. i'm new xcode. thanks

the reason is, uiview superclass of table view cell. means if property expected uitableviewcell, pass in generic uiview instance, uiview may be, not necessarily, uitableviewcell. that's why compiler warns you. if know instance set uitableviewcell disguised uiview, can safely ignore warning, objective-c dynamic language; type declarations fooling compiler; type matching occurs during runtime.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -