绘制draw table里面的cell
来源:互联网 发布:源mac地址的作用 编辑:程序博客网 时间:2024/06/16 12:56
1、自定义table的cell ,用绘制
//Cell.h
#import <UIKit/UIKit.h>
@interface Cell : UITableViewCell
// 标题
@property(nonatomic, strong) NSString *title;
// 图片
@property(nonatomic, strong) UIImage *image;
// 类型 0:无图片 1:有图片
@property(nonatomic, assign) NSInteger type;
@end
//Cell.m- (void)drawRect:(CGRect)rect{
// 绘制底部的线
CGContextRef context =UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [UIColorcolorWithRed:0.722green:0.600blue:0.451alpha:1].CGColor);
CGContextStrokeRect(context, CGRectMake(0, rect.size.height -0.5, rect.size.width,0.5));
[[UIColororangeColor]set];
if (self.type ==0) {
[self.titledrawInRect:CGRectMake(15,0, 100,50) withFont:[UIFontsystemFontOfSize:15]lineBreakMode:NSLineBreakByCharWrappingalignment:NSTextAlignmentLeft];
}else if (self.type ==1){
[self.imagedrawInRect:CGRectMake(20,14, 20,20)];
}
}
2、tablecontroller//绘制每个cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//文字
cell.title = @"开启通知";
cell.type = 0;
//图片
UIImage *_image = [UIImageimageNamed:@"qq.png"];
cell.image = _image;
cell.type = 1;
[cell setNeedsDisplay]; //调用 draw() 方法
}整理的实在太匆忙,以后继续补充完整,感谢前辈 ,哈哈哈!
- 绘制draw table里面的cell
- 神奇的table-cell
- draw 绘制
- 关于view绘制的draw()方法
- html~table、table-cell的使用
- Table---自定义cell的背景
- display:table-cell的妙用
- display:table-cell的应用
- display:table-cell的 应用
- display:table-cell的用法
- display:table-cell的应用
- 玩转tableview-自定义table cell之一(全代码绘制)
- cocos2dx-draw绘制
- three20里面的tttableview的自定义cell
- cell里面控件宽度布局的问题
- IOS-TableView里面cell的显示动画
- 寻找table中得cell 以及对cell的动画
- table control里面的f4
- 用HTML5来开发一款android本地化App游戏-宝石碰碰
- HDoj-1875-畅通工程再续-prim算法
- JAVA类框架总结
- 创建MFC单文档,实现金刚石图案绘制功能
- iOS开发——加载、滑动翻阅大量图片解决方案详解
- 绘制draw table里面的cell
- Java中List的排序
- python简单网络爬虫程序
- 工作之杂记--c# 使用wmi to start/stop IIS6 应用程序池和webserver
- Linux下apt命令
- 求圆柱体表面积
- C++继承中基类和派生类之间指针传递问题
- 手动创建、构建并安装android项目
- Objective-c 中的算术函数和常数的表示