ios having alignment issues of an image in an content view inside a tableview









up vote
0
down vote

favorite












I have a custom cell inside an UITableView. Within that custom cell I am trying to put an image and to vertically align it horizontally. As soon as I do that I get that red line.

I have clicked the update frames button, there were no pop up of a menu to select any options.



Heres an image to get a better understanding.

What do I need to do to fix it?



image of my custom cell










share|improve this question



























    up vote
    0
    down vote

    favorite












    I have a custom cell inside an UITableView. Within that custom cell I am trying to put an image and to vertically align it horizontally. As soon as I do that I get that red line.

    I have clicked the update frames button, there were no pop up of a menu to select any options.



    Heres an image to get a better understanding.

    What do I need to do to fix it?



    image of my custom cell










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have a custom cell inside an UITableView. Within that custom cell I am trying to put an image and to vertically align it horizontally. As soon as I do that I get that red line.

      I have clicked the update frames button, there were no pop up of a menu to select any options.



      Heres an image to get a better understanding.

      What do I need to do to fix it?



      image of my custom cell










      share|improve this question















      I have a custom cell inside an UITableView. Within that custom cell I am trying to put an image and to vertically align it horizontally. As soon as I do that I get that red line.

      I have clicked the update frames button, there were no pop up of a menu to select any options.



      Heres an image to get a better understanding.

      What do I need to do to fix it?



      image of my custom cell







      ios uitableview






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 11 at 0:09

























      asked Nov 11 at 0:03









      tensteps

      33




      33






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          The constraints for your image view are not sufficient for Auto Layout to know where & how big the image view should be:

          Constraints for views need to specify the position (x, y) plus the size of the view (width, height).



          To fix your issue, add constraints for:



          1. leading

          2. trailing, or width

          3. top

          4. bottom, or height

          You could also press Add missing constraints in the menu that pops up when you press that |△| button, but I discourage you from doing so, because then it might add constraints you were not actually looking for.






          share|improve this answer




















          • Yes the add missing constraints fixes the problem and gives me what I was looking for. I would like to know how to do this manually. Is there a way to see the exact constraint that it placed? I see that it put in a leading constraint and an equal relation. Dunno what that is.
            – tensteps
            Nov 11 at 0:17










          • From the image it seems you have only added a center y constraint. You can see all constraints added to a view on the right side where it says Constraints in bold (and the graphic).
            – LinusGeffarth
            Nov 11 at 0:19










          • To manually add constraints, press on the little square button right next to the triangle one. Then select whichever constraints you want to add.
            – LinusGeffarth
            Nov 11 at 0:21










          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',
          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%2f53244633%2fios-having-alignment-issues-of-an-image-in-an-content-view-inside-a-tableview%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote



          accepted










          The constraints for your image view are not sufficient for Auto Layout to know where & how big the image view should be:

          Constraints for views need to specify the position (x, y) plus the size of the view (width, height).



          To fix your issue, add constraints for:



          1. leading

          2. trailing, or width

          3. top

          4. bottom, or height

          You could also press Add missing constraints in the menu that pops up when you press that |△| button, but I discourage you from doing so, because then it might add constraints you were not actually looking for.






          share|improve this answer




















          • Yes the add missing constraints fixes the problem and gives me what I was looking for. I would like to know how to do this manually. Is there a way to see the exact constraint that it placed? I see that it put in a leading constraint and an equal relation. Dunno what that is.
            – tensteps
            Nov 11 at 0:17










          • From the image it seems you have only added a center y constraint. You can see all constraints added to a view on the right side where it says Constraints in bold (and the graphic).
            – LinusGeffarth
            Nov 11 at 0:19










          • To manually add constraints, press on the little square button right next to the triangle one. Then select whichever constraints you want to add.
            – LinusGeffarth
            Nov 11 at 0:21














          up vote
          0
          down vote



          accepted










          The constraints for your image view are not sufficient for Auto Layout to know where & how big the image view should be:

          Constraints for views need to specify the position (x, y) plus the size of the view (width, height).



          To fix your issue, add constraints for:



          1. leading

          2. trailing, or width

          3. top

          4. bottom, or height

          You could also press Add missing constraints in the menu that pops up when you press that |△| button, but I discourage you from doing so, because then it might add constraints you were not actually looking for.






          share|improve this answer




















          • Yes the add missing constraints fixes the problem and gives me what I was looking for. I would like to know how to do this manually. Is there a way to see the exact constraint that it placed? I see that it put in a leading constraint and an equal relation. Dunno what that is.
            – tensteps
            Nov 11 at 0:17










          • From the image it seems you have only added a center y constraint. You can see all constraints added to a view on the right side where it says Constraints in bold (and the graphic).
            – LinusGeffarth
            Nov 11 at 0:19










          • To manually add constraints, press on the little square button right next to the triangle one. Then select whichever constraints you want to add.
            – LinusGeffarth
            Nov 11 at 0:21












          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          The constraints for your image view are not sufficient for Auto Layout to know where & how big the image view should be:

          Constraints for views need to specify the position (x, y) plus the size of the view (width, height).



          To fix your issue, add constraints for:



          1. leading

          2. trailing, or width

          3. top

          4. bottom, or height

          You could also press Add missing constraints in the menu that pops up when you press that |△| button, but I discourage you from doing so, because then it might add constraints you were not actually looking for.






          share|improve this answer












          The constraints for your image view are not sufficient for Auto Layout to know where & how big the image view should be:

          Constraints for views need to specify the position (x, y) plus the size of the view (width, height).



          To fix your issue, add constraints for:



          1. leading

          2. trailing, or width

          3. top

          4. bottom, or height

          You could also press Add missing constraints in the menu that pops up when you press that |△| button, but I discourage you from doing so, because then it might add constraints you were not actually looking for.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 11 at 0:09









          LinusGeffarth

          8,372145198




          8,372145198











          • Yes the add missing constraints fixes the problem and gives me what I was looking for. I would like to know how to do this manually. Is there a way to see the exact constraint that it placed? I see that it put in a leading constraint and an equal relation. Dunno what that is.
            – tensteps
            Nov 11 at 0:17










          • From the image it seems you have only added a center y constraint. You can see all constraints added to a view on the right side where it says Constraints in bold (and the graphic).
            – LinusGeffarth
            Nov 11 at 0:19










          • To manually add constraints, press on the little square button right next to the triangle one. Then select whichever constraints you want to add.
            – LinusGeffarth
            Nov 11 at 0:21
















          • Yes the add missing constraints fixes the problem and gives me what I was looking for. I would like to know how to do this manually. Is there a way to see the exact constraint that it placed? I see that it put in a leading constraint and an equal relation. Dunno what that is.
            – tensteps
            Nov 11 at 0:17










          • From the image it seems you have only added a center y constraint. You can see all constraints added to a view on the right side where it says Constraints in bold (and the graphic).
            – LinusGeffarth
            Nov 11 at 0:19










          • To manually add constraints, press on the little square button right next to the triangle one. Then select whichever constraints you want to add.
            – LinusGeffarth
            Nov 11 at 0:21















          Yes the add missing constraints fixes the problem and gives me what I was looking for. I would like to know how to do this manually. Is there a way to see the exact constraint that it placed? I see that it put in a leading constraint and an equal relation. Dunno what that is.
          – tensteps
          Nov 11 at 0:17




          Yes the add missing constraints fixes the problem and gives me what I was looking for. I would like to know how to do this manually. Is there a way to see the exact constraint that it placed? I see that it put in a leading constraint and an equal relation. Dunno what that is.
          – tensteps
          Nov 11 at 0:17












          From the image it seems you have only added a center y constraint. You can see all constraints added to a view on the right side where it says Constraints in bold (and the graphic).
          – LinusGeffarth
          Nov 11 at 0:19




          From the image it seems you have only added a center y constraint. You can see all constraints added to a view on the right side where it says Constraints in bold (and the graphic).
          – LinusGeffarth
          Nov 11 at 0:19












          To manually add constraints, press on the little square button right next to the triangle one. Then select whichever constraints you want to add.
          – LinusGeffarth
          Nov 11 at 0:21




          To manually add constraints, press on the little square button right next to the triangle one. Then select whichever constraints you want to add.
          – LinusGeffarth
          Nov 11 at 0:21

















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f53244633%2fios-having-alignment-issues-of-an-image-in-an-content-view-inside-a-tableview%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

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo