3
내 응용 프로그램을 실행하는 동안이 스레드가 나타납니다.인식 할 수없는 선택기 하위 뷰를 추가하는 동안 인스턴스로 전송
2012-07-10 15:44:39.668 DSSAmple[447:f803] -[cell superview]: unrecognized selector sent to instance 0x68b4080
2012-07-10 15:44:39.671 DSSAmple[447:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[cell superview]: unrecognized selector sent to instance 0x68b4080'
'셀'을 내 하위 클래스라고합니다. cell.hi에서
@interface cell : UIViewController
{
UIImage *MyImage;
int row;
int column;
CGRect frame;
}
@property(retain,nonatomic)UIImage *MyImage;
@property(assign,nonatomic)int row;
@property(assign,nonatomic)CGRect frame;
@property(assign,nonatomic)int column;
@end
이 그리고 내 호출 클래스에서 나는 그것의 구현에서 SIAViewcontroller.h
#import <UIKit/UIKit.h>
#import "cell.h"
@interface SIAViewController : UIViewController
-(void)PanelLoading;
@end
SIAViewController.m
-(void)PanelLoading
{
UIImage *myImage=[UIImage imageNamed:@"s.jpg"];
int x=20,y=50,r=1,c=1;
for (int i=1; i<=8; i++)
{
for (int j=1; j<=8; j++)
{
cell *tank=[[cell alloc]init];
tank.column=c;
tank.row=r;
tank.frame=CGRectMake(x, y, 35, 35);
tank.MyImage=myImage;
[self.view addSubview:tank];
x+=35;
r++;
}
r=1;
c++;
y+=35;
x=20;
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self PanelLoading];
// Do any additional setup after loading the view, typically from a nib.
}
무엇을드립니다 이럴 이유가 있니? 아무도 도와 줄 수 있니?
확인. 고맙습니다. 나는 그것을 이해한다. 그러나 아무것도 보이지 않는다. –
@Deepak 이것은 별개의 문제이다. 제 추측으로는 이것이 당신의'셀'이 슈퍼 뷰에서 스스로 그리지 않기 때문일 것입니다. '- (void) drawRect : (CGRect) rect'를 오버라이드 했습니까? 나는 당신의'셀'이 최적으로 디자인되었다고 확신하지 못한다 : 당신이'셀'뷰 대신에'UIImageView'를 사용할 수 있습니까? – dasblinkenlight