How to bring UIButton to front of Mapbox viewPassing Data between View ControllersDisable UIButton highlighting in Storyboard and Swift 2How to show custom animated images as annotation marker in MapBox iOS SDK v2UIButton with no image doesn't highlight in Xcode 7 - iOS 9.2iOS Mapbox annotation not openingDisplay Image and Title Simultaneously on UIButton - Swift 3Mapbox iOS SDK create a curve MGLPolyline with MKGeodesicPolyline get some strangeHow do I add a simple image overlay in Mapbox Javascript?Adding search bar over MapBox layer iOS
Improving an O(N^2) function (all entities iterating over all other entities)
Extract the attribute names from a large number of Shapefiles
Why don't humans perceive sound waves as twice the frequency they are?
Why xargs uses -t to enable verbose mode?
How far off did Apollo 11 land?
Does the Bracer of Flying Daggers really let a thief make 4 attacks per round?
Can a creature sustain itself by eating its own severed body parts?
Why are there few or no black super GMs?
Parser for STL stereolithography data files
Should I have one hand on the throttle during engine ignition?
When a ball on a rope swings in a circle, is there both centripetal force and tension force?
How was Luke's prosthetic hand in Episode V filmed?
Is there a standard frequency for wandering monster checks in a dungeon?
Do higher dimensions have axes?
Applying for jobs with an obvious scar
Table Formatting Suggestion
Why did my "seldom" get corrected?
A "Replace" sort problem. Basic but haunts me
How to not confuse readers with simultaneous events?
Get Chord Name From a Given Set of Notes
Did Hitler say this quote about education?
Are there any satellites in geosynchronous but not geostationary orbits?
Do gauntlets count as armor?
Are there foods that astronauts are explicitly never allowed to eat?
How to bring UIButton to front of Mapbox view
Passing Data between View ControllersDisable UIButton highlighting in Storyboard and Swift 2How to show custom animated images as annotation marker in MapBox iOS SDK v2UIButton with no image doesn't highlight in Xcode 7 - iOS 9.2iOS Mapbox annotation not openingDisplay Image and Title Simultaneously on UIButton - Swift 3Mapbox iOS SDK create a curve MGLPolyline with MKGeodesicPolyline get some strangeHow do I add a simple image overlay in Mapbox Javascript?Adding search bar over MapBox layer iOS
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am using Mapbox SDK (SWIFT) and created my custom map. I added a button and image on the map in storyboard but when I run the application it seems like it is hidden behind. I tried everything including view.bringSubview(toFront:UIimage)
and I can't use this function with a UIButton. I even tried sending the map to the backView but it messes up my custom map and still don't see my image or button. Please help! Thank you.
ios swift mapbox mglmapview
add a comment |
I am using Mapbox SDK (SWIFT) and created my custom map. I added a button and image on the map in storyboard but when I run the application it seems like it is hidden behind. I tried everything including view.bringSubview(toFront:UIimage)
and I can't use this function with a UIButton. I even tried sending the map to the backView but it messes up my custom map and still don't see my image or button. Please help! Thank you.
ios swift mapbox mglmapview
Share your code, would be helpful in understanding and resolving your issue
– Satish
Nov 23 '18 at 5:29
@marcoder - When you added the button and image to the mapView, did you ensure that they are child views of the mapView? i.e. Are they indented to the right of the mapView in the outline view in InterfaceBuilder?
– Magnas
Nov 23 '18 at 11:22
add a comment |
I am using Mapbox SDK (SWIFT) and created my custom map. I added a button and image on the map in storyboard but when I run the application it seems like it is hidden behind. I tried everything including view.bringSubview(toFront:UIimage)
and I can't use this function with a UIButton. I even tried sending the map to the backView but it messes up my custom map and still don't see my image or button. Please help! Thank you.
ios swift mapbox mglmapview
I am using Mapbox SDK (SWIFT) and created my custom map. I added a button and image on the map in storyboard but when I run the application it seems like it is hidden behind. I tried everything including view.bringSubview(toFront:UIimage)
and I can't use this function with a UIButton. I even tried sending the map to the backView but it messes up my custom map and still don't see my image or button. Please help! Thank you.
ios swift mapbox mglmapview
ios swift mapbox mglmapview
edited Mar 26 at 11:40
Arnab Hore
2,2931 gold badge17 silver badges32 bronze badges
2,2931 gold badge17 silver badges32 bronze badges
asked Nov 23 '18 at 2:33
marcodermarcoder
61 bronze badge
61 bronze badge
Share your code, would be helpful in understanding and resolving your issue
– Satish
Nov 23 '18 at 5:29
@marcoder - When you added the button and image to the mapView, did you ensure that they are child views of the mapView? i.e. Are they indented to the right of the mapView in the outline view in InterfaceBuilder?
– Magnas
Nov 23 '18 at 11:22
add a comment |
Share your code, would be helpful in understanding and resolving your issue
– Satish
Nov 23 '18 at 5:29
@marcoder - When you added the button and image to the mapView, did you ensure that they are child views of the mapView? i.e. Are they indented to the right of the mapView in the outline view in InterfaceBuilder?
– Magnas
Nov 23 '18 at 11:22
Share your code, would be helpful in understanding and resolving your issue
– Satish
Nov 23 '18 at 5:29
Share your code, would be helpful in understanding and resolving your issue
– Satish
Nov 23 '18 at 5:29
@marcoder - When you added the button and image to the mapView, did you ensure that they are child views of the mapView? i.e. Are they indented to the right of the mapView in the outline view in InterfaceBuilder?
– Magnas
Nov 23 '18 at 11:22
@marcoder - When you added the button and image to the mapView, did you ensure that they are child views of the mapView? i.e. Are they indented to the right of the mapView in the outline view in InterfaceBuilder?
– Magnas
Nov 23 '18 at 11:22
add a comment |
4 Answers
4
active
oldest
votes
You need to bring it to top of the view
Self.mapview.bringSubview(button)
add a comment |
Please check below image make sure your Views hierarchy as followed your button should be last in hierarchy
Here is my output
or if you have button inside view then you can set it to front as
Self.view.bringSubviewToFront(button)
or
button.superview?.bringSubviewToFront(button)
Make sure you button is not hidden in Storyboard and when your app is running then Capture user Interface and check layers of your Storyboard.
add a comment |
You can also control the visibility of subviews by using:
mapview.layer.zPosition = 1
button.layer.zPosition = 2
image.layer.zPosition = 2
You can click on the debug navigator -> View UI hierarchy to visually understand how to view is being layered.
add a comment |
I couldn't change my view hierarchy's for my mapview, so I took a different approach.
I had my mapview created in my viewDidLoad function with let mapView = MGLMapView(...)
, my mapview was then made visible with the code view.addSubview(mapView)
. I had to make my button visible similarly.
First I inserted an IBOutlet into my ViewController class
@IBOutlet weak var MyButton: UIButton!
Which referenced the button I placed over my mapView in storyboard.
I then added my button to the view by adding
view.addSubview(MyButton)
Right after adding my mapView.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440003%2fhow-to-bring-uibutton-to-front-of-mapbox-view%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to bring it to top of the view
Self.mapview.bringSubview(button)
add a comment |
You need to bring it to top of the view
Self.mapview.bringSubview(button)
add a comment |
You need to bring it to top of the view
Self.mapview.bringSubview(button)
You need to bring it to top of the view
Self.mapview.bringSubview(button)
answered Nov 23 '18 at 2:36
Anil KumarAnil Kumar
1081 silver badge10 bronze badges
1081 silver badge10 bronze badges
add a comment |
add a comment |
Please check below image make sure your Views hierarchy as followed your button should be last in hierarchy
Here is my output
or if you have button inside view then you can set it to front as
Self.view.bringSubviewToFront(button)
or
button.superview?.bringSubviewToFront(button)
Make sure you button is not hidden in Storyboard and when your app is running then Capture user Interface and check layers of your Storyboard.
add a comment |
Please check below image make sure your Views hierarchy as followed your button should be last in hierarchy
Here is my output
or if you have button inside view then you can set it to front as
Self.view.bringSubviewToFront(button)
or
button.superview?.bringSubviewToFront(button)
Make sure you button is not hidden in Storyboard and when your app is running then Capture user Interface and check layers of your Storyboard.
add a comment |
Please check below image make sure your Views hierarchy as followed your button should be last in hierarchy
Here is my output
or if you have button inside view then you can set it to front as
Self.view.bringSubviewToFront(button)
or
button.superview?.bringSubviewToFront(button)
Make sure you button is not hidden in Storyboard and when your app is running then Capture user Interface and check layers of your Storyboard.
Please check below image make sure your Views hierarchy as followed your button should be last in hierarchy
Here is my output
or if you have button inside view then you can set it to front as
Self.view.bringSubviewToFront(button)
or
button.superview?.bringSubviewToFront(button)
Make sure you button is not hidden in Storyboard and when your app is running then Capture user Interface and check layers of your Storyboard.
edited Nov 24 '18 at 4:11
answered Nov 23 '18 at 12:00
KhushKhush
931 silver badge12 bronze badges
931 silver badge12 bronze badges
add a comment |
add a comment |
You can also control the visibility of subviews by using:
mapview.layer.zPosition = 1
button.layer.zPosition = 2
image.layer.zPosition = 2
You can click on the debug navigator -> View UI hierarchy to visually understand how to view is being layered.
add a comment |
You can also control the visibility of subviews by using:
mapview.layer.zPosition = 1
button.layer.zPosition = 2
image.layer.zPosition = 2
You can click on the debug navigator -> View UI hierarchy to visually understand how to view is being layered.
add a comment |
You can also control the visibility of subviews by using:
mapview.layer.zPosition = 1
button.layer.zPosition = 2
image.layer.zPosition = 2
You can click on the debug navigator -> View UI hierarchy to visually understand how to view is being layered.
You can also control the visibility of subviews by using:
mapview.layer.zPosition = 1
button.layer.zPosition = 2
image.layer.zPosition = 2
You can click on the debug navigator -> View UI hierarchy to visually understand how to view is being layered.
answered Nov 23 '18 at 4:33
Alex BaileyAlex Bailey
5056 silver badges17 bronze badges
5056 silver badges17 bronze badges
add a comment |
add a comment |
I couldn't change my view hierarchy's for my mapview, so I took a different approach.
I had my mapview created in my viewDidLoad function with let mapView = MGLMapView(...)
, my mapview was then made visible with the code view.addSubview(mapView)
. I had to make my button visible similarly.
First I inserted an IBOutlet into my ViewController class
@IBOutlet weak var MyButton: UIButton!
Which referenced the button I placed over my mapView in storyboard.
I then added my button to the view by adding
view.addSubview(MyButton)
Right after adding my mapView.
add a comment |
I couldn't change my view hierarchy's for my mapview, so I took a different approach.
I had my mapview created in my viewDidLoad function with let mapView = MGLMapView(...)
, my mapview was then made visible with the code view.addSubview(mapView)
. I had to make my button visible similarly.
First I inserted an IBOutlet into my ViewController class
@IBOutlet weak var MyButton: UIButton!
Which referenced the button I placed over my mapView in storyboard.
I then added my button to the view by adding
view.addSubview(MyButton)
Right after adding my mapView.
add a comment |
I couldn't change my view hierarchy's for my mapview, so I took a different approach.
I had my mapview created in my viewDidLoad function with let mapView = MGLMapView(...)
, my mapview was then made visible with the code view.addSubview(mapView)
. I had to make my button visible similarly.
First I inserted an IBOutlet into my ViewController class
@IBOutlet weak var MyButton: UIButton!
Which referenced the button I placed over my mapView in storyboard.
I then added my button to the view by adding
view.addSubview(MyButton)
Right after adding my mapView.
I couldn't change my view hierarchy's for my mapview, so I took a different approach.
I had my mapview created in my viewDidLoad function with let mapView = MGLMapView(...)
, my mapview was then made visible with the code view.addSubview(mapView)
. I had to make my button visible similarly.
First I inserted an IBOutlet into my ViewController class
@IBOutlet weak var MyButton: UIButton!
Which referenced the button I placed over my mapView in storyboard.
I then added my button to the view by adding
view.addSubview(MyButton)
Right after adding my mapView.
answered Mar 26 at 11:06
JacobJacob
2273 silver badges31 bronze badges
2273 silver badges31 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440003%2fhow-to-bring-uibutton-to-front-of-mapbox-view%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Share your code, would be helpful in understanding and resolving your issue
– Satish
Nov 23 '18 at 5:29
@marcoder - When you added the button and image to the mapView, did you ensure that they are child views of the mapView? i.e. Are they indented to the right of the mapView in the outline view in InterfaceBuilder?
– Magnas
Nov 23 '18 at 11:22