我的應用程序提供了在設備上,而不是在simulator.I儀器採用低內存崩潰,我認爲,問題出在下面的部分內存泄漏導致應用程序崩潰
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage:[UIImage imageNamed:@"gembtnblu.png"] forState:UIControlStateNormal];<br>
button.frame = CGRectMake(0, 0, TOOLBAR_BUTTON_WIDTH , TOOLBAR_BUTTON_HEIGHT);<br>
[button setTitle:[NSString stringWithFormat:@"%c",choice] forState:UIControlStateNormal];<br>
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[button addTarget:self action:@selector(ChoiceButtonTouched:) forControlEvents:UIControlEventTouchUpInside];
[button setTag:choice];
UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:button];
//Add button to the array
[tempItems addObject:customBarItem];
if (isReviewing == TRUE) {
customBarItem.customView.userInteractionEnabled=FALSE;
}
//release buttons
[customBarItem release];
numberOfChoices++;
,但林不能當場problem.Please幫助guuys,我已經beeen停留在此,現在天
繼承人一些代碼
NSArray *items=[[NSArray alloc] initWithArray:(NSArray *)tempItems];
[tempItems release];
//add array of buttons to toolbar
[toolbar setItems:items animated:YES];
[self.view addSubview:toolbar];
靜態分析器說,這是一個潛在的'items'數組泄漏。但是如果我放入一個發佈聲明,應用程序崩潰
是的,我的ID釋放工具欄 – humblePilgrim 2011-03-09 14:11:35