// MyClass.h
@interface MyClass : NSObject
{
NSDictionary *dictobj;
}
@end
//MyClass.m
@implementation MyClass
-(void)applicationDiDFinishlaunching:(UIApplication *)application
{
}
-(void)methodA
{
// Here i need to add objects into the dictionary
}
-(void)methodB
{
//here i need to retrive the key and objects of Dictionary into array
}
私の質問は、methodA と methodB の両方が NSDictionary オブジェクト [ie dictobj] を使用しているためです。このコードをどのメソッドに記述すればよいでしょうか。
dictobj = [[NSDictionary alloc]init];
両方の方法で2回行うことはできません。したがって、どうやってそれを行うのですか?