猫猫分享,必须精品

原创文章,欢迎转载。

转载请注明:翟乃玉的博客

地址: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的更多相关文章

  1. AJ学IOS 之UIDynamic重力、弹性碰撞吸附等现象

    AJ分享,必须精品 一:效果 重力和碰撞 吸附现象 二:简介 什么是UIDynamic UIDynamic是从iOS 7开始引入的一种新技术,隶属于UIKit框架 可以认为是一种物理引擎,能模拟和仿真 ...

  2. (素材源代码)猫猫学IOS(四)UI之半小时搞定Tom猫

    下载地址:http://download.csdn.net/detail/u013357243/8514915 以下是执行图片展示 制作思路以及代码解析 猫猫学IOS(四)UI之半小时搞定Tom猫这里 ...

  3. (素材源代码) 猫猫学IOS(五)UI之360等下载管理器九宫格UI

    猫猫分享,必须精品 先看效果 代码学习地址: 猫猫学IOS(五)UI之360等下载管理器九宫格UI 猫猫学IOS(五)UI之360等下载管理器九宫格UI http://blog.csdn.net/u0 ...

  4. 猫猫学iOS 之微博项目实战(2)微博主框架-自己定义导航控制器NavigationController

    猫猫分享,必须精品 原创文章,欢迎转载.转载请注明:翟乃玉的博客 地址:http://blog.csdn.net/u013357243?viewmode=contents 一:加入导航控制器 上一篇博 ...

  5. 猫猫学iOS之小知识之xcode6自己主动提示图片插件 KSImageNamed的安装

    猫猫分享,必须精品 原创文章,欢迎转载.转载请注明:翟乃玉的博客 地址:http://blog.csdn.net/u013357243 一:首先看效果 KSImageNamed是让XCode能预览项目 ...

  6. 猫猫学iOS之小知识iOS启动动画_Launch Screen的运用

    猫猫分享,必须精品 原创文章.欢迎转载.转载请注明:翟乃玉的博客 地址:http://blog.csdn.net/u013357243? viewmode=contents 看下效果吧 比如新浪微博的 ...

  7. 猫猫学IOS(二)UI之button操作 点击变换 移动 放大缩小 旋转

    不多说,先上图片看效果,猫猫分享.必须精品 原创文章.欢迎转载.转载请注明:翟乃玉的博客 地址:viewmode=contents">http://blog.csdn.net/u013 ...

  8. 猫猫学iOS 之微博项目实战(5)微博自己定义搜索框searchBar

    猫猫分享.必须精品 原创文章.欢迎转载. 转载请注明:翟乃玉的博客 地址:http://blog.csdn.net/u013357243 一:效果 用UITextField简单定义一个搜索框 二:调用 ...

  9. 猫猫学iOS之UITextField右边设置图片,以及UITextField全解

    猫猫分享,必须精品 原创文章.欢迎转载.转载请注明:翟乃玉的博客 地址:http://blog.csdn.net/u013357243 效果: 封装好的方法: 猫猫封装的一个小方法,简单共享出来,方便 ...

随机推荐

  1. OAuth:Access to shared resources via web applications

    A web application which wants to gain access to shared resources should redirect the user to a page ...

  2. SharePoint Online 创建文档库

    前言 本文介绍如何在Office 365中创建文档库,以及文档库的一些基本设置. 正文 通过登录地址登录到Office 365的SharePoint Online站点中,我们可以在右上角的设置菜单中, ...

  3. 真实的人类第三季/全集Humans迅雷下载

    Channel 4及AMC宣布续订<真实的人类 Humans>第三季,下季为8集:新季拍摄将在秋季开始,主要角色会回归.该剧设定在机器人Synth被繁忙都市人广泛使用的世界,呈现人类与机器 ...

  4. AsyncTask中各个函数详细的调用过程,初步实现异步任务

     AsyncTask内部类可能会产生内存泄露的问题 解决上述内部类可能引起的内存泄露问题的方法 将AsyncTask或者Thread的子类作为单独的类文件,不持有Activity的强引用 将Async ...

  5. 《Google Glass开发指南》

    <Google Glass开发指南> 基本信息 作者: BestApp工作室 丛书名: 图灵原创 出版社:人民邮电出版社 ISBN:9787115349477 上架时间:2014-3-19 ...

  6. Orchard之在前台显式一个属于自己的列表

    一:当前现状 Orchard 并不提供筛选 Owner 的 Query,但是 Gallery 中有提供,那就是:Owner Queries. Install 之,然后在解决方案中引入该 Project ...

  7. .Net Excel操作之NPOI(一)简介

    一.NPOI简介 NPOI是一个开源项目,可以读/写xls,doc,ppt文件,有着广泛的应用. 使用NPOI能够帮助开发者在没有安装微软Office的情况下读写Office 97-2003的文件,支 ...

  8. Caffe SSD的resize过程解析

    问题描述在windows平台上,本地训练SSD_512得到了对应的权值参数文件,加载模型进行前向测试的时候,发现调用caffe.io.Transformer中的resize处理函数速度太慢,打算用op ...

  9. Controller向View传递数据

    1.       使用ViewData传递数据 我们在Controller中定义如下: ViewData[“Message”] = “Hello word!”; 然后在View中读取Controlle ...

  10. C# 6.0 的那些事

    这两天期中考试没时间去看Connect();直播,挺可惜的,考完后补看了Connect(); 把C#6.0的新东西总结一下. 自动属性初始化 (Initializers for auto-proper ...