2011-07-06 4 views
0

NSTreadでパラメータとして文字列を取得しています。この文字列を次のメソッドに渡す必要があります。どのようにすればいいですか?私のコードは以下の通りです:メソッドを呼び出して、NSTreadからメソッドにパラメータを渡すには?

[self friendPic:user.userId]; 

オブジェクトを渡す 私NSTreadはおそらくselector:@selector(getFriendPic:)selector:@selector(getFriendPic)を交換する必要があり、この

-(void)friendPic:(NSString *)friendID{ 
    NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(getFriendPic) object:friendID]; 
    [thread start]; 
    [thread release]; 

} 

-(void)getFriendPic:(NSString *)_friendID{ 
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 



    NSString *str =[NSString stringWithFormat:@"http://www.3softcanada.com/ipictures/Image%@.png",_friendID]; 

    NSLog(@"url is%@", str); 
    NSData *imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:str]]; 

    UIImage *theImage= [[UIImage alloc] initWithData:imageData ]; 
    avatar.image = theImage; 

    [pool release]; 

} 

答えて

0

です。あなたはコロンを見逃しました。

関連する問題