Creating a dynamic add button swift












0















How would I be able to create a button that works similarly to the add phone button in the contacts app? As shown below, to replicate it, I have a button on the right side that the type is Add Contact (appears as a plus in a circle) and on the right is a label. I then put them together in a stack view.



How does the contacts app have one large (bar) button that holds the image and the text? When tapping on the button (in the contacts app) it highlights the whole bar. This makes me believe that might have done this using a UITableView.



What's the best way to create a similar (bar) button as they did? Would this be easier to replicate if I used a UITableView instead?



enter image description hereenter image description here










share|improve this question





























    0















    How would I be able to create a button that works similarly to the add phone button in the contacts app? As shown below, to replicate it, I have a button on the right side that the type is Add Contact (appears as a plus in a circle) and on the right is a label. I then put them together in a stack view.



    How does the contacts app have one large (bar) button that holds the image and the text? When tapping on the button (in the contacts app) it highlights the whole bar. This makes me believe that might have done this using a UITableView.



    What's the best way to create a similar (bar) button as they did? Would this be easier to replicate if I used a UITableView instead?



    enter image description hereenter image description here










    share|improve this question



























      0












      0








      0








      How would I be able to create a button that works similarly to the add phone button in the contacts app? As shown below, to replicate it, I have a button on the right side that the type is Add Contact (appears as a plus in a circle) and on the right is a label. I then put them together in a stack view.



      How does the contacts app have one large (bar) button that holds the image and the text? When tapping on the button (in the contacts app) it highlights the whole bar. This makes me believe that might have done this using a UITableView.



      What's the best way to create a similar (bar) button as they did? Would this be easier to replicate if I used a UITableView instead?



      enter image description hereenter image description here










      share|improve this question
















      How would I be able to create a button that works similarly to the add phone button in the contacts app? As shown below, to replicate it, I have a button on the right side that the type is Add Contact (appears as a plus in a circle) and on the right is a label. I then put them together in a stack view.



      How does the contacts app have one large (bar) button that holds the image and the text? When tapping on the button (in the contacts app) it highlights the whole bar. This makes me believe that might have done this using a UITableView.



      What's the best way to create a similar (bar) button as they did? Would this be easier to replicate if I used a UITableView instead?



      enter image description hereenter image description here







      swift uitableview user-interface






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 24 '18 at 18:53









      Damon

      5181318




      5181318










      asked Nov 24 '18 at 17:50









      Matt BartMatt Bart

      11412




      11412
























          2 Answers
          2






          active

          oldest

          votes


















          0














          It's definitely a tableView.



          They either constrained button's top to an empty tableView's bottom or they made this as an integral tableView and each time you didSelectRowAt it inserts a row at known position.



          Suppose they either use a DataSource delegate method for rows insertion or a custom-made function wrapped in tableView.beginUpdates() and tableView.endUpdates() (reloads the table with animation)






          share|improve this answer































            0














            you should not use stackview to wrap both button and right text.because you also need tap event.and stack view not giving tapping event.



            I think you should place your button and label inside UIView and than Assing UIControl as Class in Inspecter(not UIView).than Controll drag from Your View to Class File and select TouchUPinside event.disabel user interaction of both button and Label otherwise event will not Fired.



            Assign UIControll to UIView



            Create TouchUpinsde event of UIControl



            and than Add above UIControll and other Component to either tableView or Vertical StackView.






            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%2f53460879%2fcreating-a-dynamic-add-button-swift%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              It's definitely a tableView.



              They either constrained button's top to an empty tableView's bottom or they made this as an integral tableView and each time you didSelectRowAt it inserts a row at known position.



              Suppose they either use a DataSource delegate method for rows insertion or a custom-made function wrapped in tableView.beginUpdates() and tableView.endUpdates() (reloads the table with animation)






              share|improve this answer




























                0














                It's definitely a tableView.



                They either constrained button's top to an empty tableView's bottom or they made this as an integral tableView and each time you didSelectRowAt it inserts a row at known position.



                Suppose they either use a DataSource delegate method for rows insertion or a custom-made function wrapped in tableView.beginUpdates() and tableView.endUpdates() (reloads the table with animation)






                share|improve this answer


























                  0












                  0








                  0







                  It's definitely a tableView.



                  They either constrained button's top to an empty tableView's bottom or they made this as an integral tableView and each time you didSelectRowAt it inserts a row at known position.



                  Suppose they either use a DataSource delegate method for rows insertion or a custom-made function wrapped in tableView.beginUpdates() and tableView.endUpdates() (reloads the table with animation)






                  share|improve this answer













                  It's definitely a tableView.



                  They either constrained button's top to an empty tableView's bottom or they made this as an integral tableView and each time you didSelectRowAt it inserts a row at known position.



                  Suppose they either use a DataSource delegate method for rows insertion or a custom-made function wrapped in tableView.beginUpdates() and tableView.endUpdates() (reloads the table with animation)







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 24 '18 at 18:20









                  Mr JoxMr Jox

                  307




                  307

























                      0














                      you should not use stackview to wrap both button and right text.because you also need tap event.and stack view not giving tapping event.



                      I think you should place your button and label inside UIView and than Assing UIControl as Class in Inspecter(not UIView).than Controll drag from Your View to Class File and select TouchUPinside event.disabel user interaction of both button and Label otherwise event will not Fired.



                      Assign UIControll to UIView



                      Create TouchUpinsde event of UIControl



                      and than Add above UIControll and other Component to either tableView or Vertical StackView.






                      share|improve this answer




























                        0














                        you should not use stackview to wrap both button and right text.because you also need tap event.and stack view not giving tapping event.



                        I think you should place your button and label inside UIView and than Assing UIControl as Class in Inspecter(not UIView).than Controll drag from Your View to Class File and select TouchUPinside event.disabel user interaction of both button and Label otherwise event will not Fired.



                        Assign UIControll to UIView



                        Create TouchUpinsde event of UIControl



                        and than Add above UIControll and other Component to either tableView or Vertical StackView.






                        share|improve this answer


























                          0












                          0








                          0







                          you should not use stackview to wrap both button and right text.because you also need tap event.and stack view not giving tapping event.



                          I think you should place your button and label inside UIView and than Assing UIControl as Class in Inspecter(not UIView).than Controll drag from Your View to Class File and select TouchUPinside event.disabel user interaction of both button and Label otherwise event will not Fired.



                          Assign UIControll to UIView



                          Create TouchUpinsde event of UIControl



                          and than Add above UIControll and other Component to either tableView or Vertical StackView.






                          share|improve this answer













                          you should not use stackview to wrap both button and right text.because you also need tap event.and stack view not giving tapping event.



                          I think you should place your button and label inside UIView and than Assing UIControl as Class in Inspecter(not UIView).than Controll drag from Your View to Class File and select TouchUPinside event.disabel user interaction of both button and Label otherwise event will not Fired.



                          Assign UIControll to UIView



                          Create TouchUpinsde event of UIControl



                          and than Add above UIControll and other Component to either tableView or Vertical StackView.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 24 '18 at 19:06









                          Bhavesh.iosDevBhavesh.iosDev

                          592113




                          592113






























                              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%2f53460879%2fcreating-a-dynamic-add-button-swift%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

                              Costa Masnaga

                              Fotorealismo

                              Sidney Franklin