• 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

   1  -	(void)
   2  viewWillAppear:(BOOL)p
   3  {	[	NSNotificationCenter.defaultCenter
   4  		addObserverForName:UIKeyboardWillShowNotification
   5  		object:self.view.window
   6  		queue:nil
   7  		usingBlock:^( NSNotification* p )
   8  		{	[	UIView
   9  				animateWithDuration:[ [ p.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey ] doubleValue ]
  10  				animations:
  11  				^{	self.view.frame = CGRectMake
  12  					(	self.view.frame.origin.x
  13  					,	self.view.frame.origin.y
  14  					,	self.view.frame.size.width
  15  					,	self.view.frame.size.height - [ [ p.userInfo objectForKey:UIKeyboardFrameEndUserInfoKey ] CGRectValue ].size.height
  16  					);
  17  
  18  				}
  19  			];
  20  		}
  21  	];
  22  	[	NSNotificationCenter.defaultCenter
  23  		addObserverForName:UIKeyboardWillHideNotification
  24  		object:self.view.window
  25  		queue:nil
  26  		usingBlock:^( NSNotification* p )
  27  		{	[	UIView
  28  				animateWithDuration:[ [ p.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey ] doubleValue ]
  29  				animations:
  30  				^{	self.view.frame = CGRectMake
  31  					(	self.view.frame.origin.x
  32  					,	self.view.frame.origin.y
  33  					,	self.view.frame.size.width
  34  					,	self.view.frame.size.height + [ [ p.userInfo objectForKey:UIKeyboardFrameEndUserInfoKey ] CGRectValue ].size.height
  35  					);
  36  
  37  				}
  38  			];
  39  		}
  40  	];
  41   }
  42  
  43  -	(void)
  44  viewDidDisappear:(BOOL)p
  45  {	[ NSNotificationCenter.defaultCenter removeObserver:self ];
  46  }
  47  
  48  

posted by Face Saturn on Tue 20 Aug 2013 at 13:58

Comments:

or Preview
Social Bookmarks
  • Delicious
  • B_entry2321
  • Clip_16_12_w
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