segue

Properly accessing a segue's destination view controller to assign protocol delegates

两盒软妹~` 提交于 2019-12-01 04:35:36
I'm encountering some problems in integrating segue and protocols while implementing a selection list. In my selection list .h I have: #import <UIKit/UIKit.h> @protocol SelectionListViewControllerDelegate <NSObject> @required - (void)rowChosen:(NSInteger)row; @end @interface SelectColor : UITableViewController <NSFetchedResultsControllerDelegate> -(IBAction)saveSelectedColor; @property (nonatomic, strong) id <SelectionListViewControllerDelegate> delegate; @end In my selection list .m I have: @implementation SelectColori @synthesize delegate; //this method is called from a button on ui -

Swift: prepareForSegue with two different segues

血红的双手。 提交于 2019-12-01 03:53:21
I have 2 UIButtons on a view. Each of them are linked to 2 different views. They have to pass different data depending which button you just tapped. I know there is different way to segue but I want to use the prepareForSegue version for each (seems more clear for me to have the segue drawn on the storyboard and some code to explain what happened). I tried this... override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if (segue != "historySegue") { let controller = segue.destinationViewController as! ResultViewController controller.match = self.match } else { let

Unrecognized Selector Sent to Instance UIViewController

我与影子孤独终老i 提交于 2019-12-01 03:04:05
问题 I keep getting the error: NSInvalidArgumentException', reason: '-[UIViewController setPhotoCellName:]: unrecognized selector sent to instance when I enter my prepare for segue call. Currently I have TabBarController->NavigationController->TableViewController->TableViewController->ViewController with a UI image on it. The problem occurs when I try to segue from the second TableView controller to the ViewController. I have the segue setup from the Prototype Cell to the actual ViewController. It

segue does not work in simple segue test

拈花ヽ惹草 提交于 2019-12-01 03:00:26
I have a weird problem. I have created 2 viewcontrollers in my storyboard: testSegueViewcontroller and nextPageViewController . The testSegueViewcontroller contains a UIButton NextPage. I Ctrl-dragged from this button to nextPageViewController and created a Push segue. The problem is when i run this program and clicking on the NextButton in the testSegueViewcontroller it does not show the nextPageVieController :-( Any ideas of what I'm doing wrong? With this approach you should use modal segues. Push segue is a part of UINavigationController transitions If you want to use push segue then you

Where do you initialize property values in a View Controller?

半城伤御伤魂 提交于 2019-12-01 02:09:15
问题 I have a view controller with properties that determine its behaviour. These are set by its parent in prepareForSegue . The potential bug this induces in my program is that the parent in question is not guaranteed to set the properties, so I would like to have a default value. On researching, I now understand that properties in Objective C don't have default values. This left me with the following options: Set the default values for properties in the child view's viewDidLoad method. However,

Properly accessing a segue's destination view controller to assign protocol delegates

↘锁芯ラ 提交于 2019-12-01 01:29:16
问题 I'm encountering some problems in integrating segue and protocols while implementing a selection list. In my selection list .h I have: #import <UIKit/UIKit.h> @protocol SelectionListViewControllerDelegate <NSObject> @required - (void)rowChosen:(NSInteger)row; @end @interface SelectColor : UITableViewController <NSFetchedResultsControllerDelegate> -(IBAction)saveSelectedColor; @property (nonatomic, strong) id <SelectionListViewControllerDelegate> delegate; @end In my selection list .m I have:

Swift: How to use “didSelectItemAtIndexPath” in UITableViewController(contains UICollectionView)?

蓝咒 提交于 2019-12-01 00:38:50
I have a UITableViewController , inside the TableViewCell , it's a UICollectionView . I want to pass the data from the CollectionViewCell to a DetailViewController when user tapped the cell. I dragged a segue from the CollectionViewCell to the DetailViewController , and used the didSelectItemAtIndexPath inside the TableViewCell ( which contains CollectionView ), and it works. class TableViewCell: UITableViewCell, UICollectionViewDataSource, UICollectionViewDelegate { var posts1: [Posts] = [Posts]() var posts2: [Posts] = [Posts]() var categories: [Category] = [Category]() var selectedPost1:

ios App - crash on multiple segue at the same time (going to other segue while one is animating)

一个人想着一个人 提交于 2019-12-01 00:34:17
While animation of one segue(like perforrmsegue) is going, if other segue occures (if user press other button at that time) then application is crashing. The same problem for the pop and pushViewController on UINavigationController is solved here . Can we use same trik for segue also or there is other solution. I get the following stack after crash. (Exeption at [NSException initWithCoder:]). 0 CoreFoundation 0x2f9fbf4b __exceptionPreprocess 1 libobjc.A.dylib 0x39d8b6af objc_exception_throw 2 CoreFoundation 0x2f9fbe8d -[NSException initWithCoder:] 3 UIKit 0x3217a48f -[UIView(Internal)

when preparing for segue array contains no data (using swift)

↘锁芯ラ 提交于 2019-12-01 00:31:32
Depending on what button is pressed I want to append a list of words to variable (pickedList) declared at the start. When I come to prepare for segue it overwrites what has been added and only using empty array that was added at the start. I am able to append items within the prepare for segue bit and these transfer over but this is not what I want. I am very very new to programming and have searched about a lot but can't seem to find what I am looking for. Thanks in advance! Code looks like this: class activeLiteracyOptionsViewController: UIViewController { @IBOutlet weak var satpinButton:

Swift: prepareForSegue with two different segues

你。 提交于 2019-12-01 00:01:27
问题 I have 2 UIButtons on a view. Each of them are linked to 2 different views. They have to pass different data depending which button you just tapped. I know there is different way to segue but I want to use the prepareForSegue version for each (seems more clear for me to have the segue drawn on the storyboard and some code to explain what happened). I tried this... override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if (segue != "historySegue") { let controller =