- 博客(1)
- 资源 (10)
- 收藏
- 关注
原创 ios UIBarButtonItem rightBarButtonItem Title 设置不了
// rightBarButtonItem Title 设置了不起作用,非要在alloc的时候就设置title才有效 UIBarButtonItem *rightBarItem = [[UIBarButtonItem alloc]initWithTitle:@"退出" style:UIBarButtonItemStyleBordered target:self action:@selec
2015-06-29 13:06:42 6707
ios 生成二维码图片libqrencode
导入 libqrencode文件,很小的
添加 #import "QRCodeGenerator.h"
@property (strong , nonatomic) UIImageView* qRImageView;
- (void)viewDidLoad
{
[super viewDidLoad];
self.qRImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 400)];
[self.view addSubview:self.qRImageView];
}
-(IBAction)qrBtnPress:(id)sender
{
self.qRImageView.image = [QRCodeGenerator qrImageForString:@"二维码存储的字符串信息 asddsdd" imageSize:self.qRImageView.bounds.size.width];
}
2015-07-10
全国省市县plist xml
//附上一段object-c解析代码
NSArray *ary = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"ProvinceCityDistrict" ofType:@"plist"]];
for (int i = 0; i < ary.count; i ++) {
NSDictionary *province = ary[i];
for(NSString *akey in province){
NSLog(@"%@",akey);
NSDictionary *p0 = province[akey];
[mProvinceAry addObject:akey];
for(NSString *city in p0){
NSDictionary *citys = p0[city];
for(NSString *shen in citys){
NSLog(@"%@",shen);
NSMutableArray *xians = citys[shen];
for (int y = 0; y < xians.count; y++) {
NSLog(@"%@",xians[y]);
}
}
}
}
}
2015-06-12
创建或读取Excel表
public static int createdExcel(String PATH, List list, String title, String[] rowsName, String merged) {
try {
File myFile = new File(PATH);
if (!myFile.exists()) {
myFile.createNewFile();
}
WritableWorkbook wbook = Workbook.createWorkbook(myFile); // 创建一个可写返回工作薄同给定文件名
WritableSheet wsheet = wbook.createSheet(title, 0); // sheet名称
// 设置字体
WritableFont wfont = new WritableFont(WritableFont.createFont("宋体"), 10,
WritableFont.BOLD);
WritableCellFormat wcfFC = new WritableCellFormat(wfont);
wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); //单元格边缘线格式设置
wcfFC.setAlignment(jxl.format.Alignment.CENTRE); // 居中对齐
wcfFC.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE); //垂直居中
//wcfFC.setBackground(jxl.format.Colour.BLUE); // 蓝色底
// 设置行高和列宽
//wsheet.setColumnView(列数, 列宽);
//wsheet.setRowView(行数, 行高);
// 开始生成主体内容
for (int i = 0 ; i < rowsName.length; i++) {
wsheet.addCell(new Label(i, 0, rowsName[i], wcfFC));
wsheet.setColumnView(i, 12);
}
wfont = new WritableFont(WritableFont.createFont("宋体"), 10,
WritableFont.NO_BOLD);
wcfFC = new WritableCellFormat(wfont);
wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); //单元格边缘线格式设置
//是数字时的格式化
// jxl.write.NumberFormat numberFormat = new jxl.write.NumberFormat(NumberFormat.CURRENCY_DOLLAR);
// jxl.write.WritableCellFormat wcfFCNUMBER = new jxl.write.WritableCellFormat(wfont,numberFormat);
// wcfFCNUMBER.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); //单元格边缘线格式设置
// wcfFCNUMBER.setAlignment(jxl.format.Alignment.CENTRE); // 居中对齐
// wcfFCNUMBER.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE); //垂直居中
//是数字时的格式化
wcfFC.setWrap(true);
//合并单元格操作
//wsheet.mergeCells(坐标列1, 坐标行1, 坐标列2, 坐标行2)
for (int i = 0; i < list.size(); i++) {
String[] args = (String[]) list.get(i);
for (int j = 0; j < args.length; j ++) {
if (args[j].length()<15 ) {
wsheet.addCell(new jxl.write.Number(j, i+1, Float.parseFloat(args[j]), wcfFC));
} else {
wsheet.addCell(new Label(j, i+1, args[j], wcfFC));
}
}
if (merged.indexOf("," + (i+1) + ",") >=0) {
wsheet.mergeCells(0, i+1, args.length-1, i+1);
wsheet.setRowView(i, 1000);
}
//打印分页符
if (i % 20 == 0) {
//wsheet.addRowPageBreak(i);
}
}
// 主体内容生成结束
wbook.write(); // 写入文件
wbook.close();
return 1;
} catch (Exception ex) {
ex.printStackTrace();
return 0;
}
}
2012-08-07
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人