Objective-C Primer(3)Multiple arguments for one method, synthesize and dynamic
- Author: 柳大·Poechant(钟超)
- Email: zhongchao.ustc#gmail.com (# -> @)
- Blog:Blog.youkuaiyun.com/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.youkuaiyun.com/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 $.
-
转载请注明来自柳大的优快云博客:Blog.youkuaiyun.com/Poechant
-
本文介绍了Objective-C中如何声明和调用带有多个参数的方法,并对比了synthesize和dynamic的区别。通过具体的代码示例,展示了如何使用不同形式的参数传递。

被折叠的 条评论
为什么被折叠?



