2014년 4월 9일 수요일

UIProgressView의 height 크게하기





- (void)viewDidLoad
{
...
CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 3.0f);
_progressView.transform = transform;


...
}

2014년 4월 7일 월요일

locale에 따라 날짜와 시간 포멧 설정

포멧 문자 참조사이트 :
http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns



NSString *formatString = [NSDateFormatter dateFormatFromTemplate:@"yyyyMMMdahm0s" options:0 locale:[NSLocale currentLocale]];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:formatString];


NSString *todayString = [dateFormatter stringFromDate:[NSDate date]];

addsubview animation

방법 1)

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
                           forView:newView
                             cache:YES];
    [containerView setHidden:NO];
    [containerView addSubview:newView];
    [UIView commitAnimations];


방법 2)
    [UIView transitionWithView: containerView duration:0.5
                       options:UIViewAnimationOptionCurveEaseInOut 
                    animations:^ {
                        [containerView addSubview:newView];
                    } completion:nil];



방법 3)
CATransition *animation = [CATransition animation];
 [animation setDuration:0.2];
 [animation setType:kCATransitionMoveIn];
 [animation setSubtype:kCATransitionFromRight];
    [newView.layer addAnimation:animation forKey:nil];

    [containerView addSubview:newView];

2014년 4월 2일 수요일

bounce popup view 뛰우기




PlaceSearchPopupView *placeSearchPopup = [[PlaceSearchPopupView alloc] initWithFrame:CGRectMake(52, 32, 269, 200)];
    placeSearchPopup.center = CGPointMake(CGRectGetMidX(self.view.frame), CGRectGetMidY(self.view.frame));
    placeSearchPopup.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.1, 0.1);
    [popupView addSubview:placeSearchPopup];
    
    [UIView animateWithDuration:0.2 animations:^{
        placeSearchPopup.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.1 animations:^{
            placeSearchPopup.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.1 animations:^{
                placeSearchPopup.transform = CGAffineTransformIdentity;
            }];
        }];
    }];



2014년 3월 31일 월요일

key value observing



UIViewController.m 파일 안에서

// register observer
    void *context = (__bridge void *)self;
    [self.tableView addObserver:self
                     forKeyPath:@"contentOffset"
                        options:NSKeyValueObservingOptionNew

                        context:context];




#pragma mark - KVO Methods

- (void)observeValueForKeyPath:(NSString *)keyPath
                      ofObject:(id)object
                        change:(NSDictionary *)change
                       context:(void *)context
{
// Make sure we are observing this value.
if (context != (__bridge void *)self) {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
return;
}
    
    if ((object == self.tableView) &&
        ([keyPath isEqualToString:@"contentOffset"] == YES)) {
        [self scrollViewDidScrollWithOffset:self.tableView.contentOffset.y];
    }
}



- (void)scrollViewDidScrollWithOffset:(CGFloat)scrollOffset
{
     // do something
}

2014년 3월 1일 토요일

storyboard 밖에서 storyboard 리소스 호출하기.

MyController is in storyboard.

and

some place in a separate view controller :

  
MyController *controller =
    [[UIStoryboard storyboardWithName:@"Main_iPhone"
                               bundle:NULL] instantiateViewControllerWithIdentifier:@"MyViewController"];
    
[self.navigationController pushViewController:controller animated:YES];

xib 소스에서 storyboard 에 있는 viewcontroller 생성하기



OutUIViewController.xib
OutUIViewController.m
OutUIViewController.h


InUIViewController.m  InUIViewController.h   in Main_