IOS UI 第四篇:基本UI
ViewController 应用
secondViewController *secVC = [[secondViewController alloc] initWithNibName:@"secondViewController" bundle:nil];
NSLog(@"success ");
}];
}
[self dismissViewControllerAnimated:YES completion:^{
NSLog(@"dismiss");
}];
}
[super viewWillAppear:animated];
NSLog(@"view will appear");
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
NSLog(@"view did appear");
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
NSLog(@"view will disappear");
}
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
NSLog(@"view did disappear");
}
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
UIModalPresentationPageSheet,
UIModalPresentationFormSheet,
UIModalPresentationCurrentContext,
#endif
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0
UIModalPresentationCustom,
UIModalPresentationNone = -1,


@interface Xib_1 : UIViewController
@property (nonatomic, weak) UserModel *model;
-(void)sentRegistMessage:(UserModel *)user;
@end
Xib_2 *xib2 = [[Xib_2 alloc] initWithNibName:@"Xib_2" bundle:nil];
xib2.parentVC = self;
xib2.modalTransitionStyle = UIModalPresentationPageSheet;
[self presentViewController:xib2 animated:YES completion:^{
}];
}
self.Label_1.text = [NSString stringWithFormat:@"恭喜,注册成功,用户名:%@,密码:%@,请牢记,谢谢合作。", user.name, user.pass];
self.Label_1.numberOfLines = 0;
}
@property (nonatomic, weak) Xib_1 *parentVC;
@end
UserModel *model = [[UserModel alloc] init];
model.name = _nameLabel.text;
model.pass = _passLabel.text;
[self.parentVC sentRegistMessage:model];
[self dismissViewControllerAnimated:YES completion:^{
}];
}
@property (nonatomic, copy)NSString *name;
@property (nonatomic, copy)NSString *pass;
@end
UIView *redView;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//动画
redView=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
redView.backgroundColor=[UIColor redColor];
[self.window addSubview:redView];
UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:@"开始动画" forState:UIControlStateNormal];
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button addTarget:self action:@selector(startAnim:) forControlEvents:UIControlEventTouchUpInside];
button.frame=CGRectMake(100, 400, 100, 44);
[self.window addSubview:button];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
-(void)startAnim:(id)sender{
[UIView animateWithDuration:1 animations:^{
redView.frame=CGRectMake(100, 300, 150, 150);//大小位置
redView.transform=CGAffineTransformMakeRotation(M_PI_4);//角度
} completion:^(BOOL finished) {
if (finished) {
[UIView animateWithDuration:2 animations:^{
redView.transform=CGAffineTransformIdentity;//把变形还原
redView.frame=CGRectMake(100, 100, 100, 100);
}];
}
}];
}

