iOS的UI开发中Modal的使用与主流应用UI结构介绍

2020-01-14 17:53:21丽君

    YYtwoViewController *two=(YYtwoViewController *)nav.topViewController;
    //传递数据
    two.name=@"文顶顶";
}
@end


YYtwoViewController.h文件
复制代码
//
//  YYtwoViewController.h
//  02-模态窗口的数据传递
//
//  Created by apple on 14-6-9.
//  Copyright (c) 2014年 itcase. All rights reserved.
//

 

#import <UIKit/UIKit.h>

@interface YYtwoViewController : UIViewController
@property(nonatomic,copy)NSString *name;
@end

YYtwoViewController.m文件

//
//  YYtwoViewController.m
//  02-模态窗口的数据传递
//
//  Created by apple on 14-6-9.
//  Copyright (c) 2014年 itcase. All rights reserved.
//

#import "YYtwoViewController.h"

@interface YYtwoViewController ()
@property (weak, nonatomic) IBOutlet UILabel *nametext;

@end


复制代码
@implementation YYtwoViewController

 


- (void)viewDidLoad
{
    [super viewDidLoad];
    self.nametext.text=self.name;
    
    //为导航栏添加一个返回按钮
    self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(black)];
}

-(void)black
{
    //移除模态窗口
    [self dismissViewControllerAnimated:YES completion:^{
        NSLog(@"成功移除!");
    }];
}
@end

 


APP主流UI框架结构

一、简单示例

说明:使用APP主流UI框架结构完成简单的界面搭建

搭建页面效果:

iOS的UI开发中Modal的使用与主流应用UI结构介绍