0
我需要在NSMutableArray
內傳遞數據,但是當我傳遞它的數據時,它的工作原理是錯誤的。我需要有人可以解釋一下NSMutableArray
。我使用UICollectionView
將數據傳遞給UICollectionView
。如何傳遞一個NSMutableArray數據
這是通過數據的代碼:
Mainview.m:
@property (strong, nonatomic) NSMutableArray *bookArray;
和
cellForItemAtIndexPath:(NSIndexPath *)indexPath
{....
_databaseVersion = [[bookArray objectAtIndex:indexPath.item]bookVersion];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([segue.identifier isEqualToString:@"course1"]){
ShelfViewController *controller = (ShelfViewController *)segue.destinationViewController;
[controller setBookArray:bookArray]; //this one is work but not correct.
controller.checkType = @"1";
controller.statusMode = statusMode;
controller.databaseVersion = _databaseVersion; // this one not work for Array
controller.downloadFlag = @"0";
}
當我從主網頁的數據,我需要去像這個:
SeccondView.m:
datafromDatabase = [[_bookArray objectAtIndex:i]bookVersion];
,但我已經有
[[bookList objectAtIndex:indexPath.item]bookVersion]
和
numberOfItemsInSection: ...return [booklist count]
現在我將解釋我的目的;我想從mainview
的數據庫中獲取數據,並將數組數據傳遞給Seccondview
以檢查Web服務,但此代碼僅在文件被下載文件後才起作用。我可以這樣使用:
[bookArray objectAtIndex:0]bookVersion]
但只能在下載後才能工作我爲此失去了兩天時間。請指導我關於傳遞數據陣列或指導我的任何想法檢查數據庫和web服務在Seccondview.m