摘要:
如果学过Java和C#的人,这里容易搞混,Objective-C中的@interface关键字是申明类@interface Circle : NSObject{ @private ShapeColor fillColor; ShapeRect bounds;}- (void) setFillColor: (ShapeColor) fillColor;- (void) setBounds: (ShapeRect) bounds;- (void) draw;@end // Circle如上,这样的申明类的方式确实让我们Java和C#程序员有点不太习惯,连缩进方式也是还是来看一下完... 阅读全文
posted @ 2013-02-20 10:45
Master HaKu
阅读(184)
评论(0)
推荐(0)
摘要:
#import <Foundation/Foundation.h>// --------------------------------------------------// constants for the different kinds of shapes and their colorstypedef enum { kCircle, kRectangle, kOblateSpheroid} ShapeType;typedef enum { kRedColor, kGreenColor, kBlueColor} ShapeColor;// -----... 阅读全文
posted @ 2013-02-20 10:32
Master HaKu
阅读(236)
评论(0)
推荐(0)
摘要:
#import <Foundation/Foundation.h>int main (int argc, const char * argv[]){ FILE *wordFile = fopen ("/tmp/words.txt", "r"); char word[100]; while (fgets(word, 100, wordFile)) { // strip off the trailing \n word[strlen(word) - 1] = '\0'; NSLog (@"%s is %lu charac 阅读全文
posted @ 2013-02-20 10:10
Master HaKu
阅读(334)
评论(0)
推荐(0)