容器视图控制器控件视图控制器的滚动视图

时间:2013-11-03 03:05:59

标签: ios objective-c xcode

我有一个ViewController,在ViewController中有一个滚动视图,而滚动视图包含两个Container View。在底部Container有两个文本字段。键盘时如何使滚动视图向上移动?感谢。

这是我的追求。 enter image description here

ViewContrller.h

@interface ViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIScrollView *scroll_view;
@end

ViewController.m

#import "ViewController.h"
#import "ControlXYViewController.h"
#import "FirstSubViewController.h"

@interface ViewController ()

@property (weak ,nonatomic) FirstSubViewController *first_sub_view;
@property (weak, nonatomic) ControlXYViewController *control_xy_view;
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.control_xy_view.fs = self.first_sub_view;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"control_xy_view"]) {
        self.control_xy_view = segue.destinationViewController;
    }
    else if ([segue.identifier isEqualToString:@"first_sub_view"]) {
        self.first_sub_view = segue.destinationViewController;
    }
}

ControllerXYViewController.h

#import <UIKit/UIKit.h>
#import "ViewController.h"
#import "FirstSubViewController.h"

@interface ControlXYViewController : UIViewController<UITextFieldDelegate>

@property (strong, nonatomic) UIView *add_view;
@property (weak, nonatomic) IBOutlet UITextField *inputX;
@property (weak, nonatomic) IBOutlet UITextField *inputY;
@property (weak, nonatomic) ViewController *vc;
@property (weak, nonatomic) FirstSubViewController *fs;

@end

ControllerXYViewController.m

-(void)textFieldDidBeginEditing:(UITextField *)textField
{

}

0 个答案:

没有答案