Truly sad day. You are my hero.
(Image from www.apple.com)
'일상에 대한 메모' 카테고리의 다른 글
Rest In Peace, Steve Jobs (0) | 2011.10.06 |
---|---|
박경철 님의 강연을 들었습니다. (0) | 2011.05.20 |
Rest In Peace, Steve Jobs (0) | 2011.10.06 |
---|---|
박경철 님의 강연을 들었습니다. (0) | 2011.05.20 |
Rest In Peace, Steve Jobs (0) | 2011.10.06 |
---|---|
박경철 님의 강연을 들었습니다. (0) | 2011.05.20 |
위의 코드는 검정색 bar로 만든다 (ipod처럼) 마지막 상수를 바꾸면 반투명 검정색 bar로 바꿀 수도 있다
Status bar의 색깔 변경하기 (code 상에서) (0) | 2010.12.01 |
---|---|
UIImageView를뒤집기 (flip) (0) | 2010.12.01 |
Keyboard 숨기기 (0) | 2010.11.25 |
NSString Object를 이용한 memory management 기법 확인 (0) | 2008.12.18 |
XCode 3.1에서 Google Project Hosting (SVN) 이용하기 - 4. XCode에서 사용하기 (5) | 2008.12.11 |
XCode 3.1에서 Google Project Hosting (SVN) 이용하기 - 3. SVN에 소스코드 Import하기 (2) | 2008.12.11 |
UIImage* artworkImage = [UIImage imageNamed:imageUrl];
[artworkReversedView setImage:artworkImage];
artworkReversedView.transform = CGAffineTransformMakeScale(1, -1);
Status bar의 색깔 변경하기 (code 상에서) (0) | 2010.12.01 |
---|---|
UIImageView를뒤집기 (flip) (0) | 2010.12.01 |
Keyboard 숨기기 (0) | 2010.11.25 |
NSString Object를 이용한 memory management 기법 확인 (0) | 2008.12.18 |
XCode 3.1에서 Google Project Hosting (SVN) 이용하기 - 4. XCode에서 사용하기 (5) | 2008.12.11 |
XCode 3.1에서 Google Project Hosting (SVN) 이용하기 - 3. SVN에 소스코드 Import하기 (2) | 2008.12.11 |
Status bar의 색깔 변경하기 (code 상에서) (0) | 2010.12.01 |
---|---|
UIImageView를뒤집기 (flip) (0) | 2010.12.01 |
Keyboard 숨기기 (0) | 2010.11.25 |
NSString Object를 이용한 memory management 기법 확인 (0) | 2008.12.18 |
XCode 3.1에서 Google Project Hosting (SVN) 이용하기 - 4. XCode에서 사용하기 (5) | 2008.12.11 |
XCode 3.1에서 Google Project Hosting (SVN) 이용하기 - 3. SVN에 소스코드 Import하기 (2) | 2008.12.11 |
#import <Cocoa/Cocoa.h>
@interface PolygonShape : NSObject {
int numberOfSides;
int minimumNumberOfSides;
int maximumNumberOfSides;
float angleInDegrees;
float angleInRadians;
NSString* name;
}
- (void) dealloc;
- (id)init;
- (id)initWithNumberOfSides: (int)sides minimumNumberOfSides:(int)min maximumNumberOfSides:(int)max;
- (void) description;
@property (readwrite) int numberOfSides;
@property (readwrite) int minimumNumberOfSides;
@property (readwrite) int maximumNumberOfSides;
@property (readonly) float angleInDegrees;
@property (readonly) float angleInRadians;
@property (readonly) NSString* name;
@end
#import "PolygonShape.h"
@implementation PolygonShape
@synthesize numberOfSides;
@synthesize minimumNumberOfSides;
@synthesize maximumNumberOfSides;
- (void)dealloc
{
NSLog(@"dealloc is called. This Polygon ivar is destroyed");
[super dealloc];
}
- (void) setNumberOfSides: (int) value
{
if (value < minimumNumberOfSides)
{
NSLog(@"Invalid number of sides: %d is less than the maximum of %d allowed", value, minimumNumberOfSides);
}
else if (value > maximumNumberOfSides)
{
NSLog(@"Invalid number of sides: %d is greater than the maximum of %d allowed", value, maximumNumberOfSides);
}
else
{
numberOfSides = value;
}
}
- (void) setMinimumNumberOfSides: (int) value
{
if (value > 2)
{
minimumNumberOfSides = value;
}
else
{
NSLog(@"Invalid minimum number of sides: %d is less than the minimum of 2 allowed", value);
}
}
- (void) setMaximumNumberOfSides: (int) value
{
if (value <= 12)
{
maximumNumberOfSides = value;
}
else
{
NSLog(@"Invalid maximum number of sides: %d is greater than the maximum of 12 allowed", value);
}
}
- (id)init
{
[self initWithNumberOfSides:5 minimumNumberOfSides:3 maximumNumberOfSides:10];
return self;
}
- (id)initWithNumberOfSides: (int)sides minimumNumberOfSides:(int)min maximumNumberOfSides:(int)max
{
[super init];
self.minimumNumberOfSides = min;
self.maximumNumberOfSides = max;
self.numberOfSides = sides;
return self;
}
- (float)angleInDegrees
{
return (180 * (numberOfSides - 2) / numberOfSides);
}
- (float)angleInRadians
{
return self.angleInDegrees * 2 * 3.14 / 360;
}
- (NSString*)name
{
NSMutableString* nameOfPolygon = [NSMutableString string];
switch (numberOfSides)
{
case 3 : nameOfPolygon = @"triangle"; break;
case 4 : nameOfPolygon = @"square"; break;
case 5 : nameOfPolygon = @"pentagon"; break;
case 6 : nameOfPolygon = @"hexagon"; break;
case 7 : nameOfPolygon = @"heptagon"; break;
case 8 : nameOfPolygon = @"octagon"; break;
case 9 : nameOfPolygon = @"enneagon"; break;
case 10 : nameOfPolygon = @"decagon"; break;
case 11 : nameOfPolygon = @"hendecagon"; break;
case 12 : nameOfPolygon = @"dodecagon"; break;
default : nameOfPolygon = @"";
}
return nameOfPolygon;
}
- (void)description
{
NSLog(@"Hello, I'm a %d-sided polygon (aka a %@) with angles of %f degrees (%f radians)", numberOfSides, self.name, self.angleInDegrees, self.angleInRadians);
}
@end
Chapter 3. Custom Class, Memory Management, and Obj-C Properties (0) | 2009.06.24 |
---|---|
Chapter 2. Using Objective-C, Foundation Framework (0) | 2009.06.24 |
Stanford Class (CS193P) - IPhone Application Programming (0) | 2009.06.24 |
void PrintPathInfo()
{
NSString *path = @"~";
path = [path stringByExpandingTildeInPath];
NSLog(@"My home folder is %@", path);
NSArray *pathCompArray = [path pathComponents];
NSEnumerator *foreachEnum = [pathCompArray objectEnumerator];
NSString* item;
while (item = [foreachEnum nextObject])
{
NSLog(@"%@\n", item);
}
}
void PrintProcessInfo()
{
NSString *processName = [[NSProcessInfo processInfo] processName];
int processId = [[NSProcessInfo processInfo] processIdentifier];
NSString* outputStr = [NSString stringWithFormat: @"Process Name : %@, Process ID : '%d'",
processName, processId];
NSLog(outputStr);
}
void PrintBookmarkInfo()
{
NSArray *keyArray = [NSArray arrayWithObjects: @"Stanford University",
@"Apple",
@"CS193P",
@"Stanford on iTunes U",
@"Stanford Mall", nil];
NSArray *strValueArray = [NSArray arrayWithObjects: @"http://www.stanford.edu",
@"http://www.apple.com",
@"http://cs193p.stanford.edu",
@"http://itunes.stanford.edu",
@"stanfordshop.com", nil];
NSMutableDictionary *bookMark = [NSMutableDictionary dictionaryWithCapacity: 5];
// c-style iteration
for (int nIdx = 0; nIdx < [keyArray count]; nIdx++)
{
[bookMark setValue: [NSURL URLWithString: [strValueArray objectAtIndex: nIdx]] forKey: [keyArray objectAtIndex: nIdx]];
}
NSEnumerator *keyEnum = [bookMark keyEnumerator];
NSString* key;
// Iteration with enumerator
while (key = [keyEnum nextObject])
{
NSURL *url = [bookMark objectForKey: key];
NSLog(@"Key : '%@' URL : '%@'\n", key, [url relativeString]);
}
}
void PrintIntrospectionInfo()
{
NSMutableArray *anyObjArray = [NSMutableArray arrayWithCapacity: 5];
NSString *string = [NSString stringWithFormat: @"Hello, Mac!!!!"];
NSURL *url = [NSURL URLWithString: @"http://www.apple.com"];
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
NSDictionary *dic = [NSDictionary dictionary];
[anyObjArray addObject: string];
[anyObjArray addObject: url];
[anyObjArray addObject: processInfo];
[anyObjArray addObject: dic];
NSEnumerator *objEnum = [anyObjArray objectEnumerator];
NSObject *obj;
while (obj = [objEnum nextObject])
{
NSLog(@"Class Name : %@\n", [obj className]);
NSLog(@"Is member of NSString : %@", [obj isMemberOfClass: [NSString class]] ? @"YES" : @"NO");
NSLog(@"Is kind of NSString : %@", [obj isKindOfClass: [NSString class]] ? @"YES" : @"NO");
SEL sel = @selector(lowercaseString);
if ([obj respondsToSelector: sel] == YES)
{
NSLog(@"lowercaseString is '%@'", [obj performSelector: sel]);
}
else
{
NSLog(@"Responds to lowercaseString : NO");
}
NSLog(@"====================================");
}
[anyObjArray removeAllObjects];
[anyObjArray release];
}
Chapter 3. Custom Class, Memory Management, and Obj-C Properties (0) | 2009.06.24 |
---|---|
Chapter 2. Using Objective-C, Foundation Framework (0) | 2009.06.24 |
Stanford Class (CS193P) - IPhone Application Programming (0) | 2009.06.24 |
Chapter 3. Custom Class, Memory Management, and Obj-C Properties (0) | 2009.06.24 |
---|---|
Chapter 2. Using Objective-C, Foundation Framework (0) | 2009.06.24 |
Stanford Class (CS193P) - IPhone Application Programming (0) | 2009.06.24 |
Combinational Analysis #3 (4) | 2009.03.05 |
---|---|
Combinational Analysis #2 (3) | 2009.03.01 |
Combinational Analysis #1 (0) | 2009.02.05 |
결함 정보는 Test case로 관리해라!! (1) | 2009.01.02 |
Issue Tracker (Bug Tracker)적용의 어려움 (1) | 2009.01.02 |
Combinational Analysis #3 (4) | 2009.03.05 |
---|---|
Combinational Analysis #2 (3) | 2009.03.01 |
Combinational Analysis #1 (0) | 2009.02.05 |
결함 정보는 Test case로 관리해라!! (1) | 2009.01.02 |
Issue Tracker (Bug Tracker)적용의 어려움 (1) | 2009.01.02 |
댓글을 달아 주세요