0
class1 *obj=[[class1 alloc]init];

I want to add this object in the NSMutableArray.

1 Answer 1

1

This is fairly simple to do.

class1 *obj = [[class1 alloc] init];
NSMutableArray *array = [[NSMutableArray alloc] init];
[array addObject:obj];
Sign up to request clarification or add additional context in comments.

5 Comments

By the way, you forgot a bracket [ in your second line.
one more thing i want to know,I am using five button in a view, I dont want to give the location for every button then how i will place these button vertically in the view
@AnshumanMishra, that seems like a whole new question to me. In your new question please try to be as verbose as you can, include code snippets and other things you have tried. Cheers.
@AnshumanMishra Please try to find the answer on Stack Overflow and Google first though. This is a pretty common and simple issue, it's almost certainly been asked before. Stack Overflow gets enough duplicate questions as is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.