ios - when I click button in collection view, i I can't pass value to next view controller -
I had a question. I've set more buttons using the archive footage. I need a click button and the index value for "NextViewController" passes but when I click the button it is showing the error message below
I try to figure out where the error is. But I do not know.
Can someone give me some hint?
Thank you very much.
========== Error Message ===========
The cause of the application finished not come exception 'NSInvalidArgumentException', due to: -
'[UIViewController itemsArray:] unrecognized selector example sent to 0x9e78220' ======= ============================
=========== LIST View controller.m == ========
@ interface list view controller () {NSMutableArray * itemsArray; } Finally ... ... // webesrvice from itemsArray ... some data - (UICollectionViewCell *) collectionView: (UICollectionView *) collectionView cellForItemAtIndexPath: (NSIndexPath *) indexPath {CustomizedCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier: @ "CustomizedCell "Indexpath: indexpath]; NSInteger targetIndex = indexPath.row + indexpath.section * 3; If (targetIndex & LT; itemsArray.count) {[cell.cateBtn setTitle: [[itemsArray objectAtIndex: targetIndex] ITEMNAME] forState: UIControlStateNormal]; Cell.cateBtn.tag = targetIndex; [Cell.cateBtn addTarget: Self-action: @Selector (jumpToNextView) Control events: UICentralAventAliEvents]; Return cell; } - (zero) jumpToNextView: (UIButton *) sender {[self display CQ with identifier: @ "MySignName" sender: sender]; } - (zero) prepareForSegue: (UIStoryboardSegue *) segue this: (id) this {NextViewController * nextViewController = segue.destinationViewController; NextViewController. Items array = items; } - (BOOL) PforformSegueWithIdentifier: (NSString *) Identifier Sender: (ID) Sender {if (targetIndex & lt; itemsArray.count) YES Return; And do not come back; }
========== Next Viewer. H =========
< Code> @ interface Next control controller: UIViewController @property (strong, nonatomic) NSMutableArray * itemsArray; Check the class name forNextViewController
code> storyboard < / Code>. This should be the
next viewer . But as
I can see the crash log class name in UIViewController & amp; There is nothing like UIViewController itemsArray
thats the reason you are having a crash here.
Modify
[cell.cateBtn addTarget: self action: @ selector (jumpToNextView): Uaikantroliventailavents];
The
[cell.cateBtn addTarget: self action: @selector (jumpToDrScheduleList :) forControlEvents: UIControlEventTouchUpInside];
Selector for the button & amp; Event UIControlEventTouchUpInside;
Comments
Post a Comment