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 ...
随机推荐
- Quartus II中的Waring(转)
1.Found clock-sensitive change during active clock edge at time <time> on register "<n ...
- shared memory realm does not exist
有天启动ORACLE,碰到如下问题 提示ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist 解决 ...
- myBatis,Spring,SpringMVC三大框架ssm整合模板
整合步骤 创建web工程 导入整合所需的所有jar包 编写各层需要的配置文件 1) mybatis的全局配置文件 <configuration> <!-- 批量别名的设置 -- ...
- object to 字符串json
package com.beijxing.TestMain; import com.beijxing.entity.Student; import com.google.gson.Gson; impo ...
- liToSpan
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>& ...
- npm 换源
npm config set registry https://registry.npm.taobao.org
- docker安装
系统要求:需要一个64位的centos7操作系统和版本3.10或更高版本的Linux内核 开始安装: uname -r //查看内核版本yum -y update //更新系统更新到最新 #安装d ...
- WeakHashMap回收时机
import java.util.ArrayList; import java.util.List; import java.util.WeakHashMap; public class TestWe ...
- Spring bean 实现初始化、销毁方法的方式及顺序
Spring 允许 Bean 在初始化完成后以及销毁前执行特定的操作,常用方法有三种: 使用注解,在指定方法上加上@PostConstruct或@PreDestroy注解来制定该方法是在初始化之后还是 ...
- c程序中出现segment error 和 bus error 的原因
在c程序中,经常会遇到段错误(segment error)和总线错误(bus error),这两种问题出现的原因可能如下 段错误: 对一个NULL指针解引用. 访问程序进程以外的内存空间. 实际上,第 ...