Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8570449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:33:38+00:00 2026-06-11T18:33:38+00:00

I have a few line of code in viewwillappear method. I want to execute

  • 0

I have a few line of code in viewwillappear method. I want to execute this code only once. How can i do this. However this code is inside a loop.

CALayer *myLayer = btn.layer;
myLayer.borderColor = [UIColor blackColor].CGColor;
myLayer.masksToBounds=NO;
myLayer.borderWidth = 2.0;
myLayer.shadowOffset = CGSizeMake(0, 3);
myLayer.shadowRadius = 10.0;
myLayer.shadowColor = [UIColor blackColor].CGColor;
myLayer.shadowOpacity = 1.0;

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:33:39+00:00Added an answer on June 11, 2026 at 6:33 pm

    Declare a BOOL variable flag (or any name you like) in .h file. set it to NO in viewDidLoad method. In viewWillAppear method, have a check if this code is executed before:

    for(---)
    {
    if(!flag)
     {
          //execute above lines of code
       flag = YES;
     }
    }
    

    just in last line, make its value YES.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this line of code: System.Drawing.Icon icon = System.Drawing.Icon.FromHandle(shinfo.hIcon); A few lines later,
I have a few blocks of code, inside a function of some object, that
I have few questions about this code: <?php $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv =
in my very big webpage (aroung 50 pages, 20.000 line code) I have only
I have a few lines of code where I use this function, but it
I can't seem to chain some actions together, specifically this line of code: $messages
I want to demonstrate with a few line of code that in Java, that
I Have a few lines of code public void CreateMethod<TContract>(Expression<Action<TContract>> method) { var innerMethod
Am I the only one who get this problem? I have few sections and
I have few question in this regard When you create an internet page, does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.