PDA&Mobile2010/01/27 10:32
* 본 포스트는 Blog.MissFlash.com에서 작성한 것으로, 원문 저작자의 동의없이 마음대로 퍼가실 수 없습니다. 포스트의 내용이 마음에 드시면 링크를 이용해주시면 감사하겠습니다.

> Stanford Lecture #4

* Getters and Setters
- (int)age;
- (void)setAge:(int)age;

* Properties allow access to setters and getters through dot syntax
@property age;
int theAge = person.age;
person.age = 21;

* Various methods of UIApplicationDelegate
- (void)applicationDidFinishLaunching:(UIApplication *)application;
- (void)applicationWillTerminate:(UIApplication *)application;

- (void)applicationWillResignActive:(UIApplication *)application;
- (void)application:(UIApplication *)application handleOpenURL:(NSURL *)url;

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application;

* 3 different flavors of action method selector types
- (void)actionMethod;
- (void)actionMethod:(id)sender;
- (void)actionMethod:(id)sender withEvent:(UIEvent *)event;

* Manual Target-Action
@interface UIControl;
- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents;
- (void)removeTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents;
@end





> Stanford Lecture #5

* Add/remove views
- (void)addSubview:(UIView *)view;
- (void)removeFromSuperview;

* Manipulate the view hierarchy
- (void)insertSubview:(UIView *)view atIndex:(int)index;
- (void)insertSubview:(UIView *)view belowSubview:(UIView *)view;
- (void)insertSubview:(UIView *)view aboveSubview:(UIView *)view;
- (void)exchangeSubviewAtIndex:(int)index withSubviewAtIndex:(int)otherindex;

* 일시적으로 뷰 감추기
myView.hidden = YES;

* View location
CGPoint(x, y);

* View dimension
CGSize(width, height);

* View location and dimension
CGRect(origin, size);

* Manual view creation
CGRect frame = CGRectMake(20, 45, 140, 21);
UILabel *label = [[UILabel alloc] initWithFrame:frame];

[window addSubview:label];
[label setText:@"Number of sides:"];
[label release];

* Defining custom views
- (void)drawRect:(CGRect)rect;

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;

* When a view needs to be redrawn, use:
- (void)setNeedsDisplay;

[polygonView setNeedsDisplay];

* Access the graphics context within drawRect: by calling
(CGContextRef)UIGraphicsGetCurrentContext(void);

* 색상 설정
UIColor *redColor = [UIColor redColor];
[redColor set];
// [[UIColor redColor] set] 과 동일

* 폰트 설정
UIFont *font = [UIFont systemFontOfSize:14.0];
[myLabel setFont:font];

* 도형 색 채우기
UIRectFill(square);

* 테두리 색 채우기
UIRectFrame(square);

* 이미지 삽입하는 3가지 방법
+ [UIImage imageNamed:(NSString *)name];
- [UIImage initWithContentsOfFile:(NSString *)path];
- [UIImage initWithData:(NSData *)data];

* Bitmap image example
UIGraphicsBeginImageContext(size);
// drawing code...
result = UIGraphicsGetImageFromCurrentContext();
UIGraphicsEndImageContext();
return result;

* Getting image data
NSData *UIImagePNGRepresentation (UIImage *image);
NSData *UIImageJPGRepresentation (UIImage *image);

* Drawing text & images
- [UIImage drawAtPoint:(CGPoint)point);
- [UIImage drawInRect:(CGRect)rect);
- [UIImage drawAsPatternInRect:(CGRect)rect);
- [NSString drawAtPoint:(CGPoint)point withFont:(UIFont *)font];

* View animation example
- (void)showAdvancedOptions {
[UIView beginAnimations:@"advancedAnimations" context:nil];
[UIView setAnimationDuration:0.3];

// make optionsView visible
optionsView.alpha = 1.0;

// move the polygonView down
CGRect polygonFrame = polygonView.frame;
polygonFrame.origin.y += 200;
polygonView.frame = polygonFrame;

[UIView commitAnimations];
}

* View transforms
CGAffineTransformScale(transform, xScale, yScale);
CGAffineTransformRotate(transform, angle);
CGAffineTransformTranslate(transform, xDelta, yDelta);

* Saving state across app launches
+ (NSUserDefaults *)standardUserDefaults;

- (int)integerForKey:(NSString *)key;
- (void)setInteger:(int)value forKey:(NSString *)key;

- (id)objectForKey:(NSString *)key;
- (void)setObject:(id)value forKey:(NSString *)key;
저작자 표시 비영리 변경 금지

이 글은 새로운 정보가 추가될 때마다 업데이트됩니다. 추천으로 아래 숫자에 1을 더해보세요. :)
RSS구독을 하시면 포스트를 배달해 드립니다. ▷ 한RSS 구독하기, 구글리더 구독하기

TRACKBACK http://blog.missflash.com/trackback/622 관련글 쓰기

  1. http://trade-control.com.ua  삭제

    2014/09/23 05:08TRACKBACK FROM http://trade-control.com.ua

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(4) : Stanford Lectures #4-5

  2. visit this website  삭제

    2014/10/06 20:41TRACKBACK FROM visit this website

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(4) : Stanford Lectures #4-5

  3. website search  삭제

    2014/11/09 19:52TRACKBACK FROM website search

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(4) : Stanford Lectures #4-5

댓글을 달아 주세요