What is self->property? [duplicate] - ios

This question already has answers here:
What is the difference between '->' (arrow operator) and '.' (dot operator) in Objective-C?
(3 answers)
Closed 8 years ago.
I am familiar in iOS/Objective C. Now I see people using self->property in some cases. How does it differ from self.property? What is the actual need? I googled, no answer. Curious in it.

self->property is the same as _property, meaning it accesses the ivar directly.
self.property on the other hand calls the setter/getter.

Related

In objective c, when creating objects, why do we need to use *? [duplicate]

This question already has answers here:
Use of * in Objective C Syntax
(4 answers)
Closed 8 years ago.
In objective c, when creating objects, why do we need to use *? For example, we are creating
NSString *string =#"i ma string";
In the above code why do we need to use *string
Can anyone explain please?
Thanks in advance.
* means that it is pointer to object, not the actual object
Objective-C mandates that you access objects via pointers, such that they're created on the heap and never on the stack

I need help converting from base 36 to base 10 [duplicate]

This question already has answers here:
What is the standard (or best supported) big number (arbitrary precision) library for Lua?
(6 answers)
Closed 8 years ago.
As an example, I want to convert:
1j16qd5g0lc
To:
5589146303201280
But currently ‘tonumber’ converts it to:
5.5891463032013e+15
I understand that there is a bit.tonumber function that might work better but that function is not available to me. Could someone implement what I need easily? I am not too familiar Lua.
Thank you! :)
Try print(string.format("%.0f",tonumber("1j16qd5g0lc",36))).

Why does ActiveSupport add method forty_two to Array [duplicate]

This question already has answers here:
Rails lists have .first and .second – is there a .hundredth or .sixty_nineth ?
(3 answers)
Closed 9 years ago.
You can see the method here.
Is this a joke?
I think Array#forty_two is a quite clever and convenient way to fetch a really important element from an array. An element that might answer a lot of questions.

UIProgressView scaling inconsistency issue [duplicate]

This question already has answers here:
Dot Notation vs Method Notation
(6 answers)
Closed 8 years ago.
Total newb here.
What is the difference between this
_myUIProgressView.transform = CGAffineTransformScale(_myUIProgressView.transform, 1.0, 0.3);
and this:
[_myUIProgressView setTransform:CGAffineTransformMakeScale(1.0, 0.3)];
besides the brevity. Why would you favor one over the other?
Those 2 calls are functionally identical. The only difference is syntax.
The first is called dot notation. The second is a method call to the setter.
Dot notation is an alternative way to invoke a property's setter or getter, and it does exactly the same thing as the other syntax.
Some people (mostly old school C programmers) don't like the dot syntax. I'm an old C programmer, but I like it.

What does & mean in this piece of rails code [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
What does map(&:name) mean in Ruby?
Assume that Game is an active record model, what does the & mean in the following code?
Games.group_by(&:genre)
See this: What do you call the &: operator in Ruby?

Resources