以下代码用于向上滚动视图。但是,它并没有提高我的视图控制器。我已经调试了代码,它命中了每一行代码,但我的视图控制器。没有上移
//DownViewController.m
-(BOOL) textFieldShouldBeginEditing:(UITextField *)textField
{
if (textField == self.hoursTextField) {
[textField resignFirstResponder];
taggy=self.hoursTextField.tag;
}
if (textField ==self.codeTextField) {
[textField resignFirstResponder];
taggy=self.codeTextField.tag;
}
return YES;
}
- (void)keyboardDidShow:(NSNotification *)notification
{
//Assign new frame to your view
sensorViewController =[[SensorsViewController alloc]initWithNibName:@"SensorsViewController" bundle:[NSBundle mainBundle]];
[sensorViewController setTag:taggy];
}
//SensorsViewController.m
-(void)setTag: (int)tag
{
if(tag==1)
{
a=-80;
[self.view setFrame:CGRectMake(0,a,1030,768)];
}
if(tag==2)
{
a=-260;
[self.view setFrame:CGRectMake(0,a,1030,768)];
}
}