浅谈 iOS设计之多视图—模态视图的基本操作
#import <UIKit/UIKit.h>
#import "FirstViewController.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window.backgroundColor=[UIColor grayColor];
return YES;
@interface FirstViewController ()
@end
@implementation FirstViewController
- (void)viewDidLoad {
self.Button.backgroundColor=[UIColor redColor];
[self.Button setTitle:@"Next" forState:UIControlStateNormal];
//调用方法实现进入下一页面
[self.Button addTarget:self action:@selector(nextPage) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.Button];
-(void)nextPage
{
SecondViewController *secondVc=[[SecondViewController alloc]init];
[self presentViewController:secondVc animated:YES completion:^{
NSLog(@"欢迎进入本页面");
}];
}
[super didReceiveMemoryWarning];
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
#import <UIKit/UIKit.h>
#import "ThirdViewController.h"
@interface SecondViewController : UIViewController
@property(strong,nonatomic)UIButton *Button;
#import "SecondViewController.h"
@interface SecondViewController ()
@end
@implementation SecondViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor=[UIColor yellowColor];
//返回按钮
self.Button=[[UIButton alloc]initWithFrame:CGRectMake(100, 200, 50, 50)];
[self.Button setTitle:@"Back" forState:UIControlStateNormal];
[self.Button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//调用方法实现返回上一页
[self.Button addTarget:self action:@selector(textFrontPage) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.Button];
//进入下一页的按钮
self.Button=[[UIButton alloc]initWithFrame:CGRectMake(200, 200, 50, 50)];
[self.Button setTitle:@"Next" forState:UIControlStateNormal];
[self.Button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//调用方法实现进入下一页
[self.Button addTarget:self action:@selector(nextPage) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.Button];
}
//返回上一页的方法
-(void)textFrontPage
{
[self dismissViewControllerAnimated:YES completion:^{
NSLog(@"front page show");
}];
}
-(void)nextPage
{
ThirdViewController *thirdVC=[[ThirdViewController alloc]init];
[self presentViewController:thirdVC animated:YES completion:^{
NSLog(@"欢迎进入本页");
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
#import <UIKit/UIKit.h>
#import "FirstViewController.h"
@interface ThirdViewController : UIViewController
@property(strong,nonatomic)UIButton *Button;
#import "ThirdViewController.h"
@interface ThirdViewController ()
@end
@implementation ThirdViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor=[UIColor blueColor];
//返回按钮
self.Button=[[UIButton alloc]initWithFrame:CGRectMake(100, 200, 50, 50)];
[self.Button setTitle:@"Back" forState:UIControlStateNormal];
[self.Button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//调用方法实现返回上一页
[self.Button addTarget:self action:@selector(textFrontPage) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.Button];
//进入首页按钮
self.Button=[[UIButton alloc]initWithFrame:CGRectMake(200, 200, 50, 50)];
[self.Button setTitle:@"Next" forState:UIControlStateNormal]; ;
[self.Button setTitleColor:[UIColor redColor ] forState:UIControlStateNormal];
//调用方法实现进入首页
[self.Button addTarget:self action:@selector(nextPage) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.Button];
}
//返回方法
-(void)textFrontPage
{
[self dismissViewControllerAnimated:YES completion:^{
NSLog(@"Front page show");
}];
}
//进入下一页的方法
-(void)nextPage
{
FirstViewController *firstVc=[[FirstViewController alloc]init];
[self presentViewController:firstVc animated:YES completion:^{
NSLog(@"欢迎进入本页");
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
转载于:https://www.cnblogs.com/guiyangxueyuan/p/5276875.html
浅谈 iOS设计之多视图—模态视图的基本操作相关推荐
- 浅谈ios设计之使用表格UITableVIew设计通讯录的方法
思路:首先自作一份或者网上下载一份通讯录的 plist 文件 之后创建工程和显示通讯录的表格 代码实现如下(全部代码) 1.创建导航栏和根视图 AppDelegate.h #import &l ...
- 浅谈iOS和Android后台实时消息推送的原理和区别
http://www.52im.net/thread-286-1-1.html 前言 iOS和Android上的实时消息推送差异很大,往小了说是技术实现的差异,往大了说是系统实现理念的不同.实时消息推 ...
- iOS实录15:浅谈iOS Crash
导语:在当前的iOS开发中,虽然ARC为开发者解决了手动内存管理时代 的许多麻烦,但是内存方面的问题依然是产生iOS Crash的元凶之一,本文介绍内存方面,有关僵尸对象.野指针.内存泄漏.废弃内存这 ...
- 浅谈数据库设计技巧(上)
浅谈数据库设计技巧(上) 说到数据库,我认为不能不先谈数据结构.1996年,在我初入大学学习计算机编程时,当时的老师就告诉我们说:计算机程序=数据结构+算法.尽管现在的程序开发已由面向过程为主逐步过渡 ...
- 中鸣循迹机器人_浅谈机器人设计方法
浅谈机器人设计方法 摘要: 机器人是人类完成智能化中非常重要的工具, 随着时代的发展, 机器 人已经在世界有了一定的发展,甚至很多国家机器人已经运用到实际的生活中 去. 而机器人的设计方法无疑是很多人 ...
- 浅谈工厂设计--java必备技能
浅谈工厂设计–java必备技能 说到工厂,我就联想到了亚洲的大工厂富士康–接过订单然后按照固定的模板生产商品,其实java中工厂类中的工厂方法也是一样,接过参数,根据参数来生产需要的商品: 今天我们一 ...
- 浅谈购物中心设计之外立面设计注意点
购物中心的主体定位中,可以通过外立面设计充分的发挥和展现个性,吸引八方游客,从而使购物中心的商圈辐射超越了地区的界限.具体来说,购物中心外立面设计需要注意哪些方面呢?我们今天就来浅谈购物中心设计之外立 ...
- 计算机中用户的分类有哪些,用户分类浅谈交互设计 -电脑资料
说到网络产品,离不开的话题就是用户,就像传统行业的消费者, 不分类不好定位, 好的用户分类让我知道了我在追求哪些人,满足哪些人,影响哪些人.但分不好类又会错位,更糟,那怎样才能对某一款产品的用户群进行 ...
- [UWP]浅谈按钮设计
一时兴起想谈谈UWP按钮的设计. 按钮是UI中最重要的元素之一,可能也是用得最多的交互元素.好的按钮设计可以有效提高用户体验,构造让人眼前一亮的UI.而且按钮通常不会影响布局,小小的按钮无论怎么改也不 ...
- 我的家乡网页设计_Graphic Design|康石石浅谈LOGO设计在作品集中的创作方法
写在前面的话 平面设计范畴极广,其领域不仅限于常见的版式设计.海报设计.LOGO设计.VI设计.书籍装帧.广告设计.网页设计.在艺术留学申请过程中,学习平面设计的同学们需依据目标院校对作品集项目及页数 ...
最新文章
- 面对千亿客服市场:曾经人工当道,如今AI为王
- 【阿里云总监课第四期】时髦的云原生应用怎么写?
- ORACLE相关的SHELL编程
- 算法系列之使用赫夫曼编码的实战应用【对文件进行压缩、解压缩】
- fileinput 时间_JavaScript_Bootstrap Fileinput文件上传组件用法详解,最近时间空余,总结了一些关...
- xxl-job 2.1.1执行器源码解读
- Python创建简单的HTTP服务
- ReportViewer教程(11)-给报表特定的内容设置颜色
- spark 字符串操作
- 尝试搭建Apache+Tomcat负载均衡
- [转]使用.NET实现断点续传
- android基于xposed框架,学习笔记:Android Xposed 框架入门
- 专升本英语:可数名词变复数规则
- 电子设计(1)二极管防电源反接电路
- 【应用宝】腾讯应用宝 上线APP为什么上线了 无法在应用宝搜索到(解决方法)
- 斗地主手牌最少手数的搜索
- 2022年卡塔尔世界杯的“科技与狠活”
- c语言butter函数,butter函数
- 使用android.view.TouchDelegate扩大View的触摸点击区域
- python判断数字位数_python求数字位数的方法
热门文章
- 重新认识margin-top和margin-bottom
- 时间操作(JavaScript版)—最简单比较两个时间格式数据的大小
- 排序算法之二 插入排序(C++版本)
- 27. Minimize casting
- @data注解_SpringBoot入门实践(七)-Spring-Data-JPA实现数据访问
- CountDownLatch类使用api
- (day 42 - 字符翻转 ) 剑指 Offer 58 - II. 左旋转字符串
- 服务器配置文件设计,IM配置服务器概要的设计文件.doc
- 看我如何解决tomcat控制台内容输出乱码的问题?
- Java应用服务器对比:TomcatJettyGlassFishWildFly