button、label、textfield、页面跳转、传值
.AppDelegate.m #import “OneViewController.h”
//一打开就运行的
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen]bounds]];
OneViewController *oneController = [[OneViewController alloc] init];
[self.window setRootViewController:oneController];
[self.window makeKeyAndVisible];
return YES;
} .OneViewController.m #import “TwoViewController.h”
-(void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor orangeColor]; [self OneButton];
}
//添加button
#pragma mark – Button
-(void)OneButton
{
UIButton *myButton = [[UIButton alloc] init];
myButton.frame = CGRectMake(,300,90,35);
myButton.backgroundColor = [UIColor grayColor];
[myButton setTitle:”确定” forState:UIControlStateNormal];
[self.view.addSubview:myButton];
//addSubview: 添加一个视图对接收者的子视图列表。
[myButton addTarget:self action:@selector(ClickMyButton) forControlEvents:UIControlEventTouchUpInside];
//addTarget: 将目标对象和动作方法与控制关联。
}
//Button点击事件
#pragma mark - Button
-(void)ClickButton
{
TwoViewController *two = [[TwoViewController alloc] init];
//跳转到下一页面
[self presentViewController:two animated:YES completion:nil];
}
//跳转到上一页面
[self dismissViewControllerAnimated:YES completion:nil]; .Label [self label1]; -(void)Label
{
UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(,,,)];
label1.backgroundColor = [UIColor whiteColor];
label1.text = @”显示”;
label1.textColor = [UIColor blackColor];
[self.view addSubview:label1];
} .TextField [self _text]; -(void)TextField
{
_text = [[UITextField alloc] initWithFrame:CGRectMake(,,,)];
_text.borderStyle = UITextBorderStyleRoundedRect;
_text.backgroundColor = [UIColor whiteColor];
_text.placeholder = @”请输入密码”;
_text.textColor = [UIColor blackColor];
_text.keyboardType = UIKeyboardTypeDefault;
_text.returnKeyType = UIReturnKeyGo;
[self.view addSubview:_text];
}
button、label、textfield、页面跳转、传值的更多相关文章
- iOS 页面跳转传值,属性传值,代理传值,代码块传值,单例传值,通知传值
有时候我们在页面跳转的时候回传递相应的参数,如,你想把在第一个页面的文本框里的内容显示在第二个文本框中,或者你又想把第二个文本框中的内容改变之后到第一个页面的文本框中,所有,这个时候我们就要用到页面跳 ...
- UWP 页面跳转传值
如果涉及到页面跳转,一般用Frame这个控件来管理不同的页面. <Grid Name="RootGrid"> <Frame Name="RootFram ...
- storyboard页面跳转传值
受学姐的影响,习惯纯代码编程,这次要修改别人的代码,很多编程风格还不习惯. 在此之前,页面跳转我都用的是Navigation,故事板上的页面跳转带传值,让我卡了好半天. 页面跳转: [self per ...
- MUI框架开发HTML5手机APP(二)--页面跳转传值&底部选项卡切换
概 述 JRedu 在上一篇博客中,我们学习了如何使用Hbuilder创建一个APP,同时如何使用MUI搭建属于自己的第一款APP,没有学习的同学可以戳链接学习: http://www.cnblo ...
- PHP页面跳转传值的三种常见方式
一. POST传值 post传值是用于html的<form>表单跳转的方法,很方便使用.例如: ? 1 2 3 4 5 6 7 <html> <form action ...
- 点击Button按钮实现页面跳转
1.首先我们新建一个带有button按钮的页面 <button type="submit" class="form-contrpl">注册</ ...
- ionic4 页面跳转传值和新页面取值
页面跳转 : <ion-row *ngFor="let item of aboutData.stockData" [routerLink]="[ '/stock-d ...
- asp.net 页面跳转传值的几种方式
参考地址: http://blog.csdn.net/zzzzzzzert/article/details/8486143 protected void Button1_Click(object se ...
- .Net中几种常见的页面跳转传值方法
1.ASP Server对象Execute方法 ASP Server对象的Execute方法可以在执行当前页面的过程中将另一个页面执行结果的内容插入到当前页面的输出中.Execute方法带一个参数,是 ...
- 微信小程序——页面跳转传值
比如从index.wxml跳转到aaa.wxml index.wml <navigator url="../aaa/aaa?id=1" > </navigator ...
随机推荐
- 8.openssl req
数字证书申请和生成工具.也可以为根CA自行签署证书. 该命令中很多值.属性.格式或默认值都在config文件openssl.cnf中指定. [root@xuexi ~]# man req NAME r ...
- 数组中第K小的数字(Google面试题)
http://ac.jobdu.com/problem.php?pid=1534 题目1534:数组中第K小的数字 时间限制:2 秒 内存限制:128 兆 特殊判题:否 提交:1120 解决:208 ...
- sga_target大于sga_max_size数据库无法启动
环境:oracle 11g 单机 操作过程:由于修改SGA的大小,只修sga_max_size,没有修改sga_target,改导sga_max_size大于sga_target的大小,使得数据库无法 ...
- 一个页面中显示多个button时总行数计算公式。
总行数 = (按钮总数 + 每一行按钮数 - 1) / 每一行按钮数. 同理.假设我们要显示一定总数的item.每页固定数量,则总页数为. 总页数 = (总显示数量 + 每页显示的数量 - 1) / ...
- dma_ops
kernel中的dma缓存区管理层操作统一实现在 struct dma_map_ops 中: dma缓存区分配函数的具体实现参考: http://www.aichengxu.com/view/599 ...
- SVN冲突解决:当次提交的和上次提交的出现冲突
转载于知蚁博客,文章地址:http://www.letuknowit.com/archives/svn-conflict-resolution 看到那个*了吧,出现这个标记就说明本地副本的文件已经过期 ...
- 关于有偿提供拼图响应式后台的通知---------pintuer ui的官方通知(www.pintuer.com)
拼图响应式前端框架版响应式后台正式发布. 考虑到目前拼图的状况,我们不打算免费开放下载,但也不会收各位朋友1分钱,该版后台将有偿提供给各位给予拼图贡献的朋友. 废话不多说,一切皆以有图有真相,下面上图 ...
- windows与linux之间文件的传输方式总结(转)
当然,windows与linux之间文件的传输的两种方式有很多,这里就仅仅列出工作中遇到的,作为笔记: 方法一:安装SSH Secure Shell Client客户端 安装即可登录直接拖拉到linu ...
- Storyboard中segue(转场)使用
源引:http://www.2cto.com/kf/201210/161737.html 一.视图切换类型介绍在storyboard中,segue有几种不同的类型,在iphone和ipad的开发中,s ...
- A*搜索
1,从点A开始,并且把它作为待处理点存入一个"开启列表".开启列表就像一张购物清单.尽管现在列表里只有一个元素,但以后就会多起来.你的路径可能会通过它包含的方格,也可能不会.基本上 ...