我是一名新的iPad開發人員。將整數添加到NSMUtableArray
我實現UIPopover上按一下按鈕,並酥料餅含有整數值,
當我試圖填補我的陣列整數它爲我,SIGABRT
:指數3超出範圍我不能看我的日誌,應用程序崩潰。
這裏是我的代碼片段:
-(void)btnClick:(id)sender {
for (int i=3; i<=31; i++) {
[remindarray addObject:[NSNumber numberWithInteger:i]];
NSLog(@"no=%@",[remindarray objectAtIndex:i]);
}
UIViewController* popoverContent = [[UIViewController alloc]init];
UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(110, 0, 500, 4)];
popoverTable = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 250, 665) style:UITableViewStylePlain];
[popoverTable setDelegate:(id<UITableViewDelegate>)self];
[popoverTable setDataSource:(id<UITableViewDataSource>)self];
[self.view addSubview:popoverTable];
[popoverTable release];
[popoverView addSubview:popoverTable];
popoverContent.view = popoverView;
popoverContent.contentSizeForViewInPopover = CGSizeMake(250, 600);
self.popoverController = [[UIPopoverController alloc]
initWithContentViewController:popoverContent];
[self.popoverController presentPopoverFromRect:CGRectMake(100,0, 535, 35)
inView:self.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
[popoverView release];
[popoverContent release];
}
最後remind array
我傳遞到cellForRowAtIndexPath
代碼:
...
cell.textLabel.text=[remindarray objectAtIndex:indexPath.row];
...
我認爲拋出的異常是該行的NSLog(@ 「沒有=%@」,[remindarray objectAtIndex:ⅰ]); – janusbalatbat