0

Dashcode で Web サイトを作成しています。Objective C はよく知っていますが、JavaScript はほとんど知りません。以下は、objective-c クラスの例です。

/* Here is an example .h file, "CircularList.h".
All behavior is inherited from List, which defines a List of objects.
Nowadays we can use NSArray which is more complex than List.
*/

#include <objc/List.h>  /* Superclass interface */

@interface CircularList: List /* List is superclass */
{  
    int currentLocation;
}  

- (NSString *) next; /* Returns next object in List or nil if none.  */ 

@end 

/* Here is the corresponding .m file: */
#include "CircularList.h"

@implementation CircularList

- (NSString *) next
{   
    int numObjects = [self count];  
    if (currentLocation >= numObjects)  
        currentLocation = 0;    
    return [self objectAt:currentLocation++];
}

@end

このクラスを DashCode のサファリ Web アプリケーション プロジェクトに接続するにはどうすればよいですか? 次はどうやって電話するの?NSString を var に変換し、その var をログに出力するにはどうすればよいですか?

追加の詳細

私は開発ライブラリを見てきました。目的の c クラスをダッシュ​​コード プロジェクトにインポートするにはどうすればよいですか?

クラスは次のとおりです。

/* Here is an example .h file, "CircularList.h".
All behavior is inherited from List, which defines a List of objects.
Nowadays we can use NSArray which is more complex than List.
*/

#include <objc/List.h> /* Superclass interface */

@interface CircularList: List /* List is superclass */
{ 
    int currentLocation;
} 

- (NSString *) next; /* Returns next object in List or nil if none. */ 

@end 










/* Here is the corresponding .m file: */
#include "CircularList.h"

@implementation CircularList

- (NSString *) next
{ 
int numObjects = [self count]; 
if (currentLocation >= numObjects) 
    currentLocation = 0; 
return [self objectAt:currentLocation++];
}

+ (NSString *) webScriptNameForSelector:(SEL)sel
{

if (sel == @selector(nameAtIndex:))
    name = [self next];

return name;
}

+ (BOOL)isSelectorExcludedFromWebScript:(S…
{
if (sel == @selector(nameAtIndex:)) return NO;
    return YES;
}
@end

目的 c を JavaScript ファイルまたはダッシュコード プロジェクトに接続するにはどうすればよいですか? 目的の c クラスはどこに行きますか (例: js と同じフォルダー)? 私の関数を「次へ」と呼ぶJavaScriptは何ですか? 次のコードは何をしますか?: + (BOOL)isSelectorExcludedFromWebScript:(S… { if (sel == @selector(nameAtIndex:)) return NO; return YES; }

4

1 に答える 1