Objective-C: object as parameter and returning object in a function [closed] - objective-c

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
This may be trivial. I'm wondering if you can pass an object as parameter to a function, then function can operate on the object and then return the same object back. I've got a work around for this, but would like to know if there is a way to do it.
An Example:
-(objectA *)aFunctionWithParameter:(objectA *)param
{
//...Operate on param
return param;
}

Yes, you can do it.
In objective-C, the pointers are passed by reference. So, when you change any fileds of an object received as a parameter of your function, you are modifying the actual object. On returning it, you will have updated object.

Related

What happens to a Core Data object when it's deleted and still have references to it? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
What happens to a Core Data object if it still has references to it, but is deleted? How should you handle this situation?
When you tell your managed object context to delete an object:
[aContext deleteObject:aManagedObject];
nothing actually happens to the object until [aContext save:&error]; is next sent.
In the meantime, you can check the isDeleted property of the object.
You can also check whether the object's managedObjectContext isnil, indicating the object has been deleted.

indexOfPath incorrect in a nested NSArray [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a nested NSArray
int row = [myarray indexOfObject:module];
and the indexOfObject method returns wrong result. Any idea?
This usually happens when the object module or one of the objects in the NSArray do not implement the isEqual: method correctly. Make sure that module's class has this method
- (BOOL)isEqual:(id)anObject {
...
}
and the method returns YES when this object is equal to anObject, and returns NO otherwise.

Use the value of a variable from a procedure in another one [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
can I get the value of a variable declared in a procedure then use it in an if condition in another one , and how please ?
You have to either pass the value to the other procedure as an input parameter, or store the value somewhere that both procedures can reach it, such as a class member if both procedures are members of the same class, or in a global variable. Your question is pretty vague on details, so I can't provide much of an answer beyond this.

Define screen size constant in Obj-c [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Is there a way I could initialize some constant in a method like -(void) viewDidLoad for my screen variables (retina, not retina etc) ?
Thx
In C and Objective-C, constants cannot be assigned at runtime because they are constant. If you are asking how to assign to an instance variable, or make that variable accessible to other classes, please update your question.

What is message in objective-c? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
What is message in objective-c?
Messages in Objective-C are akin to method calls in C++.
In Objective-C, you don't call a method, you send a message.
If you're at that level of understanding/bemusement, then I'd recommend a read of Apple's excellent "Introduction to The Objective-C Programming Language", as you really need to understand some of the basics before you get any further.
In essence, a message is effectively a method call in Objective-C. (Instead of passing arguments to a method, you "send a message".)