一,效果图。

二,工程图。

三,代码。

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. ClojureScript魔法堂:搭建开发环境

    一.前言 当看到Lisp等函数式编程语言的语法是 (say (concat "hello" "world")) 这样的时候,我就有种深入学习的冲动,因为它的语法 ...

  2. 你必须知道的ASP.NET-----IHttpAsyncHandler实质

    一.写在前面 一说到IHttpAsyncHandler,很多人会顾名思义地说'不就是异步IHttpHandler'吗? 但当我发出疑问:"你真知道他们的不同之处?你真会使用它吗?" ...

  3. 关于Razor引擎的语法说明

    1.在页面上显示字符串的值, 格式:a*@变量名 但@之前必须有空格,{.}等,使得a*不可以构成变量的字符.

  4. Oracle Flashback和RMAN示例

    作者:Grey 原文地址:http://www.cnblogs.com/greyzeng/p/5346833.html 环境: Windows 10 专业版 Oracle Database 12c R ...

  5. Wojilu学习笔记 (01)

    “我记录”开发框架(wojilu framework) 是 .net 平台下的综合开发框架,主要用于 web 方面的快速开发. 官方网址:http://www.wojilu.com源码托管网址: ht ...

  6. 孙鑫MFC学习笔记10:画图/贴图

    1.SetPixel在指定点设置像素 2.虚线.点线宽度必须为1 3.CColorDialog创建颜色对话框 4.需要设置CC_RGBINIT标志才能设置颜色对话框的默认颜色 5.CC_FULLOPE ...

  7. Firemonkey Bitmap 设定像素颜色 Pixel

    VCL 和 Firemonkey 的 Bitmap 处理像素的方式不相同,下例为将图片内不是「白色」的像素全部改成「黑色」: procedure TForm1.Button1Click(Sender: ...

  8. IOS----友盟推送详解

    这两天好好的研究了下推送这功能,关于它我将分成两部分来讲,一.IOS手机端,二.Servlet服务端,今天先讲下IOS端 一.感受 下面讲下我对推送这个功能在IOS下的感受,这个算是我做了服务端的功能 ...

  9. JavaWeb前端基础复习笔记系列 二

    课程:孔浩前端视频教程(JavaScript系列:1~5讲) <html> <head> <title></title> <!--html只负责显 ...

  10. python 学习笔记5(深浅拷贝与集合)

    拷贝 我们已经详细了解了变量赋值的过程.对于复杂的数据结构来说,赋值就等于完全共享了资源,一个值的改变会完全被另一个值共享. 然而有的时候,我们偏偏需要将一份数据的原始内容保留一份,再去处理数据,这个 ...