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;








1















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.










share|improve this question
























  • 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


















1















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.










share|improve this question
























  • 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














1












1








1








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.










share|improve this question
















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|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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













4 Answers
4






active

oldest

votes


















1














You need to bring it to top of the view



Self.mapview.bringSubview(button)





share|improve this answer






























    1














    Please check below image make sure your Views hierarchy as followed your button should be last in hierarchy



    enter image description here



    Here is my output



    enter image description here



    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.






    share|improve this answer
































      0














      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.



      debug navigator






      share|improve this answer






























        0














        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.






        share|improve this answer

























          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
          );



          );













          draft saved

          draft discarded


















          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









          1














          You need to bring it to top of the view



          Self.mapview.bringSubview(button)





          share|improve this answer



























            1














            You need to bring it to top of the view



            Self.mapview.bringSubview(button)





            share|improve this answer

























              1












              1








              1







              You need to bring it to top of the view



              Self.mapview.bringSubview(button)





              share|improve this answer













              You need to bring it to top of the view



              Self.mapview.bringSubview(button)






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 23 '18 at 2:36









              Anil KumarAnil Kumar

              1081 silver badge10 bronze badges




              1081 silver badge10 bronze badges























                  1














                  Please check below image make sure your Views hierarchy as followed your button should be last in hierarchy



                  enter image description here



                  Here is my output



                  enter image description here



                  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.






                  share|improve this answer





























                    1














                    Please check below image make sure your Views hierarchy as followed your button should be last in hierarchy



                    enter image description here



                    Here is my output



                    enter image description here



                    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.






                    share|improve this answer



























                      1












                      1








                      1







                      Please check below image make sure your Views hierarchy as followed your button should be last in hierarchy



                      enter image description here



                      Here is my output



                      enter image description here



                      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.






                      share|improve this answer















                      Please check below image make sure your Views hierarchy as followed your button should be last in hierarchy



                      enter image description here



                      Here is my output



                      enter image description here



                      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.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      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





















                          0














                          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.



                          debug navigator






                          share|improve this answer



























                            0














                            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.



                            debug navigator






                            share|improve this answer

























                              0












                              0








                              0







                              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.



                              debug navigator






                              share|improve this answer













                              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.



                              debug navigator







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Nov 23 '18 at 4:33









                              Alex BaileyAlex Bailey

                              5056 silver badges17 bronze badges




                              5056 silver badges17 bronze badges





















                                  0














                                  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.






                                  share|improve this answer



























                                    0














                                    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.






                                    share|improve this answer

























                                      0












                                      0








                                      0







                                      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.






                                      share|improve this answer













                                      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.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Mar 26 at 11:06









                                      JacobJacob

                                      2273 silver badges31 bronze badges




                                      2273 silver badges31 bronze badges



























                                          draft saved

                                          draft discarded
















































                                          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.




                                          draft saved


                                          draft discarded














                                          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





















































                                          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







                                          Popular posts from this blog

                                          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                                          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                                          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript