组模型的封装

SettingGroup

//
// SettingGroup.h
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// 模型,一组(Section,Group),包含 组的header,组的footer,中间的条目(cell数组) #import <Foundation/Foundation.h> @interface SettingGroup : NSObject // 头部标题
@property (nonatomic, copy) NSString *header;
// 中间的条目(SettingItem对象数组)
@property (nonatomic, strong) NSArray *items;
// 尾部标题
@property (nonatomic, copy) NSString *footer; @end

父类SettingItem

//
// SettingItem.h
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// 一个SettingItem模型 相应一个Cell须要的数据源
// 父类,用来描写叙述当前cell里面要显示的内容。描写叙述点击cell后做什么事情 #import <Foundation/Foundation.h> @interface SettingItem : NSObject // 为一行(cell)提供 图标名
@property (nonatomic, copy) NSString *icon;
// 为一行(cell)提供 标题
@property (nonatomic, copy) NSString *title;
// 为一行(cell)提供 子标题
@property (nonatomic, copy) NSString *subtitle;
// 为一行(cell)提供 点击后,要运行的操作
@property (nonatomic, copy) void (^operation)() ; // 点击cell后要运行的操作 #pragma mark - 类方法,生成模型实例
// 有标题 有图片的模型
+ (id)itemWithIcon:(NSString *)icon title:(NSString *)title;
// 仅仅有标题的模型
+ (id)itemWithTitle:(NSString *)title;
@end
//
// SettingItem.m
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// 一个SettingItem模型 相应一个Cell须要的数据源
// 父类,用来描写叙述当前cell里面要显示的内容,描写叙述点击cell后做什么事情 #import "SettingItem.h" @implementation SettingItem // 有标题 有图片的模型
+ (id)itemWithIcon:(NSString *)icon title:(NSString *)title
{
SettingItem *item = [[self alloc] init];
item.icon = icon;
item.title = title;
return item;
}
// 仅仅有标题的模型
+ (id)itemWithTitle:(NSString *)title
{
return [self itemWithIcon:nil title:title];
} @end

父类SettingItemArchive

//
// SettingItemArchive.h
// 25_彩票
//
// Created by beyond on 14-8-29.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// 中间父类,仅一个成员,key,全部须要归档的settingItem的子类(如开关等) 都能够继承本模型 #import "SettingItem.h" @interface SettingItemArchive : SettingItem // 存储数据时用的key,取数据时也是用该key
@property (nonatomic, copy) NSString *key;
@end

子类SettingItemArrow

//
// SettingItemArrow.h
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// 子类 最右边是箭头的item数据模型,专业提供数据源,给右边是箭头的cell #import "SettingItem.h" @interface SettingItemArrow : SettingItem // 一般带箭头的cell,被点击时候,是要跳到还有一个界面(控制器)
@property (nonatomic, assign) Class showVCClass; // 即将显示的控制器的类名
@end

子类SettingItemSwitch

//
// SettingItemSwitch.h
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// 子类 最右边是【开关】的item数据模型,专业提供数据源,给右边是开关的cell
// 继承自SettingItemArchive,而SettingItemArchive又继承自SettingItem #import "SettingItemArchive.h" @interface SettingItemSwitch : SettingItemArchive // 开关须要保存的是状态,在设置时,就归档
@property (nonatomic, assign) BOOL off; @end
//
// SettingItemSwitch.m
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// #import "SettingItemSwitch.h" @implementation SettingItemSwitch // 开关须要保存的是状态,在设置时,就归档
- (void)setOff:(BOOL)off
{
_off = off; [SettingTool setBool:off forKey:self.key];
} - (void)setKey:(NSString *)key
{
[super setKey:key]; _off = [SettingTool boolForKey:key];
} @end

子类SettingItemLabel

//
// SettingItemLabel.h
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// 子类 最右边是【文字】的item数据模型,专业提供数据源,给右边是Label的cell #import "SettingItemArchive.h" @interface SettingItemLabel : SettingItemArchive // cell右边显示的文字,在设置时就要归档
@property (nonatomic, copy) NSString *text; @end

//
// SettingItemLabel.m
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// 子类 最右边是【文字】的item数据模型,专业提供数据源,给右边是Label的cell #import "SettingItemLabel.h" @implementation SettingItemLabel // 拦截,cell右边显示的文字,赋值时,就必须归档
- (void)setText:(NSString *)text
{ _text = text; // 归档
[SettingTool setObject:text forKey:self.key];
} // 为key赋值的时候,就必须解档
- (void)setKey:(NSString *)key
{
[super setKey:key]; _text = [SettingTool objectForKey:key];
}
@end

自己定义cell视图View的封装      SettingCell

//
// SettingCell.h
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// view,自己定义cell,接收数据源为其内部子控件提供数据 #import <UIKit/UIKit.h>
// 模型,数据源,为view cell 提供数据
@class SettingItem;
@interface SettingCell : UITableViewCell // 模型,数据源,为view cell 提供数据
@property (nonatomic, strong) SettingItem *item;
// cell所在的组和行号
@property (nonatomic, strong) NSIndexPath *indexPath; // 类方法创建cell实例对象,使用instancetype优点多多,更加严谨,让编译器更智能提示错误
+ (instancetype)settingCellWithTableView:(UITableView *)tableView; @end
//
// SettingCell.m
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// view,自己定义cell,接收数据源为其内部子控件提供数据 #import "SettingCell.h"
// 数据源
#import "SettingItem.h"
#import "SettingItemSwitch.h"
#import "SettingItemArrow.h"
#import "SettingItemLabel.h" // 在ios6中,cell的contentView的x是10,因此,要想让cell全屏宽,必须使用cell左移10,宽度+20
const int MakeCellToLeftBy = 10; @interface SettingCell()
{
// 每个进入视野的cell 都循环利用(共用)一个arrow,switch,label
UIImageView *_arrowImgView;
UISwitch *_switch;
UILabel *_label; UIView *_divider;
}
@end @implementation SettingCell
#pragma mark - 生命周期
// 类方法创建cell实例对象,使用instancetype优点多多,更加严谨,让编译器更智能提示错误
// 先从參数tableView的缓存池中取,取不到,才要创建
+ (instancetype)settingCellWithTableView:(UITableView *)tableView
{
// 0.用static修饰的局部变量,仅仅会初始化一次
static NSString *ID = @"SettingCell"; // 1.拿到一个标识先去缓存池中查找相应的Cell
SettingCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; // 2.假设缓存池中没有,才须要传入一个标识创建新的Cell
if (cell == nil) {
cell = [[SettingCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:ID];
} return cell;
}
// 重写父类的方法,创建cell实例
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
// 先调用父类的方法
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// 1.设置全局统一的cell背景view
[self setupCellBgView]; // 2.设置子控件属性
[self setupCellLabelBgColor]; // 3.加入cell底部的分隔线(为了统一,先移除系统自带的separateLine)
[self setupCellUnderLine];
}
return self;
}
#pragma mark - 初始化 属性设置
#pragma mark 1.设置cell背景view
- (void)setupCellBgView
{
// 1.默认 cell背景view (白色)
UIView *bgView = [[UIView alloc] init];
bgView.backgroundColor = [UIColor whiteColor];
self.backgroundView = bgView; // 2.选中 cell背景view (灰色)
UIView *selectedBgView = [[UIView alloc] init];
selectedBgView.backgroundColor = kColor(237, 233, 218);
self.selectedBackgroundView = selectedBgView;
}
#pragma mark 2.设置cell内子控件label背景
- (void)setupCellLabelBgColor
{
// 标题 去其默认的背景
self.textLabel.backgroundColor = [UIColor clearColor];
self.textLabel.font = [UIFont systemFontOfSize:14];
// 子标题 去其默认的背景
self.detailTextLabel.backgroundColor = [UIColor clearColor];
self.detailTextLabel.font = [UIFont systemFontOfSize:12];
}
#pragma mark 3.设置分隔线
// 3.加入cell底部的分隔线(为了统一,先移除系统自带的separateLine)
- (void)setupCellUnderLine
{
UIView *divider = [[UIView alloc] init];
divider.backgroundColor = kColor(200, 200, 200);
// 不能在这里设置分隔线的x值(原因:cell没有详细的数据,里面的label就不知道终于的位置)
// divider.frame = CGRectMake(0, 0, self.contentView.frame.size.width, 1.5);
[self.contentView addSubview:divider];
_divider = divider;
} #pragma mark - 拦截setter方法
// 依据所在的组,所在的行号,设置切割线的显示状态
- (void)setIndexPath:(NSIndexPath *)indexPath
{
_indexPath = indexPath; // 设置underLine的可见性,依据该cell所在的indexPath
_divider.hidden = indexPath.row == 0;
} // 拦截数据源,为子控件们赋值
- (void)setItem:(SettingItem *)item
{
_item = item; // 设置数据
self.imageView.image = [UIImage imageNamed:item.icon];
self.textLabel.text = item.title;
self.detailTextLabel.text = item.subtitle; // 依据数据源模型的不同,创建不同的最右边的accessoryView
if ([item isKindOfClass:[SettingItemArrow class]]) {
// 1.设置箭头
[self setAccessoryViewArrow];
} else if ([item isKindOfClass:[SettingItemSwitch class]]) {
// 2.设置开关
[self setAccessoryViewSwitch];
} else if ([item isKindOfClass:[SettingItemLabel class]]) {
// 3.设置文本
[self setAccessoryViewLabel];
} else {
// 什么也没有。必须清空右边显示的view。由于cell循环使用
self.accessoryView = nil;
// 而且要,还原,使用默认的选中样式(即能够产生选中效果)
self.selectionStyle = UITableViewCellSelectionStyleDefault;
}
}
#pragma mark 设置右边的箭头
// 每个进入视野的cell 都循环利用(共用)一个arrow,switch,label
- (void)setAccessoryViewArrow
{
if (_arrowImgView == nil) {
_arrowImgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"CellArrow"]];
} // 右边显示箭头
self.accessoryView = _arrowImgView;
// 用默认的选中样式
self.selectionStyle = UITableViewCellSelectionStyleDefault;
}
#pragma mark 设置右边的文本标签
// 每个进入视野的cell 都循环利用(共用)一个arrow,switch,label
- (void)setAccessoryViewLabel
{
if (_label == nil) {
_label = [[UILabel alloc] init];
_label.bounds = CGRectMake(0, 0, 100, self.frame.size.height);
_label.textAlignment = NSTextAlignmentRight;
_label.backgroundColor = [UIColor clearColor];
_label.textColor = kColor(173, 69, 14);
_label.font = [UIFont systemFontOfSize:13];
} // 设置右边label的值
SettingItemLabel *labelItem = (SettingItemLabel *)_item;
_label.text = labelItem.text; // 右边显示子文本
self.accessoryView = _label;
// 同意选中本行
self.selectionStyle = UITableViewCellSelectionStyleDefault;
} #pragma mark 设置右边的开关
// 每个进入视野的cell 都循环利用(共用)一个arrow,switch,label
- (void)setAccessoryViewSwitch
{
if (_switch == nil) {
_switch = [[UISwitch alloc] init];
[_switch addTarget:self action:@selector(switchChange) forControlEvents:UIControlEventValueChanged];
} // 设置开关的状态
SettingItemSwitch *switchItem = (SettingItemSwitch *)_item;
_switch.on = !switchItem.off; // 右边显示开关
self.accessoryView = _switch;
// 由于是开关,所以要禁止选中本行
self.selectionStyle = UITableViewCellSelectionStyleNone;
} #pragma mark 开关状态改变
- (void)switchChange
{
SettingItemSwitch *switchItem = (SettingItemSwitch *)_item;
switchItem.off = !_switch.on;
} #pragma mark - 当cell的宽高改变了就会调用
// 父类方法,须要调节cell内部子控件的frame,仅仅有在layoutSubviews方法中,才最可靠\最有效
- (void)layoutSubviews
{
// 必须先调用父类的方法
[super layoutSubviews]; // 0.设置cell分隔线的位置 (从文字处開始)
_divider.frame = CGRectMake(self.textLabel.frame.origin.x, 0, self.contentView.frame.size.width + 100, 1.2); if (iOS7) return; // 下面是iOS6,设置cell占整个屏幕的宽度
[self makeCellFullWidth];
} // 下面是iOS6,设置cell占整个屏幕的宽度
- (void)makeCellFullWidth
{
// 在ios6中,cell的contentView的x默认是10,因此,要想让cell全屏宽,必须使用cell的x左移10,宽度+20,相当于把整个cell,先左平移,再扯宽 // 1.将cell的frame拉宽
CGRect cellF = self.frame;
// cell总体先左平移10
cellF.origin.x = -MakeCellToLeftBy;
// cell总体宽度再+20,这样cell的contentView就全屏宽了
CGFloat deltaW = MakeCellToLeftBy * 2;
cellF.size.width = [UIScreen mainScreen].bounds.size.width + deltaW;
self.frame = cellF; // 2.右边控件的frame (左移)
// accessoryView不属于contentView, 属于cell
CGRect accessF = self.accessoryView.frame;
accessF.origin.x = cellF.size.width - accessF.size.width - deltaW;
self.accessoryView.frame = accessF;
} @end

父类控制器的封装

BaseSettingController

//
// BaseSettingController.h
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// 父类,内部维护了一个tableView,子类提供数据源数组(GroupsArr) #import <UIKit/UIKit.h> #import "SettingGroup.h"
#import "SettingItem.h"
// 导入数据模型
// 右側是箭头的数据模型
#import "SettingItemArrow.h"
// 右側是开关的数据模型
#import "SettingItemSwitch.h" // 右边是子文本
#import "SettingItemLabel.h" // 全部声明的将要被存储到沙盒中的key
#import "SettingArchiveKeys.h" @interface BaseSettingController : UIViewController<UITableViewDataSource, UITableViewDelegate>
{
// 开放给子类用,父类仅仅负责初始化,子类负责加入一个个Group对象,一个group模型相应一个section
NSMutableArray *_allGroups; // 全部的组模型
} @property (nonatomic, weak, readonly) UITableView *tableView; @end
//
// BaseSettingController.m
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// 父类,内部维护了一个tableView,子类提供数据源数组(GroupsArr) #import "BaseSettingController.h"
#import "SettingCell.h" // 每个section之间的顶部间距
const int SectionHeaderMargin = 20;
@interface BaseSettingController () @end @implementation BaseSettingController
// 直接让tableView就是控制器的view
- (void)loadView
{
// 父类的组数组 初始化放在LoadView方法中,优点是,子类在viewDidLoad时,就已经拥有初始化的_allGroups,而不再须要先调用父类的viewDidLoad,然后才可向数组加入成员
_allGroups = [NSMutableArray array]; // 创建并维护自己的tableView,子类仅需提供数据源 groupsArr 就可以
[self createTableView]; } // 创建并维护自己的tableView,子类仅需提供数据源 groupsArr 就可以
- (void)createTableView
{
UITableView *tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame style:UITableViewStyleGrouped];
// 设置数据源和代理 为当前父控制器
tableView.delegate = self;
tableView.dataSource = self; // 设置全局统一的表格背景
// 假设是分组,则要先清空背景view,才可设置表格背景颜色(colorWithPattern平铺)
tableView.backgroundView = nil;
tableView.backgroundColor = kGlobalBg; // group状态下。sectionFooterHeight和sectionHeaderHeight是有值的
tableView.sectionFooterHeight = 0;
tableView.sectionHeaderHeight = SectionHeaderMargin; // 在tableView初始化的时候设置contentInset
// 在tableView展示完数据的时候给contentInset.top添加(20+44)的值
// 重要~~ ?? ???
if (iOS7) {
tableView.contentInset = UIEdgeInsetsMake(SectionHeaderMargin - 35, 0, 0, 0);
} // 先隐藏表格默认的分隔线,cell内部在依据所在的indexPath绘制underLine
tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.view = tableView; _tableView = tableView;
}
#pragma mark - 数据源
// 多少组
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// 返回组 数组的长度
return _allGroups.count;
}
// 各个组有多少行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// 取出组模型
SettingGroup *group = _allGroups[section];
// 返回组模型中成员---settingItems数组的长度
return group.items.count;
} // 每当有一个cell进入视野范围内就会调用。返回当前这行显示的cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// 1.创建一个SettingCell 自己定义的view
SettingCell *cell = [SettingCell settingCellWithTableView:tableView]; // 2.取出组模型
SettingGroup *group = _allGroups[indexPath.section];
// 3.取出组中的被点的cell模型,并赋值给自己定义的view,供其内部子控件使用
cell.item = group.items[indexPath.row];
// 依据所在的组,所在的行号,设置切割线的显示状态
cell.indexPath = indexPath; return cell;
} #pragma mark - 代理
// 点击了cell后的操作
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// 1.去除选中时的背景
[tableView deselectRowAtIndexPath:indexPath animated:YES];
// 2.取出这行相应的模型
SettingGroup *group = _allGroups[indexPath.section];
// 取出相应的cell数据源模型
SettingItem *item = group.items[indexPath.row]; // 3.取出这行相应模型中有block代码
if (item.operation) {
// 运行block
item.operation();
return;
} // 4.检測有没有要跳转的控制器
if ([item isKindOfClass:[SettingItemArrow class]]) {
// 将cell相应的数据源模型 转成详细的子类
SettingItemArrow *arrowItem = (SettingItemArrow *)item;
// 创建并跳转到指定的控制器
if (arrowItem.showVCClass) {
UIViewController *vc = [[arrowItem.showVCClass alloc] init];
[self.navigationController pushViewController:vc animated:YES];
}
}
} #pragma mark 返回每一组的header标题
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
// 取得组模型
SettingGroup *group = _allGroups[section];
// 返回组的头部标题
return group.header;
}
#pragma mark 返回每一组的footer标题
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
// 取得组模型
SettingGroup *group = _allGroups[section];
// 返回组的尾部标题
return group.footer;
} @end

子类设置控制器

//
// SettingController.h
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// 点击【设置】button跳转到本控制器,本控制器继承自BaseSettingController #import "BaseSettingController.h" @interface SettingController : BaseSettingController @end

//
// SettingController.m
// 25_彩票
//
// Created by beyond on 14-8-28.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// #import "SettingController.h" #import "PushNoticeController.h"
#import "ShareController.h"
#import "AboutController.h"
#import "HelpController.h"
#import "ProductController.h" @interface SettingController () @end @implementation SettingController
- (void)viewDidLoad
{
[super viewDidLoad]; // 1.第0组:3个
[self add0SectionItems]; // 2.第1组:6个
[self add1SectionItems];
} #pragma mark 加入第0组的模型数据
- (void)add0SectionItems
{
// 1.1.推送和提醒
SettingItemArrow *push = [SettingItemArrow itemWithIcon:@"MorePush" title:@"推送和提醒"];
push.showVCClass = [PushNoticeController class];
// copy状态下的block(堆里面的block)会对里面所使用的外界变量 产生 强引用
// __weak SettingController *setting = self;
// __unsafe_unretained // 1.2.摇一摇机选
SettingItemSwitch *shake = [SettingItemSwitch itemWithIcon:@"handShake" title:@"摇一摇机选"];
shake.key = ILSettingShakeChoose; // 1.3.声音效果
SettingItemSwitch *sound = [SettingItemSwitch itemWithIcon:@"sound_Effect" title:@"声音效果"];
sound.key = ILSettingSoundEffect; SettingGroup *group = [[SettingGroup alloc] init];
group.items = @[push, shake, sound];
[_allGroups addObject:group];
} #pragma mark 加入第1组的模型数据
- (void)add1SectionItems
{
// 2.1.检查新版本号
SettingItemArrow *update = [SettingItemArrow itemWithIcon:@"MoreUpdate" title:@"检查新版本号"];
update.operation = ^{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"眼下已是最新版本号了" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
}; // 2.2.帮助
SettingItemArrow *help = [SettingItemArrow itemWithIcon:@"MoreHelp" title:@"帮助"];
help.showVCClass = [HelpController class]; // 2.3.分享
SettingItemArrow *share = [SettingItemArrow itemWithIcon:@"MoreShare" title:@"分享"];
share.showVCClass = [ShareController class]; // 2.4.查看消息
SettingItemArrow *msg = [SettingItemArrow itemWithIcon:@"MoreMessage" title:@"查看消息"]; // 2.5.产品推荐
SettingItemArrow *product = [SettingItemArrow itemWithIcon:@"MoreNetease" title:@"产品推荐"];
product.showVCClass = [ProductController class]; // 2.6.关于
SettingItemArrow *about = [SettingItemArrow itemWithIcon:@"MoreAbout" title:@"关于"];
about.showVCClass = [AboutController class]; SettingGroup *group = [[SettingGroup alloc] init];
group.items = @[update, help, share, msg, product, about];
[_allGroups addObject:group];
} @end

iOS_25_彩票设置的cell的数据源模型的封装的更多相关文章

  1. 【swift,oc】ios开发中巧用自动布局设置自定义cell的高度

    ios开发中,遇到自定义高度不定的cell的时候,我们通常的做法是抽取一个frame类,在frame类中预算好高度,再返回. 但是苹果出来自动布局之后...春天来了!!来看看怎么巧用自动布局设置自定义 ...

  2. 网易彩票-我的彩票-设置-cell跳转界面

    1. 点击“cell”推出对应的界面 1.1 新建group,名为:Setting 路径:MYLottery(我的彩票)->Controller 1.2 新建Cocoa Touch Class, ...

  3. IOS第八天(7:UITableViewController新浪微博,cell 复用的简单写法优化和cell高度从模型中获取)

    *********** #import "HMViewController.h" #import "HMStatus.h" #import "HMSt ...

  4. [iOS微博项目 - 4.1] - cell的frame模型

    github: https://github.com/hellovoidworld/HVWWeibo A.cell的frame模型设计 1.需求 每个cell都有一个frame实例引用 frame模型 ...

  5. 利用PHPExcel导出Excel并设置Excel格式以及数据源

    浏览:23969 发布日期:2013/07/24 分类:技术分享 代码有点长,读起来有点累.先来个截图 导出的Excel太宽了,所以将后面的列宽重新调整了再截的图 功能包括: 1.设置单元格格式,包括 ...

  6. iOS_25_彩票骨架搭建+导航栏适配

    终于效果图: Main.storyboard 初始化的控制器是:导航控制器 它的根控制器是:TabBarController TabBarController的底部是一个自己定义的TabBar 里面加 ...

  7. Primefaces dataTable设置某个cell的样式问题

    设置primefaces dataTable的源网段列的Cell可以编辑,当回车键保存时,判断是否输入的网段合法,如果不合法就显示警告信息,并将这个不合法的数据用红色表示.问题是,怎么给这一个cell ...

  8. UICollectionView设置item(cell)之间间距为0(紧挨在一起的效果)

    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; self.layout = layout ...

  9. DataGridView中在新增行时怎样设置每个Cell单元格的字体样式

    场景 DataGridView怎样实现添加.删除.上移.下移一行: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/10281414 ...

随机推荐

  1. hdoj--5233--Gunner II(map+queue&&二分)

     Gunner II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Tot ...

  2. hdoj--1518--Square(dfs)

    Square Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Su ...

  3. Human Gene Functions(dp)

    http://poj.org/problem?id=1080 #include <stdio.h> #include <stdlib.h> #include <strin ...

  4. Python描述符:property()函数的小秘密

    描述符:将某种特殊类型的类的实例指派给另一个类的属性(注意:这里是类属性,而不是对象属性).而这种特殊类型的类就是实现了__get__,__set__,__delete__这三个方法中的一个或多个的新 ...

  5. yaml标记语言的简介

    今天遇到yml这个文件,挺懵的.也是百度了一把. 这篇博文不错:http://www.ibm.com/developerworks/cn/xml/x-1103linrr/ 这图画得不错:http:// ...

  6. 消除svn选定(checkout)桌面上文件显示一大堆问号。

    图片: 解决方法一: 桌面右键选择TortoiseSVN——>点击Settings,如下图,选中Icon Overlays(图标覆盖),去勾选Fixed drives(本地磁盘),点击确定,按F ...

  7. web前端利用HTML代码显示符号

    HTML常用符号代码:                       ´ ´ © © > > µ µ ® ® & & ° ° ¡ ¡     » » ¦ ¦ ÷ ÷ ¿ ¿ ...

  8. Android 微博sdk接入授权指南

    1:首先在微博官方注册账号,官方地址是:http://open.weibo.com/然后创建一个新应用.     2:当然我们得现在自己电脑上创建一个应用,例如包名叫com.winorout.weib ...

  9. halcon 模板匹配 -- find_shape_model

    find_shape_model(Image : :  //搜索图像 ModelID, //模板句柄 AngleStart,  // 搜索时的起始角度 AngleExtent, //搜索时的角度范围, ...

  10. Python之first script

    1 A first script 1) script1.py - imports a Python module (libraries of additional tools) to fetch th ...