티스토리 뷰

 

1.  textField클릭시 처리
    :view를 하나 만들어서 올리는거처럼 보이게 한다.

- (void)keyboardWillShow:(NSNotification *)notice

{

    [UIView beginAnimations:nil context:NULL];

    [UIView setAnimationDuration:0.3];

    CGRect rect = self.view.frame;

    rect.origin.y -= 215;

    rect.size.height += 215;

    self.view.frame = rect;

    [UIView commitAnimations];

} 

2. 리턴 버튼 클릭시 처리
    :만들어진 view의 y좌표를 조절하여 내리는거처럼 보이게 한다.

- (BOOL)textFieldShouldReturn:(UITextField *)textField{

    [textField resignFirstResponder];

    

    [UIView beginAnimations:nil context:NULL];

    [UIView setAnimationDuration:0.3];

    CGRect rect = self.view.frame;

    rect.origin.y += 215;

    rect.size.height -= 215;

    self.view.frame = rect;

    [UIView commitAnimations];

    

    return YES;

} 

- (void)viewWillAppear:(BOOL)animated{

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:self.view.window];

}


- (void)viewWillDisappear:(BOOL)animated{

    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];

} 

'Object-C,Swift Tip' 카테고리의 다른 글

iOS 개발자 등록에 있어 국내카드로 결제시 인증 실패한 경우  (0) 2011.09.01
숫자만 골라내기  (0) 2011.08.31
block 사용  (0) 2011.08.31
URL이미지 저장  (0) 2011.07.23
ASIHTTPRequest  (0) 2011.05.13
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함