How to navigate from a UICollectionView to another view by clicking the cell

Hey, guys, i'm working on a project on Xamarin.iOS, the problem is i can't navigate from a UICollectionView to another ViewController by clicking some specific cell, i try to after the cell is clicked open a AlertView with a button and when the user clicks that button open another view, but that doesn't work, here is my code:

public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath)
            var cell = (EnvioCell)collectionView.CellForItem(indexPath);

            UIAlertView alert = new UIAlertView()
                Title = "Options",
                Message = "Guide: " + localitems[indexPath.Row].guide + "\nStatus: " + localitems[indexPath.Row].status,
            alert.Clicked += ButtonClicked;

            public void ButtonClicked(object sender, UIButtonEventArgs e)
            information.PerformSegue("segCollectionInformation", this); 
                catch (Exception e) {throw e;}

I hope you can help me with this issue, i really need that funtionality!!


  • JuniorJiangJuniorJiang Member, Xamarin Team Xamurai

    Hi @Hector_Villarreal04 , from your code is using PrepareForSegue to navigation to other view, here is official document how to use:

    public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender)
        base.PrepareForSegue (segue, sender);
        var callHistoryController = segue.DestinationViewController as CallHistoryController;
        if (callHistoryController != null) {
             callHistoryController.PhoneNumbers = PhoneNumbers;

    And also can Navigation without segues as follow:

    CallHistoryButton.TouchUpInside += (object sender, EventArgs e) => {
        // Launches a new instance of CallHistoryController
        CallHistoryController callHistory = this.Storyboard.InstantiateViewController ("CallHistoryController") as CallHistoryController;
        if (callHistory != null) {
         callHistory.PhoneNumbers = PhoneNumbers;
         this.NavigationController.PushViewController (callHistory, true);
Sign In or Register to comment.