IOS起航 UI初级 窗体跳转 代理传值
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了IOS起航 UI初级 窗体跳转 代理传值,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2669字,纯文字阅读大概需要4分钟。
内容图文
![IOS起航 UI初级 窗体跳转 代理传值](/upload/InfoBanner/zyjiaocheng/1088/0d7eb4cea9594b9ca0f947d61b0edbfa.jpg)
// // ViewController.m // viewControllerTrans // // Created by 徐坤坤 on 15/6/5. // Copyright (c) 2015年 hr. All rights reserved. // #import "ViewController.h" #import "textBoxView.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; UILabel *label=[[UILabel alloc] initWithFrame:CGRectMake(50, 50, 80, 80)]; label.text=@"Welcome to China"; label.textColor=[UIColor redColor]; [label setTextAlignment:NSTextAlignmentCenter]; UIButton *btn=[[UIButton alloc] initWithFrame:CGRectMake(80, 100, 100, 120)]; [btn setTitle:@"Hello" forState:UIControlStateNormal]; [btn addTarget:self action:@selector(changeView:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:label]; [self.view addSubview:btn]; // Do any additional setup after loading the view, typically from a nib. } -(void) changeView:(UIButton *)btn { NSLog(@"Welcome!"); textBoxView *tbView=[[textBoxView alloc]init]; [self presentModalViewController:tbView animated:YES]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end
// // textBoxView.m // viewControllerTrans // // Created by 徐坤坤 on 15/6/5. // Copyright (c) 2015年 hr. All rights reserved. // #import "textBoxView.h" @interface textBoxView () { UITextField *txt; } @end @implementation textBoxView - (void)viewDidLoad { [super viewDidLoad]; txt=[[UITextField alloc] initWithFrame:CGRectMake(50, 50, 100, 100)]; txt.textColor=[UIColor redColor]; txt.text=@"IOS"; UIButton *btn=[[UIButton alloc]initWithFrame:CGRectMake(50, 120, 100,140)]; [btn addTarget:self action:@selector(showMessage:) forControlEvents:UIControlEventTouchUpInside]; [btn setTitle:@"OK" forState:(UIControlStateNormal)]; [self.view addSubview:btn]; [self.view addSubview:txt]; // Do any additional setup after loading the view. } - (void)setValue:(NSString *)value { } -(void)showMessage:(UIButton *)btn { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示" message:txt.text delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]; NSLog(@"alert"); [alert show]; //[alert release]; // txt.text; } - (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. } */ @end
原文:http://www.cnblogs.com/MacKun/p/4555798.html
内容总结
以上是互联网集市为您收集整理的IOS起航 UI初级 窗体跳转 代理传值全部内容,希望文章能够帮你解决IOS起航 UI初级 窗体跳转 代理传值所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。