私はココア... を学んでいる私は私の実装では、この方法を持っている...メソッドの呼び出し - ココア/ OBJの-C
を、私はそれを行うための別の方法を試してみましたが、私は黒で、まだです:
- (void)closeStream:(NSStream *)theStream {
[theStream close];
[theStream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}
@synthetizeのIBActionからどのように呼び出すことができますか? closeStream:
方法がconnect:
方法より同じクラスで定義されている
- (IBAction)connect:(id)sender {
if ([[connectNOK stringValue] isEqualToString:@"Disconnected"]) {
[connectButton setTitle:@"Disconnect"];
NSString * hostFromField = [hostField stringValue];
CFReadStreamRef readStream;
CFWriteStreamRef writeStream;
CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)hostFromField, [portField intValue], &readStream, &writeStream);
inputStream = (NSInputStream *)readStream;
outputStream = (NSOutputStream *)writeStream;
[inputStream setDelegate:self];
[outputStream setDelegate:self];
[inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[inputStream open];
[outputStream open];
} else {
[connectButton setTitle:@"Connect"];
// I want to call this method here
}
}
これは完全な言語仕様です。新しい人なら、[Learning Objective-C:A Primer](http://developer.apple.com/library/mac/referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/)から始める方がよいでしょう。 –
あなたは完全に正しいです、ありがとうございます)あなたのリンクで私の答えを訂正しました。 – Macmade
私はあなたの答えのために、問題を修正しました。 –