Add slanting shadow to view in swift





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I am new to ios development and I am trying to add a shadow on textview.



This is expected image with shadow:-



and This is what I am getting after applying shadow



I have applied shadow using following code-



func setUpText(){
//Add the label
stickerView.addLabel()

//add shadow to textview
stickerView.textShadowColor = stickerView.textColor
stickerView.textShadowOffset = CGSize(width:8, height:8)

//Modify the Label
stickerView.textColor = UIColor.white
stickerView.textAlpha = 1
stickerView.currentlyEditingLabel.closeView!.image = UIImage(named: "cross")
stickerView.currentlyEditingLabel.rotateView?.image = UIImage(named: "rotate")
stickerView.currentlyEditingLabel.border?.strokeColor = UIColor.white.cgColor
stickerView.currentlyEditingLabel.labelTextView?.font = UIFont.systemFont(ofSize: 20.0)
globalTextView = stickerView.currentlyEditingLabel.labelTextView!


addDoneButtonOnKeyboard(textView: stickerView.currentlyEditingLabel.labelTextView!)
stickerView.currentlyEditingLabel.labelTextView?.becomeFirstResponder()
// stickerView.addLabel()
fontFamilyArr = UIFont.familyNames

print("fontFamilyArr",fontFamilyArr)


}


I can't understand how can I achieve the requied result.Kindly help me to understand what should I search or how should I implement it.
Thanks in advance.










