- 浏览: 312777 次
- 性别:
- 来自: 杭州
最新评论
-
atgoingguoat:
R.drawable.icon是LOG图
android九宫格实现 -
atgoingguoat:
android:src="@drawable/ico ...
android九宫格实现 -
修博龙泉:
旋转view:
CGAffineTransform at ...
动画-图片旋转 -
修博龙泉:
阻尼效果图片:
CALayer *layer = self.i ...
动画-图片旋转 -
bei-jin-520:
color]sdfsdfsdf
android九宫格实现
UITableCellViewController.h
UITableCellViewController.m
ViewController.m
#import <UIKit/UIKit.h> @interface UITableCellViewController : UITableViewCell @property(nonatomic,retain) UILabel *lb_title; @property(nonatomic,retain) UILabel *lb_date; @property (nonatomic,retain) UILabel *lb_points; @property(nonatomic,retain) UILabel *lb_title_content; @property(nonatomic,retain) UILabel *lb_date_content; @property (nonatomic,retain) UILabel *lb_points_content; @end
UITableCellViewController.m
// // UITableCellViewController.m // TableViewCell001 // // Created by Bo Xiu on 12-9-4. // Copyright (c) 2012年 Bo Xiu. All rights reserved. // #import "UITableCellViewController.h" @interface UITableCellViewController () @end @implementation UITableCellViewController @synthesize lb_title = _lb_title ; @synthesize lb_date = _lb_date ; @synthesize lb_points = _lb_points ; @synthesize lb_title_content = _lb_title_content ; @synthesize lb_date_content = _lb_date_content ; @synthesize lb_points_content = _lb_points_content ; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code } return self; } -(id) init{ [super init]; if(self){ [self setFrame:CGRectMake(0, 0, 320, 120)]; self.backgroundColor = [UIColor blueColor]; int height = 25 ; int middle_height = 5 ; UIColor * bgcolor = [UIColor yellowColor]; _lb_title = [[UILabel alloc] initWithFrame:CGRectMake(20, 5 + height * 0 + middle_height * 0, 45, height )]; _lb_title.backgroundColor = bgcolor; _lb_title.text = @"标题:"; _lb_date = [[UILabel alloc] initWithFrame:CGRectMake(20, 5 + height * 1 + middle_height * 1, 45, height )]; _lb_date.backgroundColor = bgcolor; _lb_date.text = @"时间:"; _lb_points = [[UILabel alloc] initWithFrame:CGRectMake(20, 5 + height * 2+ middle_height * 2, 45, height)]; _lb_points.backgroundColor = bgcolor; _lb_points.text = @"路标:"; _lb_title_content = [[UILabel alloc] initWithFrame:CGRectMake(70, 5 + height * 0 + middle_height * 0, 240, height)]; _lb_title_content.backgroundColor = bgcolor; _lb_title_content.text = @"--------------"; _lb_date_content = [[UILabel alloc] initWithFrame:CGRectMake(70, 5 + height * 1 + middle_height * 1, 240, height)]; _lb_date_content.backgroundColor = bgcolor; _lb_date_content.text = @"--------------"; _lb_points_content = [[UILabel alloc] initWithFrame:CGRectMake(70, 5 + height * 2 + middle_height * 2, 240, height )]; _lb_points_content.backgroundColor = bgcolor; _lb_points_content.text = @"--------------"; [self addSubview:_lb_title]; [self addSubview:_lb_points]; [self addSubview:_lb_date]; [self addSubview:_lb_title_content]; [self addSubview:_lb_date_content]; [self addSubview:_lb_points_content]; } return self ; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end
ViewController.m
// // ViewController.m // TableViewCell001 // // Created by Bo Xiu on 12-9-4. // Copyright (c) 2012年 Bo Xiu. All rights reserved. // #import "ViewController.h" #import "UITableCellViewController.h" @interface ViewController () @end @implementation ViewController @synthesize myView; - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)viewDidUnload { [myView release]; myView = nil; [super viewDidUnload]; // Release any retained subviews of the main view. } //指定有多少个分区(Section),默认为1 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } //指定每个分区中有多少行,默认为1 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 5; } // 设置单元格的高度 -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 120; } //选中Cell响应事件 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ [tableView deselectRowAtIndexPath:indexPath animated:YES];//选中后的反显颜色即刻消失 } // 设置单元个样式 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; // // UITableCellViewController *cell = [tableView dequeueReusableCellWithIdentifier: // SimpleTableIdentifier]; // if (cell == nil) { // cell = [[[UITableCellViewController alloc] initWithStyle:UITableViewCellStyleDefault // reuseIdentifier: SimpleTableIdentifier] autorelease]; // } // //cell.imageView.image=image;//未选cell时的图片 // //cell.imageView.highlightedImage=highlightImage;//选中cell后的图片 // cell.textLabel.text=@"hello"; // return cell; static NSString *CellIdentifier = @"Cell"; UITableCellViewController *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { //cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; //cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell = [[[UITableCellViewController alloc ] init] autorelease] ; } // Configure the cell. //cell.textLabel.text = NSLocalizedString(@"Detail", @"Detail"); return cell; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } else { return YES; } } - (void)dealloc { [myView release]; [super dealloc]; } @end
发表评论
-
CCMenu 与 CCMenuItem
2013-11-09 11:52 816引入#import "ccDeprecate ... -
抛物线的精灵
2013-11-08 15:04 792// 抛物线 //mSprite:需要做抛物线的精灵 ... -
卡马克卷轴算法
2013-11-05 15:35 2073念 这里使用简化的概念,精确的定义请参考计算机图形学中二维观察 ... -
git 大招
2013-11-04 19:54 1525Last login: Mon Nov 4 19:30:1 ... -
AVAudioRecorder MAV格式录音
2013-08-15 21:13 1156//录音设置 NSDictionary * ... -
uilable根据字符串长度变化
2013-08-01 15:18 874CGSize labelSize = [ ... -
ios 文本自动换行
2013-07-30 19:52 1001// //自动换行 // UILabel *l ... -
ios 文本框随着键盘高度变化而变化
2013-07-29 18:22 2217监听键盘高度变化 [[NSNotificationC ... -
IOS开发苹果官方Sample Code及下载地址
2013-07-11 11:17 1574在线浏览地址:https://developer.apple ... -
苹果推送通知服务(APNs)编程(转)
2013-06-07 11:19 1261iPhone 对于应用程序在后台运行有诸多限制(除非你越狱) ... -
cell 数据重复
2013-06-03 15:21 996static NSString *CellIdentifi ... -
ios NSDate NSTring long 时间戳与字符串转换
2013-05-22 11:09 26933一,转化的方法为 NSString *timeS ... -
关于缺少各种framework出现的错误累结(转)
2013-05-16 16:47 1363博客分类: iosiPhone开发 iosiPhone开发 ... -
动画-图片旋转
2013-05-13 11:28 1394旋转: iv = [[UIImageView alloc] ... -
UINavicationController
2013-05-13 09:41 860如果楼主想要使用UINavigationController中 ... -
NSTimer-动态修改Interval的值
2013-05-06 09:38 852NSTimer使用例子: NSTimer *sh ... -
UIScrollView的属性总结
2013-04-27 10:00 906UIScrollView的属性总结 属性 作用 CGPoint ... -
单例设置
2013-04-27 09:51 747+ (RootScrollView *)shareIn ... -
颜色设置
2013-04-27 09:50 688[Globle colorFromHexRGB:@&quo ... -
翻转动画
2013-04-11 16:11 763CGContextRef context ...
相关推荐
长按即可移动cell的自定义UITableView。Github仓库地址:https://github.com/pujiaxin33/JXMovableCellTableView
UITableViewCell自定义等高
UItableview cell (自定义)增假,删除 移动
这个应该是最常见而且不容易被发现的原因,起因是iOS7在Conttoller中新增了automaticallyAdjustsScrollViewInsets这个属性,当设置为YES时(默认YES),如果视图里面存在唯一一个UIScrollView或其子类View,那么它...
本篇文章主要介绍了ios中自定义cell,自定义UITableViewCell,非常具有实用价值,需要的朋友可以参考下。
如果你对左滑删除按钮的要求不高,仅仅只是实现UITableView上cell的左滑删除功能,那在UITableView的代理方法中添加以下两种方法便可实现需求: //使用系统默认的删除按钮 - (void)tableView:(UIT
关于一个自定义UITableView Cell的简单应用程序,类似团购界面 对应博客地址:http://blog.csdn.net/nsryan
今天分享下cell的单选,自定义的,不是下图这种网上找到的打对勾的,我搜了好久,基本上都是打对勾的文章,就决定自己写一篇。基本上自己的app都会有一个风格吧,咱也不能一直用打对勾的方式去做(看起来是不是很low...
当UITableView进入编辑模式,在进行左滑操作的cell的右边,默认会出现Delete按钮,如何自定义左滑出现的按钮呢? 只需要实现UITableView下面的这个代理方法。 代码如下: – (NSArray<UITableViewRowAction> *)...
对于ios7,ios8及以上来说,调整UITableView的cell的分割线位置已经是相当不便,因为UITableView内部使用了margin layout. 其实只需要如下这样子就可以实现分割线的控制。 代码如下: -(void)tableView:(UITableView...
UITableview控件基本使用 一、一个简单的英雄展示程序 NJHero.h文件代码(字典转模型) 代码如下: #import @interface NJHero : NSObject /** * 头像 */ @property (nonatomic, copy) NSString *icon; /** ...
删除按钮带点圆角 不止如此,还有cell之间有间隔,cell圆角,cell左右有间隔。如下图!!!!! 内心奔溃的我想了想了很多方法。(获取系统自带按钮改圆角也试过,自定义手势也试过)最后决定全部自定义。个人感觉...
*****简单使用XIB文件创建自定义的cell*
一、UITableView基本介绍 默认的UITableView有2种风格: UITableViewStylePlain(不分组) UITableViewStyleGrouped(分组) UITableView中的数据只有行的概念,没有列的概念,UITableView的每行数据就是一个...
iOS开发中,UITableView可能是平时我们打交道最多的UI控件之一,其重要性不言而喻。Android也是如此,Android中的ListView和UITableView是相同功能的一个控件,但是iOS的UITableView更为强大一点,原因就不说了,...
iOS UICollectionView实现单元格拖拽移动排序
简单的UITableView使用,使用MVC设计模式。自定义cell实现。
*****通过storyboard创建自定义cell并使用Model数据模型**
通过自定义UITableViewCell实现ibooks的图书列表样式。