1. 程式人生 > >[iOSB]簡單TabBar並跳轉其它.storyboard檔案

[iOSB]簡單TabBar並跳轉其它.storyboard檔案

#import "HomeViewController.h"

@interface HomeViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textField;

@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (IBAction)tapMsgAction:(id)sender {
    UIStoryboard *mainSB = [UIStoryboard storyboardWithName:@"MsgStoryboard" bundle:nil];
    MsgViewController *msgVC = [mainSB instantiateViewControllerWithIdentifier:@"msg_sb"];
    msgVC.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:msgVC animated:YES];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    NSString *inputText = _textField.text;
    ValueViewController *sendVC = segue.destinationViewController;
    if ([sendVC respondsToSelector:@selector(setDataDict:)]) {
        NSDictionary *tempDict = [[NSDictionary alloc] initWithObjectsAndKeys:inputText,@"input", nil];
        [sendVC setValue:tempDict forKey:@"dataDict"];
    }
}

@end
#import "ValueViewController.h"

@interface ValueViewController ()
@property (weak, nonatomic) IBOutlet UILabel *valueLab;

@end

@implementation ValueViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _valueLab.text = [self.dataDict objectForKey:@"input"];
}

@end