Git Product home page Git Product logo

Comments (6)

kirualex avatar kirualex commented on August 21, 2024

It also works quite well programmatically, just make sure you declare your KAProgressLabel as a strong property :

@property (strong,nonatomic)  KAProgressLabel * pLabel;

Then just do as you would with any UILabel :

self.pLabel = [[KAProgressLabel alloc] initWithFrame:CGRectMake(20, 40, 100, 100)];
[self.view addSubview:self.pLabel];

from kaprogresslabel.

geogerar avatar geogerar commented on August 21, 2024

Thanks for your response.....
I Know, I have done all these and I get a warning.....in the following method..
self.pLabel1.startLabel.text = [NSString stringWithFormat:@"%.f",self.pLabel1.progress*100];
};
The warning is ....
Capturing 'self' strongly in this block is likely to lead to a retain cycle

and also when I go back in my previous controller my app crashes........

Any ideas?

Thanks again

George

from kaprogresslabel.

kirualex avatar kirualex commented on August 21, 2024

Just use weakSelf when using self in a block :

__unsafe_unretained Demo1 * weakSelf = self;
self.pLabel.labelVCBlock = ^(KAProgressLabel *label) {
    weakSelf.pLabel.startLabel.text = [NSString stringWithFormat:@"%.f",weakSelf.pLabel.startDegree];
};

You can also use this awesome library to handle retain cycles : https://github.com/jspahrsummers/libextobjc

from kaprogresslabel.

geogerar avatar geogerar commented on August 21, 2024

what is Demo1 in following sentence?

__unsafe_unretained Demo1 * weakSelf = self;

On Wed, Mar 18, 2015 at 5:15 PM, Alexis Creuzot [email protected]
wrote:

Just use weakSelf when using self in a block :

__unsafe_unretained Demo1 * weakSelf = self;
self.pLabel.labelVCBlock = ^(KAProgressLabel *label) {
weakSelf.pLabel.startLabel.text = [NSString stringWithFormat:@"%.f",weakSelf.pLabel.startDegree];
};

You can also use this awesome library to handle retain cycles :
https://github.com/jspahrsummers/libextobjc


Reply to this email directly or view it on GitHub
#14 (comment)
.

Γιώργος Ν. Γεράρδης

from kaprogresslabel.

kirualex avatar kirualex commented on August 21, 2024

Well this is whatever object holding a reference to the property you need in your block. Usually your UIViewController.
This is pretty basic stuff, you should maybe try this link for more infos on retain cycles : http://www.cocoawithlove.com/2009/07/rules-to-avoid-retain-cycles.html

I'm closing this issue as it is not about the component anymore. You'll find help on StackOverflow if you need to go deeper on this.

from kaprogresslabel.

geogerar avatar geogerar commented on August 21, 2024

OK....
Thank you very very much for your help!

George

On Wed, Mar 18, 2015 at 5:32 PM, Alexis Creuzot [email protected]
wrote:

Well this is whatever object holding a reference to the property you need
in your block. Usually your UIViewController.
This is pretty basic stuff, you should maybe try this link for more infos
on retain cycles :
http://www.cocoawithlove.com/2009/07/rules-to-avoid-retain-cycles.html

I'm closing this issue as it is not about the component anymore. You'll
find help on StackOverflow if you need to go deeper in this.


Reply to this email directly or view it on GitHub
#14 (comment)
.

Γιώργος Ν. Γεράρδης

from kaprogresslabel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.