0
我正在開發使用許多照片所以肯定它崩潰了,雖然我發佈了圖片的一些部分在下面的代碼所示我需要在iPhone內存管理幫助
-(void)addScrollView{
[self selectData];
scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(5, 0, 300, 160)];
int counter=10;
float y=10.0f;
int fullLength=[photoArray count];
int horizontal=(fullLength/2)*80;
int vertical=160;
int c1=1;
for(int c=0;c<[photoArray count];c++){
PhotoData *d=[photoArray objectAtIndex:c];
//NSLog(d.photoPath);
if(c==fullLength/2 &&c1<3){
counter=10;
y=y+80.0f;
c1++;
}
UIImage *img1=[[UIImage alloc]initWithContentsOfFile:d.photoPath];
UIButton* button = [[UIButton alloc] init];
[button setTitle:@"Delete" forState:UIControlStateNormal];
[button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
button.tag=d.photoId;
//set the button states you want the image to show up for
[button setBackgroundImage:img1 forState:UIControlStateNormal];
[button setFrame:CGRectMake(counter, y, 70.0, 70.0)];
//create the touch event target, i am calling the 'productImagePressed' method
[button addTarget:self action:@selector(deleteImage:)
forControlEvents:UIControlEventTouchUpInside];
[scrollView addSubview:button];
counter=counter+80.0f;
[img1 release];
[button release];
}
[scrollView setContentSize:CGSizeMake(horizontal, vertical)];
[self.view addSubview:scrollView];
[scrollView release];
}
的dealloc也沒有叫,因爲我的應用我正在使用基於Tab的應用程序。 那麼請大家幫忙解決這個內存管理問題。
它在哪裏崩潰?什麼樣的崩潰? –
數據格式化程序錯誤 – Mario
錯誤...似乎與您的代碼或內存管理問題無關。你能澄清/擴大嗎? – FeifanZ