아이폰어플개발정보2010. 6. 24. 14:21
iPhone Tutorial - nib 에서 불러온 뷰를 특정위치에 모달로 띄우는 방법
- (void)showmodal:(UIView*)pParentView {

    UIView* modalView = [self view];
    
    CGPoint middleCenter = modalView.center;
    CGSize offSize = [UIScreen mainScreen].bounds.size;
    CGPoint offScreenCenter = CGPointMake(offSize.width / 2.0, -300);
    
    modalView.center = offScreenCenter; // we start off-screen
    [pParentView addSubview:modalView];
    
    // Show it with a transition effect
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.9]; // animation duration in seconds
    modalView.center = middleCenter;
    [UIView commitAnimations];
}

- (IBAction)hideModal
{    
    CGSize offSize = [UIScreen mainScreen].bounds.size;
    CGPoint offScreenCenter = CGPointMake(offSize.width / 2.0, -300);
    [UIView beginAnimations:nil context:[self view]];
    [UIView setAnimationDuration:0.9];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(hideModalEnded:finished:context:)];
    [self view].center = offScreenCenter;
    [UIView commitAnimations];
}
                                          
- (void) hideModalEnded:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{    
    UIView* modalView = (UIView *)context;
    [modalView release];



출처 : http://blog.naver.com/PostView.nhn?blogId=suny4rang&logNo=50084523871
Posted by 오늘마감

댓글을 달아 주세요