(素材源代码) 猫猫学iOS 之UIDynamic重力、弹性碰撞吸附等现象牛逼Demo
猫猫分享,必须精品
原创文章,欢迎转载。
转载请注明:翟乃玉的博客
地址:http://blog.csdn.net/u013357243
一:效果
二:代码
#import "ViewController.h"
#import "DemoViewController.h"
@interface ViewController ()
{
// 功能名称的数组
NSArray *_functions;
}
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
_functions = @[@"吸附行为", @"推动行为", @"刚性附加行为", @"弹性附加行为", @"碰撞检測"];
}
#pragma mark - 数据源方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return _functions.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// 使用Storyboard建立的UITabeViewController,当中的Cell是已经注冊过的
static NSString *ID = @"Cell";
// 永远都会找到一个单元格,假设缓冲池中没有,会自己主动新建
/**
dequeueReusableCellWithIdentifier 直接查询可重用单元格
dequeueReusableCellWithIdentifier:forIndexPath: 查询“注冊的”可重用单元格,此方法中indexPath本身没实用处
* 强制推断是否注冊了单元格
假设已经注冊过单元格,以上两个方法等效。
假设在StoryBoard中指定了单元格的可重用标示符,单元格的优化将有系统接管,不再须要推断cell == nil
*/
// UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID forIndexPath:indexPath];
// if (cell == nil) {
// NSLog(@"come here");
//
// cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
// }
cell.textLabel.text = _functions[indexPath.row];
return cell;
}
#pragma mark - 代理方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
DemoViewController *controller = [[DemoViewController alloc] init];
// 指定标题
controller.title = _functions[indexPath.row];
controller.function = indexPath.row;
[self.navigationController pushViewController:controller animated:YES];
}
#import "DemoViewController.h"
#import "DemoView.h"
#import "SnapView.h"
#import "PushView.h"
#import "AttachmentView.h"
#import "SpringView.h"
#import "CollisionView.h"
@interface DemoViewController ()
@end
@implementation DemoViewController
//- (void)loadView
//{
// self.view = [[DemoView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
//}
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"功能代号: %d", self.function);
// 在此依据实际的功能代号载入实际的视图
DemoView *demoView = nil;
switch (self.function) {
case kDemoFunctionSnap:
demoView = [[SnapView alloc] initWithFrame:self.view.bounds];
break;
case kDemoFunctionPush:
demoView = [[PushView alloc] initWithFrame:self.view.bounds];
break;
case kDemoFunctionAttachment:
demoView = [[AttachmentView alloc] initWithFrame:self.view.bounds];
break;
case kDemoFunctionSpring:
demoView = [[SpringView alloc] initWithFrame:self.view.bounds];
break;
case kDemoFunctionCollision:
demoView = [[CollisionView alloc] initWithFrame:self.view.bounds];
break;
default:
break;
}
[self.view addSubview:demoView];
}
@end
主要框框就这样啦。贴出了的代码只部分
三:素材代码下载地址
代码上传中。
。
(素材源代码) 猫猫学iOS 之UIDynamic重力、弹性碰撞吸附等现象牛逼Demo的更多相关文章
- AJ学IOS 之UIDynamic重力、弹性碰撞吸附等现象
AJ分享,必须精品 一:效果 重力和碰撞 吸附现象 二:简介 什么是UIDynamic UIDynamic是从iOS 7开始引入的一种新技术,隶属于UIKit框架 可以认为是一种物理引擎,能模拟和仿真 ...
- (素材源代码)猫猫学IOS(四)UI之半小时搞定Tom猫
下载地址:http://download.csdn.net/detail/u013357243/8514915 以下是执行图片展示 制作思路以及代码解析 猫猫学IOS(四)UI之半小时搞定Tom猫这里 ...
- (素材源代码) 猫猫学IOS(五)UI之360等下载管理器九宫格UI
猫猫分享,必须精品 先看效果 代码学习地址: 猫猫学IOS(五)UI之360等下载管理器九宫格UI 猫猫学IOS(五)UI之360等下载管理器九宫格UI http://blog.csdn.net/u0 ...
- 猫猫学iOS 之微博项目实战(2)微博主框架-自己定义导航控制器NavigationController
猫猫分享,必须精品 原创文章,欢迎转载.转载请注明:翟乃玉的博客 地址:http://blog.csdn.net/u013357243?viewmode=contents 一:加入导航控制器 上一篇博 ...
- 猫猫学iOS之小知识之xcode6自己主动提示图片插件 KSImageNamed的安装
猫猫分享,必须精品 原创文章,欢迎转载.转载请注明:翟乃玉的博客 地址:http://blog.csdn.net/u013357243 一:首先看效果 KSImageNamed是让XCode能预览项目 ...
- 猫猫学iOS之小知识iOS启动动画_Launch Screen的运用
猫猫分享,必须精品 原创文章.欢迎转载.转载请注明:翟乃玉的博客 地址:http://blog.csdn.net/u013357243? viewmode=contents 看下效果吧 比如新浪微博的 ...
- 猫猫学IOS(二)UI之button操作 点击变换 移动 放大缩小 旋转
不多说,先上图片看效果,猫猫分享.必须精品 原创文章.欢迎转载.转载请注明:翟乃玉的博客 地址:viewmode=contents">http://blog.csdn.net/u013 ...
- 猫猫学iOS 之微博项目实战(5)微博自己定义搜索框searchBar
猫猫分享.必须精品 原创文章.欢迎转载. 转载请注明:翟乃玉的博客 地址:http://blog.csdn.net/u013357243 一:效果 用UITextField简单定义一个搜索框 二:调用 ...
- 猫猫学iOS之UITextField右边设置图片,以及UITextField全解
猫猫分享,必须精品 原创文章.欢迎转载.转载请注明:翟乃玉的博客 地址:http://blog.csdn.net/u013357243 效果: 封装好的方法: 猫猫封装的一个小方法,简单共享出来,方便 ...
随机推荐
- malloc基本实现
转自:http://www.cnblogs.com/wangshide/p/3932539.html 任何一个用过或学过C的人对malloc都不会陌生.大家都知道malloc可以分配一段连续的内存空间 ...
- jQuery Ajax 上传文件夹及文件
我们先来看一下文件夹结构 这是上传处理的: 看一下系统日志: 升级 HTML5文件实现拖拽上传提示效果改进(支持三种状态提示) 拖拽过程详解: 1:文件未拖出文件选择框的时候提示:将要上传的文件或文件 ...
- POP缩放动画
POP缩放动画 效果 源码 https://github.com/YouXianMing/Animations // // SpringScaleViewController.m // Animati ...
- Material Designer的低版本兼容实现(十四)—— CardView
今天说的又是一个5.0中才有的新控件——CardView(卡片视图).这个东东其实我们早就见过了,无论是微博还是人人客户端,它都有出现.通常我们都是通过自定义一个背景图片,然后通过给layout进行设 ...
- Java Collection Framework : List
摘要: List 是 Java Collection Framework的重要成员,详细包括List接口及其全部的实现类.由于List接口继承了Collection接口,所以List拥有Collect ...
- Useful JVM Flags – Part 8 (GC Logging)
The last part of this series is about garbage collection logging and associated flags. The GC log is ...
- maven单测生成覆盖率报告---Jacoco的使用
JaCoCo介绍 一.JaCoCo简述 JaCoCo是一个开源的覆盖率工具,它针对的开发语言是java,其使用方法很灵活,可以嵌入到Ant.Maven中:可以作为Eclipse插件,可以使用其Java ...
- how to fix bug in daily work
0 QE will begin test the product when system is stable. so they may log a lot of issues, and our dai ...
- go语言之进阶篇Ticker的使用
Ticker是一个定时触发的计时器,它会以一个间隔(interval)往channel发送一个事件(当前时间),而channel的接收者可以以固定的时间间隔从channel中读取事件. 1.Ticke ...
- [转载]设置Chrome忽略网站证书错误
某些用户可能经常会遇到Chrome浏览器提示网站证书错误的情况,尤其是在Google升级证书检查力度之后,访问Google时已经不能在浏览器界面中忽略证书错误访问. 比如说公司的IT修改过证书就会遇到 ...