Objective-C Primer(3)Multiple arguments for one method, synthesize and dynamic

梁丘洲
2023-12-01

Objective-C Primer(3)Multiple arguments for one method, synthesize and dynamic

  • Author: 柳大·Poechant(钟超)
  • Email: zhongchao.ustc#gmail.com (# -> @)
  • Blog:Blog.CSDN.net/Poechant
  • Date: May 7th, 2012

1 How to declare a method with multiple arguments?


//
//  TestClass.m
//  ObjectiveCTest
//
//  Created by 超 钟 on 12-5-6.
//  Copyright (c) 2012年 http://blog.csdn.net/poechant. All rights reserved.
//

#import "TestClass.h"

@implementation TestClass

-(void)privateMethod2: (int)inArg1 arg2:(int)inArg2
{
    NSLog(@"private method 2");
}

-(void)someMethod;
{
    NSLog(@"some method got called");
    
    [self privateMethod1:1 
                    arg2:2 
                    arg3:3];
    
    [self privateMethod2:1
                    arg2:2];
}

@end

2 How to invoke a method with multiple arguments?

It’s similar to declare the method. Do you remember…



-(void)privateMethod1: (int)inArg1
                 arg2: (int)inArg2
                 arg3: (int)inArg3
{
    NSLog(@"private method 1");
}

3 What the difference between synthesize and dynamic?

synthesize seems better than dynamic because at this moment, you may think less is better. But your demands are not satisfied every time because of $.

-

转载请注明来自柳大的CSDN博客:Blog.CSDN.net/Poechant

-

 类似资料: