猫猫分享,必须精品

原创文章,欢迎转载。

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

地址: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. java.security.InvalidKeyException: Illegal key size aes解密失败

    使用微信时定期提示:java.security.InvalidKeyException: Illegal key size和 com.qq.weixin.mp.aes.AesException: ae ...

  2. 反恐24小时第一季/全集24 Live Another Day迅雷下载

    反恐24小时 第一至九季 24 Season 1-9 (2001-2014) 本季看点:<24小时>第8季将在拥有美国的象征自由女神像的纽约开始,在新的一天,CTU重新开张,新的领导为从M ...

  3. 代码实现Android5.0的下拉刷新效果

    如图所示,实现类似与gmail的下拉刷新. 项目地址:https://github.com/stormzhang/SwipeRefreshLayoutDemo 一.在xml文件中定义 这个控件在sup ...

  4. layUI 几个简单的弹出层

    导入控件主题 <link rel="stylesheet" href="dist/themes/default/style.min.css" /> ...

  5. RAISR: rapid and accurate image super resolution

      准确地说,RAISR并不是用来压缩图像的,而是用来upsample图像的. 众所周知,图片缩小到半分辨率后,在拉回原大小,会出现强烈的锯齿.从80年代开始就有很多super sampling的方法 ...

  6. SQL Server 函数 LEN 与 DATALENGTH的区别

    http://blog.csdn.net/Hello_World_wusu/article/details/4667452 DATALENGTH()函数返回一个用于对值进行管理的字节数,这有助于揭示不 ...

  7. js将滚动条滚动到指定位置的方法

    代码如下(主要是通过设置Location的hash属性): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN& ...

  8. Github用.gitignore忽略指定文件

    .gitignore Github提供.gitignore这种功能,可以自己指定哪些文件可以不被管理.具体方法是在版本管理的根目录下(与.git文件夹同级)创建一个.gitignore. 应用实例 项 ...

  9. protobuf-c的学习总结

    1.前言 项目中用到protobuf-c进行数据序列化,好处在于后期程序扩展性非常好,只需要改动proto的定义就可以保持兼容,非常的灵活方便.关于protobuf-c的详细介绍可以参考google官 ...

  10. Java-Shiro(一):简介

    简介 Apache Shiro是Java的一个安全权限框架. Shiro可以非常容易的开发出足够好的额应用,其不仅可以用在JavaSE环境,也可以用在Java SE环境. Shiro可以完成:认证.授 ...