2010년 6월 29일 화요일

UIView Flip 효과 - iPhone

  


#pragma mark - Flip screen


- (void)flipAction:(id)sender

{

[UIView setAnimationDelegate:self];

[UIView setAnimationDidStopSelector:@selector

            (animationDidStop:animationIDfinished:finished:context:)];

[UIView beginAnimations:nil context:nil];

[UIView setAnimationDuration:0.75];

[UIView setAnimationTransition:([self.tableView superview] ? UIViewAnimationTransitionFlipFromLeft UIViewAnimationTransitionFlipFromRight)

forView:self.tableView cache:YES];

if ([instructionsView superview])

[instructionsView removeFromSuperview];

else

[self.tableView addSubview:instructionsView];


[UIView commitAnimations];

// adjust our done/info buttons accordingly

if ([instructionsView superview] == self.tableView)

self.navigationItem.rightBarButtonItem = doneButton;

else

self.navigationItem.rightBarButtonItem = flipButton;

}

2010년 6월 27일 일요일

Protocols - Objective-C

Protocol : 메소드 선언의 집합

java의 interface라는 개념이 Protocol을 도입한 개념임. 

서로 다른 객체가 같은 메소드의 집합을 가지는 경우, 상속 관계는 아님. 

프로토콜은 메소드의 명칭들을 정해 놓으면 그 프로토콜을 따를 때 메소드의 명칭들이 같아지므로 사용성이 좋아지는 것을 목적으로 한다.