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

鍾超發表於2012-05-07

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?

synthesizeseems better thandynamicbecause at this moment, you may think less is better. But your demands are not satisfied every time because of $.

-

轉載請註明來自柳大的CSDN部落格:Blog.CSDN.net/Poechant

-

相關文章