share|improve this question





























    0















    I am new to ios development and I am trying to add a shadow on textview.



    This is expected image with shadow:-



    and This is what I am getting after applying shadow



    I have applied shadow using following code-



    func setUpText(){
    //Add the label
    stickerView.addLabel()

    //add shadow to textview
    stickerView.textShadowColor = stickerView.textColor
    stickerView.textShadowOffset = CGSize(width:8, height:8)

    //Modify the Label
    stickerView.textColor = UIColor.white
    stickerView.textAlpha = 1
    stickerView.currentlyEditingLabel.closeView!.image = UIImage(named: "cross")
    stickerView.currentlyEditingLabel.rotateView?.image = UIImage(named: "rotate")
    stickerView.currentlyEditingLabel.border?.strokeColor = UIColor.white.cgColor
    stickerView.currentlyEditingLabel.labelTextView?.font = UIFont.systemFont(ofSize: 20.0)
    globalTextView = stickerView.currentlyEditingLabel.labelTextView!


    addDoneButtonOnKeyboard(textView: stickerView.currentlyEditingLabel.labelTextView!)
    stickerView.currentlyEditingLabel.labelTextView?.becomeFirstResponder()
    // stickerView.addLabel()
    fontFamilyArr = UIFont.familyNames

    print("fontFamilyArr",fontFamilyArr)


    }


    I can't understand how can I achieve the requied result.Kindly help me to understand what should I search or how should I implement it.
    Thanks in advance.










    share|improve this question

























      0












      0








      0








      I am new to ios development and I am trying to add a shadow on textview.



      This is expected image with shadow:-



      and This is what I am getting after applying shadow



      I have applied shadow using following code-



      func setUpText(){
      //Add the label
      stickerView.addLabel()

      //add shadow to textview
      stickerView.textShadowColor = stickerView.textColor
      stickerView.textShadowOffset = CGSize(width:8, height:8)

      //Modify the Label
      stickerView.textColor = UIColor.white
      stickerView.textAlpha = 1
      stickerView.currentlyEditingLabel.closeView!.image = UIImage(named: "cross")
      stickerView.currentlyEditingLabel.rotateView?.image = UIImage(named: "rotate")
      stickerView.currentlyEditingLabel.border?.strokeColor = UIColor.white.cgColor
      stickerView.currentlyEditingLabel.labelTextView?.font = UIFont.systemFont(ofSize: 20.0)
      globalTextView = stickerView.currentlyEditingLabel.labelTextView!


      addDoneButtonOnKeyboard(textView: stickerView.currentlyEditingLabel.labelTextView!)
      stickerView.currentlyEditingLabel.labelTextView?.becomeFirstResponder()
      // stickerView.addLabel()
      fontFamilyArr = UIFont.familyNames

      print("fontFamilyArr",fontFamilyArr)


      }


      I can't understand how can I achieve the requied result.Kindly help me to understand what should I search or how should I implement it.
      Thanks in advance.










      share|improve this question














      I am new to ios development and I am trying to add a shadow on textview.



      This is expected image with shadow:-



      and This is what I am getting after applying shadow



      I have applied shadow using following code-



      func setUpText(){
      //Add the label
      stickerView.addLabel()

      //add shadow to textview
      stickerView.textShadowColor = stickerView.textColor
      stickerView.textShadowOffset = CGSize(width:8, height:8)

      //Modify the Label
      stickerView.textColor = UIColor.white
      stickerView.textAlpha = 1
      stickerView.currentlyEditingLabel.closeView!.image = UIImage(named: "cross")
      stickerView.currentlyEditingLabel.rotateView?.image = UIImage(named: "rotate")
      stickerView.currentlyEditingLabel.border?.strokeColor = UIColor.white.cgColor
      stickerView.currentlyEditingLabel.labelTextView?.font = UIFont.systemFont(ofSize: 20.0)
      globalTextView = stickerView.currentlyEditingLabel.labelTextView!


      addDoneButtonOnKeyboard(textView: stickerView.currentlyEditingLabel.labelTextView!)
      stickerView.currentlyEditingLabel.labelTextView?.becomeFirstResponder()
      // stickerView.addLabel()
      fontFamilyArr = UIFont.familyNames

      print("fontFamilyArr",fontFamilyArr)


      }


      I can't understand how can I achieve the requied result.Kindly help me to understand what should I search or how should I implement it.
      Thanks in advance.







      swift uiview shadow






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 25 '18 at 10:38









      Pratz_iOSPratz_iOS

      3218




      3218
























          1 Answer
          1






          active

          oldest

          votes


















          0














          You have to essentially implement a gradient view and manipulate its frame.



          How to Apply Gradient to background view of iOS Swift App



          This answer teaches how to implement a gradient view.



          But you will have to change the frame of the gradient view according to your requirement.



          I have given you some basic inputs. Search in that direction.






          share|improve this answer
























          • Thank you @Damon.

            – Pratz_iOS
            Nov 25 '18 at 16:51











          • Hi @Damon,I have tried a lot changing gradient angle using start ,end and location point but still couldn't get the desired result.Can you please help a little more in this direction?

            – Pratz_iOS
            Nov 26 '18 at 11:23












          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%2f53466655%2fadd-slanting-shadow-to-view-in-swift%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









          0














          You have to essentially implement a gradient view and manipulate its frame.



          How to Apply Gradient to background view of iOS Swift App



          This answer teaches how to implement a gradient view.



          But you will have to change the frame of the gradient view according to your requirement.



          I have given you some basic inputs. Search in that direction.






          share|improve this answer
























          • Thank you @Damon.

            – Pratz_iOS
            Nov 25 '18 at 16:51











          • Hi @Damon,I have tried a lot changing gradient angle using start ,end and location point but still couldn't get the desired result.Can you please help a little more in this direction?

            – Pratz_iOS
            Nov 26 '18 at 11:23
















          0














          You have to essentially implement a gradient view and manipulate its frame.



          How to Apply Gradient to background view of iOS Swift App



          This answer teaches how to implement a gradient view.



          But you will have to change the frame of the gradient view according to your requirement.



          I have given you some basic inputs. Search in that direction.






          share|improve this answer
























          • Thank you @Damon.

            – Pratz_iOS
            Nov 25 '18 at 16:51











          • Hi @Damon,I have tried a lot changing gradient angle using start ,end and location point but still couldn't get the desired result.Can you please help a little more in this direction?

            – Pratz_iOS
            Nov 26 '18 at 11:23














          0












          0








          0







          You have to essentially implement a gradient view and manipulate its frame.



          How to Apply Gradient to background view of iOS Swift App



          This answer teaches how to implement a gradient view.



          But you will have to change the frame of the gradient view according to your requirement.



          I have given you some basic inputs. Search in that direction.






          share|improve this answer













          You have to essentially implement a gradient view and manipulate its frame.



          How to Apply Gradient to background view of iOS Swift App



          This answer teaches how to implement a gradient view.



          But you will have to change the frame of the gradient view according to your requirement.



          I have given you some basic inputs. Search in that direction.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 25 '18 at 12:17









          NilanshuNilanshu

          5361619




          5361619













          • Thank you @Damon.

            – Pratz_iOS
            Nov 25 '18 at 16:51











          • Hi @Damon,I have tried a lot changing gradient angle using start ,end and location point but still couldn't get the desired result.Can you please help a little more in this direction?

            – Pratz_iOS
            Nov 26 '18 at 11:23



















          • Thank you @Damon.

            – Pratz_iOS
            Nov 25 '18 at 16:51











          • Hi @Damon,I have tried a lot changing gradient angle using start ,end and location point but still couldn't get the desired result.Can you please help a little more in this direction?

            – Pratz_iOS
            Nov 26 '18 at 11:23

















          Thank you @Damon.

          – Pratz_iOS
          Nov 25 '18 at 16:51





          Thank you @Damon.

          – Pratz_iOS
          Nov 25 '18 at 16:51













          Hi @Damon,I have tried a lot changing gradient angle using start ,end and location point but still couldn't get the desired result.Can you please help a little more in this direction?

          – Pratz_iOS
          Nov 26 '18 at 11:23





          Hi @Damon,I have tried a lot changing gradient angle using start ,end and location point but still couldn't get the desired result.Can you please help a little more in this direction?

          – Pratz_iOS
          Nov 26 '18 at 11:23




















          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%2f53466655%2fadd-slanting-shadow-to-view-in-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







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()