티스토리 뷰
example.h
-(void)keyboardWillShow:(NSNotification *)notice;
example.m
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
if (textfield instance == textField) {
[nameTextField resignFirstResponder];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
CGRect rect = self.view.frame;
rect.origin.y += 100;
rect.size.height -=100;
self.view.frame = rect;
[UIView commitAnimations];
return YES;
}
}
//view 올리기
-(void)keyboardWillShow:(NSNotification *)notice{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
CGRect rect = self.view.frame;
rect.origin.y = -=100;
rect.size.height += 100; //-100 + 100 = 0
self.view.frame = rect;
[UIView commitAnimations];
}
-(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];
}
<출처: 프리렉 아이폰 프로그래밍 가이드>
'STUDY > Objective-C' 카테고리의 다른 글
XCode 3 -> XCode 4 사용시 Localizable.strings 적용 안되는 문제. How to Use Localizable.strings (0) | 2011.07.08 |
---|---|
[Objective-C] 인스턴스 초기화 코드 (0) | 2011.01.22 |
[개발일지] (0) | 2010.10.25 |
[개발일지]중간부터 시작. (0) | 2010.10.06 |
UIPickerView 구현시 필수 소스 (0) | 2010.10.03 |
- Total
- Today
- Yesterday
- windows
- Java
- html5
- 석양
- MAC
- mysql
- 사진
- Apple Store
- 한빛비즈
- 보안
- Canon 40D
- jQuery
- ipod touch
- Objective C
- 리뷰
- 1일 1포스팅
- linux
- review
- cassandra
- HTML
- IIS
- 하늘
- server
- photo
- 한빛리더스
- 잡담
- it
- ruby
- iPhone
- ROR
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |