一,效果图。

二,工程图。

三,代码。

RootViewController.h

RootViewController.m

myCell.h

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface myCell : UITableViewCell
{
UILabel * myLable;
UIImageView * myImageView;
UILabel * title;
}
@property (strong,nonatomic) UILabel * myLabel;
@property (strong,nonatomic) UIImageView * myImageView;
@property (strong,nonatomic) UILabel * title;
@end

myCell.m

#import "myCell.h"

@implementation myCell

@synthesize myLabel;
@synthesize myImageView;
@synthesize title; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) { myLabel = [[UILabel alloc] init];
myLabel.lineBreakMode=NSLineBreakByCharWrapping;
myLabel.numberOfLines = 0;
myLabel.font = [UIFont fontWithName:@"MicrosoftYaHei" size:20.0];
[self addSubview:myLabel]; myImageView = [[UIImageView alloc] init];
[self addSubview:myImageView]; title = [[UILabel alloc] init];
title.frame = CGRectMake(10, 10, 50, 30);
title.backgroundColor = [UIColor colorWithRed:230/255.0 green:192/255.0 blue:203/255.0 alpha:1.0];
title.layer.cornerRadius = 10.0;
[self addSubview:title];
;
}
return self;
} - (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end

CardViewController.h

#import <UIKit/UIKit.h>

@interface CardViewController : UIViewController
<UITableViewDataSource,UITableViewDelegate>
{
NSMutableArray *array ;
NSMutableArray * titleArray;
}
@property (strong ,nonatomic) NSMutableArray *array;
@property (strong,nonatomic) NSString * month;
@property (strong,nonatomic) NSString * imageName;
@property (strong,nonatomic) NSString * title; @end

CardViewController.m

#import "CardViewController.h"
#import "myCell.h" @interface CardViewController () @end @implementation CardViewController
@synthesize array;
@synthesize month;
@synthesize imageName;
@synthesize title; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
} -(void)viewDidLoad
{
[super viewDidLoad]; NSDictionary * dic1 = [[NSDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"BabyCard" ofType:@"plist"]];
self.array = [dic1 objectForKey:month]; NSDictionary * dic2 = [[NSDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Title" ofType:@"plist"]];
titleArray = [[NSMutableArray alloc] init];
titleArray = [dic2 objectForKey:title]; UITableView * tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 460) style:UITableViewStylePlain];
tableView.delegate = self;
tableView.dataSource = self;
tableView.showsVerticalScrollIndicator = NO;
[self.view addSubview:tableView]; UIButton * back = [UIButton buttonWithType:UIButtonTypeCustom];
back.frame = CGRectMake(10, 10, 25, 31);
[back setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
[back addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
[tableView addSubview:back];
}
#pragma -mark -doClickActions
-(void)back
{
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 0.7;
animation.type = @"oglFlip";
animation.subtype = kCATransitionFromLeft;
[self.view.layer addAnimation:animation forKey:@"animation"];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
#pragma -mark -UITableViewDelegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return array.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString * str = [array objectAtIndex:indexPath.row]; CGSize size=[str boundingRectWithSize:CGSizeMake(300, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:20.0]} context:nil].size; if(indexPath.row == 0)
{
return size.height + 350;
}
else
{
return size.height + 60;
}
} -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
myCell * cell = [tableView dequeueReusableCellWithIdentifier:@"id"];
if(cell == nil){
cell = [[myCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"id"];
} NSString * str = [array objectAtIndex:indexPath.row];
CGSize size=[str boundingRectWithSize:CGSizeMake(300, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:20.0]} context:nil].size;
cell.selectionStyle = UITableViewCellSelectionStyleNone; NSString * str2 = [NSString stringWithFormat:@" %@ ",[titleArray objectAtIndex:indexPath.row]];
CGSize size2=[str boundingRectWithSize:CGSizeMake(300, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:10.0]} context:nil].size;
cell.title.text = str2;
if(indexPath.row == 0){
cell.myImageView.hidden = NO;
cell.myImageView.image = [UIImage imageNamed:imageName];
cell.myImageView.frame = CGRectMake(0, 0, 320, 300);
cell.myLabel.frame = CGRectMake(10, 350, 300, size.height);
cell.title.frame = CGRectMake(10, 310, size2.width, 30);
}else{
cell.myImageView.hidden = YES;
cell.myLabel.frame = CGRectMake(10, 50, 300, size.height);
cell.title.frame = CGRectMake(10, 10,size2.width, 30);
}
cell.myLabel.text = str;
return cell;
}
@end

【代码笔记】iOS-iCarouselDemo的更多相关文章

  1. IOS开发笔记 IOS如何访问通讯录

    IOS开发笔记  IOS如何访问通讯录 其实我是反对这类的需求,你说你读我的隐私,我肯定不愿意的. 幸好ios6.0 以后给了个权限控制.当打开app的时候你可以选择拒绝. 实现方法: [plain] ...

  2. 【hadoop代码笔记】Mapreduce shuffle过程之Map输出过程

    一.概要描述 shuffle是MapReduce的一个核心过程,因此没有在前面的MapReduce作业提交的过程中描述,而是单独拿出来比较详细的描述. 根据官方的流程图示如下: 本篇文章中只是想尝试从 ...

  3. 【hadoop代码笔记】hadoop作业提交之汇总

    一.概述 在本篇博文中,试图通过代码了解hadoop job执行的整个流程.即用户提交的mapreduce的jar文件.输入提交到hadoop的集群,并在集群中运行.重点在代码的角度描述整个流程,有些 ...

  4. 【Hadoop代码笔记】目录

    整理09年时候做的Hadoop的代码笔记. 开始. [Hadoop代码笔记]Hadoop作业提交之客户端作业提交 [Hadoop代码笔记]通过JobClient对Jobtracker的调用看详细了解H ...

  5. 笔记-iOS 视图控制器转场详解(上)

    这是一篇长文,详细讲解了视图控制器转场的方方面面,配有详细的示意图和代码,为了使得文章在微信公众号中易于阅读,seedante 辛苦将大量长篇代码用截图的方式呈现,另外作者也在 Github 上附上了 ...

  6. <Python Text Processing with NLTK 2.0 Cookbook>代码笔记

    如下是<Python Text Processing with NLTK 2.0 Cookbook>一书部分章节的代码笔记. Tokenizing text into sentences ...

  7. [学习笔记] SSD代码笔记 + EifficientNet backbone 练习

    SSD代码笔记 + EifficientNet backbone 练习 ssd代码完全ok了,然后用最近性能和速度都非常牛的Eifficient Net做backbone设计了自己的TinySSD网络 ...

  8. DW网页代码笔记

    DW网页代码笔记 1.样式.       class  插入类样式  标签技术(html)解决页面的内容样式技术(css)解决页面的外观脚本技术       解决页面动态交互问题<form> ...

  9. 前端学习:JS(面向对象)代码笔记

    前端学习:JS(面向对象)代码笔记 前端学习:JS面向对象知识学习(图解) 创建类和对象 创建对象方式1调用Object函数 <body> </body> <script ...

  10. 离屏渲染学习笔记 /iOS圆角性能问题

    离屏渲染学习笔记 一.概念理解 OpenGL中,GPU屏幕渲染有以下两种方式: On-Screen Rendering 意为当前屏幕渲染,指的是GPU的渲染操作是在当前用于显示的屏幕缓冲区中进行. O ...

随机推荐

  1. 基于HTML5的3D网络拓扑自动布局

    上篇将HT for Web的3D拓扑弹力布局的算法运行在Web Workers后台(http://www.hightopo.com/blog/70.html),这篇我们将进一步折腾,将算法运行到真正的 ...

  2. Windows下ELK环境搭建(单机多节点集群部署)

    1.背景 日志主要包括系统日志.应用程序日志和安全日志.系统运维和开发人员可以通过日志了解服务器软硬件信息.检查配置过程中的错误及错误发生的原因.经常分析日志可以了解服务器的负荷,性能安全性,从而及时 ...

  3. 用redux完成事务清单

    今天再来一个例子,我们从组件开始. App.js import React, { PropTypes } from 'react' import { bindActionCreators } from ...

  4. AppleScript的字典怎么看怎么用

    新迭代之前忙里偷闲摸鱼了几种脚本的写法:bash, alfred,automator,applescript 这篇就说说这个applescript 以iterm为例 初看它的字典大概长这样: 1.方法 ...

  5. C#项目””是针对”.NETFramework,Version=v4.5.2”但此计算机没有,需要修改为v4.5.1.

    每次下载别人的代码都会出现这样的问题,以为是没有安装.NETFramework,就下载安装了,但是每次安装都会出现已安装高版本的4.6(Win10自带),无需下次安装,但是每次VS中都会显示有问题,而 ...

  6. Guava并发:ListenableFuture与RateLimiter示例

    ListenableFuture顾名思义就是可以监听的Future,它是对java原生Future的扩展增强 RateLimiter类似于JDK的信号量Semphore,他用来限制对资源并发访问的线程 ...

  7. Win10 IoT C#开发 6 - 4x4矩阵键盘扫描

    Windows 10 IoT Core 是微软针对物联网市场的一个重要产品,与以往的Windows版本不同,是为物联网设备专门设计的,硬件也不仅仅限于x86架构,同时可以在ARM架构上运行. 上一章我 ...

  8. Eclipse导入Java项目时“No projects are found to import”错误的处理

    用Eclipse导入Java项目时,经常会出现“No projects are found to import”错误(尤其是导入网上下载的项目时),这是因为文件夹里面没有.project和.class ...

  9. Android录音应用

    首先是xml布局文件: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xm ...

  10. 11.20 CSS定位智博星网页制作

    <html xmlns="http://www.w3.org/1999/xhtml">   <head>   <meta http-equiv=&qu ...