{
[super viewDidLoad];
[self begin];
// Do any additional setup after loading the view from its nib.
}
-(void)begin
{
imageView_3 = [[UIImageView alloc] initWithFrame:CGRectMake(30, 50, 100, 150)];
imageView_2 = [[UIImageView alloc] initWithFrame:CGRectMake(200, 50, 100, 150)];
imageView_1 = [[UIImageView alloc] initWithFrame:CGRectMake(80, 110, 140, 200)];
imageView_1.image = [UIImage imageNamed:[NSString stringWithFormat:@"1.jpg"]];
imageView_2.image = [UIImage imageNamed:[NSString stringWithFormat:@"2.jpg"]];
imageView_3.image = [UIImage imageNamed:[NSString stringWithFormat:@"3.jpg"]];
[_Subview addSubview:imageView_1];
[_Subview addSubview:imageView_2];
[_Subview addSubview:imageView_3];
[_Subview bringSubviewToFront:imageView_1];
}
- (IBAction)PrePress:(id)sender {
[UIView animateWithDuration:1 animations:^{
[_Subview sendSubviewToBack:imageView_3];
imageView_1.frame = CGRectMake(30, 50, 100, 150);
imageView_2.frame = CGRectMake(80, 110, 140, 200);
imageView_3.frame = CGRectMake(200, 50, 100, 150);
}completion:^(BOOL finished) {
//imageView_2.frame = CGRectMake(30, 50, 100, 150);
[_Subview bringSubviewToFront:imageView_2];
UIImageView *tmp;
tmp = imageView_1;
imageView_1 = imageView_2;
imageView_2 = imageView_3;
imageView_3 = tmp;
}];
}
- (IBAction)NextPress:(id)sender {
[UIView animateWithDuration:1 animations:^{
[_Subview sendSubviewToBack:imageView_2];
imageView_1.frame = CGRectMake(200, 50, 100, 150);
imageView_2.frame = CGRectMake(30, 50, 100, 150);
imageView_3.frame = CGRectMake(80, 110, 140, 200);
}completion:^(BOOL finished) {
imageView_2.frame = CGRectMake(30, 50, 100, 150);
[_Subview bringSubviewToFront:imageView_3];
UIImageView *tmp;
tmp = imageView_1;
imageView_1 = imageView_3;
imageView_3 = imageView_2;
imageView_2 = tmp;
}];
}
IOS UI 第四篇:基本UI的更多相关文章
- 环信 之 iOS 客户端集成四:集成UI
在Podfile文件里加入 pod 'EaseUI', :git => 'https://github.com/easemob/easeui-ios-cocoapods.git' 然后在终端中的 ...
- 环信 之 iOS 客户端集成四:集成UI 之 会话列表
1. 初始化 EaseConversationListViewController *chatListVC = [[EaseConversationListViewController alloc] ...
- IOS设计模式第四篇之装饰设计模式的类别设计模式
装饰设计模式 装饰设计模式动态的添加行为和责任向一个对象而不修改他的任何代码.他是你子类化修改类的行为用通过另一个对象的包装的代替方法. 在Objective-c里面有很多这种设计模式的实现,像cat ...
- UGUI的优点新UI系统四 开源
UGUI的优点新UI系统四 开源 新UI系统是开源的,所以开发者可以看到新UI系统实现的源码,并加以修改和使用. 开源授权协议——MIT/X11 Unity所搭载的新UI系统,是在开源授权协议MIT/ ...
- iOS进阶指南试读之UI篇
iOS进阶指南试读之UI篇 UI篇 UI是一个iOS开发工程师的基本功.怎么说?UI本质上就是你调用苹果提供给你的API来完成设计师的设计.所以,想提升UI的功力也很简单,没事就看看UIKit里的各个 ...
- 四核驱动的三维导航—淘宝新UI(设计篇)
前面有一篇博客说到了淘宝UWP的"四核驱动的三维导航—淘宝新UI(需求分析篇)",花了两周的时间实现了这个框架,然后又陆陆续续用了三周的时间完善它. 多窗口导航,与传统的导航方式的 ...
- IOS UI 第八篇:基本UI
实现图片的滚动,并且自动停止在每张图片上 - (void)viewDidLoad{ [super viewDidLoad]; UIScrollView *scrollView = [[U ...
- Android异步处理系列文章四篇之一使用Thread+Handler实现非UI线程更新UI界面
目录: Android异步处理一:使用Thread+Handler实现非UI线程更新UI界面Android异步处理二:使用AsyncTask异步更新UI界面Android异步处理三:Handler+L ...
- 游戏模块分析总结(2)之UI、操作篇
转自:http://www.gameres.com/309812.html 游戏模块分析总结(2)之UI.操作篇 发布者: wuye | 发布时间: 2014-12-12 15:03| 评论数: 0 ...
随机推荐
- C#将image中的显示的图片转换成二进制
原文:C#将image中的显示的图片转换成二进制 1.将Image图像文件存入到数据库中 我们知道数据库里的Image类型的数据是"二进制数据",因此必须将图像文件转换成字节数组才 ...
- Maven+struts2+spring4+hibernate4的环境搭建
搭建Maven+struts2+spring4+hibernate4其实并不难!但开始弄的时候还是费了我好大的力气,老是出现这样那样的错误!好了,废话不多说,开始搭建开发环境. 一.Myeclipse ...
- tmp1
program1: Line # Mem usage Increment Line Contents================================================ 2 ...
- webservice发送字符串
假设只是发送一个字符串client,这是很easy,只需要输入xfire包,编写接口,编写的实现方法.变化. 假设你要传输的数组或自定义类.到用于接口准备的需要agexis文件.更复杂. 尝试传输这些 ...
- Middleware详解
Middleware详解 在第1章项目结构分析中,我们提到Startup.cs作为整个程序的入口点,等同于传统的Global.asax文件,即:用于初始化系统级的信息(例如,MVC中的路由配置).本章 ...
- crawler_JVM_DNS_在爬虫中的应用
DNS解析:即由域名 经过dns解析,跳转到真正服务器的地址,这个重复解析的耗时占请求很大比例. 在设计爬虫时比较细粒度的控制下,需要考虑dns解析. jdk从1.5往后对dns缓存有默认设置, 详见 ...
- ArcGIS网络分析之Silverlight客户端最近设施点分析(四)
原文:ArcGIS网络分析之Silverlight客户端最近设施点分析(四) 在上一篇中说了如何实现最近路径分析,本篇将讨论如何实现最近设施点分析. 最近设施点分析实际上和路径分析有些相识,实现的过程 ...
- Java 测试并行编程(三)
有很多其他的交替运行 因为在并行代码中的错误一般是低概率事件.因此,试运行并发差错时需要反复多次,但是,有很多方法可以提高发现这些错误的概率 ,在前面提到的,在多处理器系统.假设 线程的数量,那么 与 ...
- css优先级计算规则
原文:css优先级计算规则 最近面试了一些求职者,我问css优先级计算规则是怎样的?答曰ID优先级>class>元素选择器,外联样式优先级低于内联样式,内联样式优先级低于行间样式,然后就没 ...
- Mobile开发的饕餮盛宴-Zoomla!波CMS2 x2.1正式宣布
饕餮 [tāo tiè] 古代汉族神话传说中龙的第五子,是一种存在于传说.想象的神奇怪兽. 古书<山海经>介绍其特点是:其形状如羊身人面,其目在腋下,虎齿人爪.其音如婴儿. 作为中国本土软 ...