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 8517447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:42:15+00:00 2026-06-11T05:42:15+00:00

See the following animation execution block, how does the UI control pointer clickButton copy

  • 0

See the following animation execution block, how does the UI control pointer clickButton copy from stack to heap? By reference (retain) or just copy pointer value (not deep copy)?

Thanks in advance.

[UIView animateWithDuration:10.0 animations:^(void){
    clickButton.alpha = 1.0;  // clickButton is class variable. 
}];
  • 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-11T05:42:16+00:00Added an answer on June 11, 2026 at 5:42 am

    When a block is copied (which it is in this case), any objective-c objects that are referenced by the block are retained (and then released when the block is dealloc’d).

    In this case, if clickButton was a local variable outside the block, it would be retained inside the block. However, you said it was a “class variable”, which I assume you mean it’s an instance variable. Because of that, the block actually retains self, since the reference to the ivar is really an implicit lookup of the ivar within self.

    In MRR (non-ARC) code, any obj-c objects which are marked with the __block storage qualifier are actually not retained by the capturing block. This is for technical reasons, but it has been taken advantage of by many people. However, in ARC code, __block-qualified variables do get retained (and released) by the block. If you need a non-retained object under ARC, you can use __unsafe_unretained instead. However, in ARC code, weak references typically solve the same problem that __unsafe_unretained variables do, but much more safely.


    Since the block here has a temporary lifetime (it only lives for the duration of the animation), there’s no problem with retaining self. However, for more permanent blocks whose lifetime are actually tied to that of self (e.g. they’re stored in an ivar, or on an object that self owns), you should be careful not to introduce a retain cycle. If you’re using ARC, weak references can help you here.

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

Sidebar

Related Questions

See following code with resides in fillowing directory mypack.pack1 package mypack.pack1; public class myclass
Please see following methods. public static ProductsCollection GetDummyData(int? customerId, int? supplierId) { try {
Please see following examples first, and which one is better? Could you compare some
How can I implement cross browser opacity gradient (not color gradient)? See following code:
See the following: struct A { std::string* get() const { //return const_cast<std::string*>(&m_pObj); return &const_cast<A*>(this)->m_pObj;
See the following code of the <?php class DefaultController extends Controller { public function
See the following output: 1.9.3p194 :001 > player = Player.randomize_for_market => #<Player id: nil,
See the following Mock Test by using Spring/Spring-MVC public class OrderTest { // SimpleFormController
Please see the following manifest. The Activity_1's primary objective has mapInfo refers to a
I see the following in the declarations section at the top of a .cs

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.