AGSPopupsContainerViewController adding a new features

4563
4
Jump to solution
04-15-2016 04:21 AM
ozcandurak
New Contributor III

I m developing an application with ArcGIS SDK on iphone with Swift. Really appreciate you guys made almost everything easy for developers. I have 2 question if you can help with where i m really stuck at.

First question :

I m using your Offline Editing Feature Sample on github for swift.

I would like to add a button apart from (Done & Action) but couldn't achieve that yet with “AGSPopupsContainerViewController” class. With the new button i would like to show “Related Record”.

Or if there is a way to append the related record info under the same popup that would be better.

Second question :

When clicking on feature the callout popsup. I would like to display these . How can i call these within the callout.

mockup.png

Thank you so much in advance.

Regards

0 Kudos
1 Solution

Accepted Solutions
GagandeepSingh
Occasional Contributor II

If you look at the description for doneButton here: 10.2.5: AGSPopupsContainerViewController Class Reference​ it says

You can replace the button that appears on the left side of the Navigation Bar with a custom button through this property.

That means if you create your own UIBarButtonItem for related records and assign it to the doneButton property, that custom button will now show in place of the done button on the top left. And when you tap it, the action you defined for that buttonItem will be called.

But by doing this, you won't have any button to hide the popups container view controller. For that I suggested that you should have two buttons on the left; one for relatedRecords and the other for Done. And to achieve that you will have to create a UIView and add two UIButtons to it. Then you will have to create a UIBarButtonItem using the following initializer

- initWithCustomView:

and assign it to the doneButton property on AGSPopupsContainerViewController.

View solution in original post

0 Kudos
4 Replies
GagandeepSingh
Occasional Contributor II

I would like to add a button apart from (Done & Action) but couldn't achieve that yet with “AGSPopupsContainerViewController” class. With the new button i would like to show “Related Record”.

You can use the doneButton property on AGSPopupsContainerViewController to define your custom buttons. Just create a view with the required buttons, and use the initWithCustomView initializer on UIBarButtonItem to create a bar button item and assign it to the doneButton property. To compensate for the original done button you can have a custom button with custom action to dismiss the popups container view controller.

When clicking on feature the callout popsup. I would like to display these . How can i call these within the callout.

With "these" I am assuming you mean the action sheet in callout in the screenshot. I don't think you can have an action sheet inside a custom view and more over it won't look right. But you can definitely have your custom view with different buttons inside a callout. Take a look at this sample​.

I see the plus minus buttons in the screenshot, which I am assuming are there for zoom in and out. I think you don't really need them because its a touch device, you can simply pinch-out and pinch-in or tap with one finger and tap with two fingers to zoom in and out respectively.

Let me know if this helps.

0 Kudos
ozcandurak
New Contributor III

Hi Singh,

Thank you for responding,

I have used the done button, But not enough, because i needed to add more button and i couldnt find anymore wayaround.

but just wondering about the part you said

"To compensate for the original done button you can have a custom button with custom action to dismiss the popups container view controller."

How can i add a custom button over there ?

Thank you.

0 Kudos
GagandeepSingh
Occasional Contributor II

If you look at the description for doneButton here: 10.2.5: AGSPopupsContainerViewController Class Reference​ it says

You can replace the button that appears on the left side of the Navigation Bar with a custom button through this property.

That means if you create your own UIBarButtonItem for related records and assign it to the doneButton property, that custom button will now show in place of the done button on the top left. And when you tap it, the action you defined for that buttonItem will be called.

But by doing this, you won't have any button to hide the popups container view controller. For that I suggested that you should have two buttons on the left; one for relatedRecords and the other for Done. And to achieve that you will have to create a UIView and add two UIButtons to it. Then you will have to create a UIBarButtonItem using the following initializer

- initWithCustomView:

and assign it to the doneButton property on AGSPopupsContainerViewController.

0 Kudos
ozcandurak
New Contributor III

You are the best Singh, I have been trying this more than a week, Finally its done,

I also tried an almost same approach and didnt work, here is code :

  var rightAddBarButtonItem:UIBarButtonItem = UIBarButtonItem(title: "Add", style: UIBarButtonItemStyle.Plain, target: self, action: #selector(ViewController.addTapped))

        var rightSearchBarButtonItem:UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Search, target: self, action: #selector(ViewController.searchTapped))

        self.popupsVC.doneButton = self.navigationItem.setRightBarButtonItems([rightAddBarButtonItem,rightSearchBarButtonItem], animated: true)

But thank you for sorting this out, You saved my day !