猫猫分享,必须精品

原创文章,欢迎转载。

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

地址: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 CMYK图片转RGB图片(TwelveMonkeys方式)

    TwelveMonkeys的使用比较简单,只要把相关的jar包加入到类路径,他的类我们基本不会用到,只要使用jdk ImageIO或其上层的接口就行了.jdk的ImageIO有自动发现功能,会自动查找 ...

  2. Wireshark基本用法 && 过滤规则 && 协议详解

    基本使用: https://www.cnblogs.com/dragonir/p/6219541.html 协议解析: https://www.jianshu.com/p/a384b8e32b67 ( ...

  3. 不规则形状的Mask动画

    不规则形状的Mask动画 效果 源码 https://github.com/YouXianMing/Animations // // MaskShapeViewController.m // Anim ...

  4. USB OTG简单介绍、与普通USB线的差别

    USB有三类接口A类接口                     -----------最常见的扁平接口,四芯  VCC   GND   D+   D- B类接口                    ...

  5. Java 内存管理白皮书

    1. 垃圾回收器 职责 分配内存 保证有引用对象不被回收 保证无引用对象被回收 设计方式 串行(Serial)与并行(Parallel) 串行的回收方式, 每次只能执行一种操作. 例如, 在多 cpu ...

  6. java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

    错误信息 查看Console标签页: 这儿提示找不到HttpServletRequest类. 解决办法 规则文件更新的时候需要调用servlet-api.jar相关的类,如果您的系统环境下无法找到这个 ...

  7. 在IIS上SSL的部署和启动SSL安全【转】

    在这次的项目中遇见了这个问题,之前我并懂了不了多少,只对了SSL和HTTPS理论了解.但并不知道在实际中如何运行.经过自己在网上查阅一番,最后靠自己解决了这个问题,现在在这里和大家分享一下.如果写的有 ...

  8. vRealize Automation部署虚机如果出错怎么办?

    以下地方的日志可以查看: 1. Requests –> Choose my request -> View Detail –> Execution Information. 2. I ...

  9. Visio中方向键不能移动物件而是滚动画布

    不知怎么的, 我的Visio中按方向键不能移动目标对象, 效果却是移动整个画布. 上网查了一下, 找到了原因. 因为不知怎么的错按了键盘上的Scroll Lock键, 再按一下就好了.     参考资 ...

  10. High Availability (HA) 和 Disaster Recovery (DR) 的区别

    High availability 和disaster recovery不是一回事. 尽管在规划和解决方案上有重叠的部分, 它们俩都是business contiunity的子集. HA的目的是在主数 ...