- 博客(45)
- 收藏
- 关注
原创 unittest 单元测试
分为表达用例,收集用例,执行用例,生成报告四部分1.表达用例负责实现功能的函数,一般放在一个单独的py文件中2.收集用例(一个测试类)(1)定义一个测试类,继承unittest.TestCase(2)以test_开头,定义测试函数(3)每一个test_函数就是一个测试用例(4)内部用assertxxx进行断言 例如:assertEqual(a,b),assertIn(a,b), assertTrue(a)(5)需要导入unittest包(6)setUp:类下面的每一个用例
2020-06-27 23:23:32 387
原创 python对excel文件的读取操作
openpyxl: .xlsx读写操作前提条件:需要先pip安装 pip install openpyxl1.加载xlsx文件,生成workbook对象wb = load_workbook(path)2.根据sheet名获取对应sheet数据sh = wb["register"]3.获取单元格对应得对象 下标从1开始cel = sh.cell(2, 2) print(list(sh.rows)[0]) #按行获取list(sh.rows)[index]4.获取对应的值 .va
2020-06-27 23:13:34 258
原创 pycharm启动时候出现 fail to load jvm dll
最近打算学下python,就安装了pycharm,没想到刚安装完打开就提示"fail to load jvm dll.....if you already have a 32-bit JDK install....",学习大业才迈出第一步就被绊住了。。。。。。。网上给了两种解决方法方法一:安装Microsoft Visual C++ 2010试了下发现我的Microsoft Visual C++ 版本高于2010,此方法对我无效方法二:下载JDK,并配置环境变量JAVA_HOME...
2020-05-27 22:56:16 10274 1
原创 自适应高度
1.MyCell.h#import <UIKit/UIKit.h>@interface MyCell : UITableViewCell@property(nonatomic,retain)UIImageView *picImageView;@property(nonatomic,retain)UILabel *newsLabel;@end2.MyCell.m@implementation M
2020-05-27 21:59:20 275
原创 简易视频播放器
注:用xib拽的,可以去工程里找,这里只写代码部分可以实现视频播放,可横竖屏切换,可快进快退,暂停 AppDelegate.m#import "AppDelegate.h"#import "PlayerViewController.h"//#import "RootViewController.h"@interface AppDelegate ()@end@implementation App
2016-01-14 22:02:44 551
原创 数据解析的基类
已经写好了,可以直接用,用的时候只需要写网址就好,model也已经写好了ZCGBaseModel.h#import <Foundation/Foundation.h>@interface ZCGBaseModel : NSObject+(NSMutableArray *)baseModelByArr:(NSArray *)arr;ZCGBaseModel.m#import "ZCGBaseMode
2016-01-14 16:52:37 267
原创 自定义瀑布流
不规则的图片排列起来,改数据直接用就可以ZCGFlowLayout.h#import <UIKit/UIKit.h>@class ZCGFlowLayout;@protocol ZCGFlowLayoutDelegate <NSObject>-(CGFloat)ZCGFlowLayout:(ZCGFlowLayout *)flowLayout heightForRowAtIndexPath:(NSI
2016-01-14 16:40:08 268
原创 FMDB(用SQLite存数据)
完成查询,删除,添加,插入等功能1.先写一个单例+ (instancetype)shareDataBase;+ (instancetype)shareDataBase{ static DataBaseManager *manager = nil; static dispatch_once_t once; dispatch_once(&once, ^{ mana
2016-01-14 16:31:51 285
原创 加密和解密
有四种加密方式**1.公钥私钥的加密和解密** //公钥和私钥称为非对称加密解密,通过公钥和私钥的钥匙对儿进行对数据加密和解密 //公钥一般存才客户端,私钥一般存在服务器端,而且私钥必须要加密,保证安全不猛泄露 //公钥对数据加密之后,将密文发送到服务器端,服务器再利用私钥对密文进行解密,服务器信息通过私钥进行加密,再通过客户端的公钥进行解密,从而显示内容 /
2016-01-14 09:03:53 986
原创 多线程
主要有四种准备工作#import "ViewController.h"#import "MyOperation.h"@interface ViewController ()- (IBAction)buttonAction:(id)sender;@property(nonatomic,retain)UIImageView *imageView;@end@implementation ViewC
2016-01-13 16:55:50 205
原创 xib,AFN的网络请求,判断网络状态
使用方法和storyboard基本相同,但是只能创建view,tableViewcell可以直接铺,省去计算坐标的过程,比较省事创建xib文件的方式 1.在创建文件的时候,选择also create xib file,就会自动创建一个xib文件,文件和xib和关联好了,直接就可以用 2.需要在empty里创建一个xib文件,然后指定files owner,像文件里拖拽一个view,指定
2016-01-13 16:38:22 635
原创 UIView的四种动画(类似于下拉刷新的动画效果)
定义属性@property(nonatomic,retain)UIView *myView;创建- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.myView=[[UIView alloc
2016-01-13 10:29:07 770
原创 基本动画效果(点赞,长按抖动,播放器转盘,水滴效果)
定义属性- (IBAction)trainsformAction:(id)sender;@property(nonatomic,retain)UIImageView *imageView;@property(nonatomic,assign)BOOL isRotation;@property(nonatomic,retain)UIImageView *secImageView;@propert
2016-01-13 09:04:40 4477
原创 键盘和输入框上移
动画和键盘一起向上平移定义两个属性@property(nonatomic,retain)UITextField *textField;@property(nonatomic,retain)UIView *myView;创建输入框和view- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup aft
2016-01-13 08:46:22 514
原创 KVO通知中心
//KVO key-value-Observer 键值对观察者 //它主要功能就是用来监听,属性里的内容发生的变化 //监听的对象,必须是观察者的属性 //参数二:要监听的属性,要和keypath保持一致,否则不会触发方法 //参数三:触发的条件,就是旧值和新值变化的时候// self.stu=[[Student alloc] init];//
2016-01-13 08:34:28 283
原创 数据库
数据库包括:打开数据库,新建数据库表,插入,删除,更新,查询 先建一个student.h#import <Foundation/Foundation.h>@interface Student : NSObject@property(nonatomic,copy)NSString *name;@property(nonatomic,copy)NSString *sex;@property(non
2016-01-04 18:01:33 261
原创 沙盒存储收藏的练习(豆瓣)
AppDelegate.m#import "AppDelegate.h"#import "ViewController.h"#import "MyViewController.h"@interface AppDelegate ()@end@implementation AppDelegate- (BOOL)application:(UIApplication *)application di
2016-01-03 12:40:46 245
原创 对本地文件的管理
//1.获取沙盒路径 NSString *path=[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, 1, YES)lastObject]; //2.拼接文件夹路径 NSString *docPath=[path stringByAppendingPathComponent:@"dengdeng"];
2016-01-03 12:27:35 396
原创 把数据保存到本地
Student.h#import <Foundation/Foundation.h>@interface Student : NSObject<NSCoding>@property(nonatomic,copy)NSString *name;@property(nonatomic,copy)NSString *sex;@property(nonatomic,assign)NSInteger a
2016-01-03 12:23:02 1523
原创 网络数据获取的封装
可以直接用,无需再重新写, 下面是三个封装,用一个就可以 NetworkingTool.h#import <Foundation/Foundation.h>@protocol NetworkingToolDelegate <NSObject>-(void)bringResult:(id)result;@endtypedef void(^Block)(id result);typedef NS_EN
2016-01-03 12:17:30 244
原创 CollectionView
瀑布流, 和tableview类似,但可以一行铺多个MyCell.h#import <UIKit/UIKit.h>@interface MyCell : UICollectionViewCell@property(nonatomic,retain)UIImageView *picImageView;@property(nonatomic,retain)UILabel *label;@endMyCe
2016-01-03 12:00:28 215
原创 Get和post网络请求
一般block用的比较多#import "ViewController.h"@interface ViewController ()<NSURLSessionDelegate>- (IBAction)asynAction:(id)sender;- (IBAction)synProtocolGET:(id)sender;- (IBAction)synProtocolPOST:(id)sender
2016-01-03 11:54:10 246
原创 XML和json解析
DomTool.h#import <Foundation/Foundation.h>#import "Student.h"@interface DomTool : NSObject-(void)startDom;@property(nonatomic,retain)NSMutableArray *stuArr;+(NSMutableArray *)startXMLDom;@endDomToo
2016-01-03 11:46:02 338
原创 actionSheet和从相册选取图片
UIActionSheet:弹出提示框UIActionSheet *actionSheet=[[UIActionSheet alloc]initWithTitle:@"图片" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"从相册选取" otherButtonTitles:@"第一项",@"第二项", nil]; a
2015-12-27 16:01:30 399
原创 tableView简化写法
#import "MyTableViewController.h"@interface MyTableViewController ()@property(nonatomic,retain)NSMutableArray *arr;@end@implementation MyTableViewController- (void)viewDidLoad { [super viewDidLoad
2015-12-27 15:57:45 193
原创 tabbarController
在AppDelegate.m中写#import "AppDelegate.h"#import "RootViewController.h"#import "SecondViewController.h"#import "ThirdViewController.h"#import "FouthViewController.h"#import "FifthViewController.h"#
2015-12-27 15:52:58 183
原创 Block
传值,只能从后往前传,需要三部..RootViewController.m 准备工作 先写用来实现功能的blockvoid(^newBlock)(NSString *)=^(NSString *str){ NSLog(@"%@",str); };1.要把block的遥控器从前往后通过属性进行传值,SecondViewController.h定义一个属性接受@property
2015-12-27 15:49:24 228
原创 tableView联动(省市区)
#import "RootViewController.h"#define WIDTH self.view.frame.size.width#define HEIGHT self.view.frame.size.height@interface RootViewController ()<UITableViewDataSource,UITableViewDelegate>@property(non
2015-12-27 15:37:45 469
原创 tableView下移,拉大图片
1.下移 //第一种 UIImageView *imageView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 200)]; imageView.image=[UIImage imageNamed:@"c4.jpg"]; //给tableView添加头视图,一般在头视图上放轮播图等 self.tableView
2015-12-27 15:35:13 376
原创 TableView编辑
准备工作 1.Student.h#import <Foundation/Foundation.h>@interface Student : NSObject@property(nonatomic,copy)NSString *name;@property(nonatomic,copy)NSString *phone;@property(nonatomic,copy)NSString *add
2015-12-27 15:31:49 397
原创 model传值
1.Student.h#import <Foundation/Foundation.h>@interface Student : NSObject@property(nonatomic,copy)NSString *name;@property(nonatomic,copy)NSString *hobby;@property(nonatomic,copy)NSString *address;@
2015-12-27 15:15:08 525
原创 TableView界面传值和TableViewCell使用
初始化-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNilP{ self=[super initWithNibName:nibNameOrNil bundle:nibBundleOrNilP]; if (self) { self.arr=[NSMutableArr
2015-12-27 14:58:21 3100 1
原创 文章标题
UITableView 自带滑动效果 创建方法和UIView相同创建UITableView *tableView=[[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain]; tableView.backgroundColor=[UIColor yellowColor]; [sel
2015-12-27 14:38:28 204
原创 文章标题
界面传值<协议六步>准备工作#import "AppDelegate.h"#import "RootViewController.h"@interface AppDelegate ()@end@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptio
2015-12-27 14:23:13 223
原创 UINavigationController(导航控制器)
UINavigationController(导航控制器) 界面可以滑动,多用于做轮播图 //修改导航视图控制器的半透明效果,默认是YES self.navigationController.navigationBar.translucent=NO; //修改背景颜色 self.navigationController.navigationBar.barTintColor=
2015-12-27 14:07:51 212
原创 UIPageControl
UIPageControl 给图片添加可以动的点AppDelegate.m#import "AppDelegate.h"#import "RootViewController.h"@interface AppDelegate ()@end@implementation AppDelegate- (BOOL)application:(UIApplication *)application did
2015-12-20 15:08:24 283
原创 UIScrollView
UIScrollView UIScrollView可以让屏幕滚动AppDelegate.m#import "AppDelegate.h"#import "RootViewController.h"@interface AppDelegate ()@end@implementation AppDelegate- (BOOL)application:(UIApplication *)applica
2015-12-20 14:53:56 290
原创 控件:滑块,加减键
控件:滑块,加减键1.音量加减键UIStepper UIStepper *stepper=[[UIStepper alloc] initWithFrame:CGRectMake(100, 200, 100, 40)]; stepper.backgroundColor=[UIColor yellowColor]; stepper.tintColor=[UIColor redColor]
2015-12-20 14:38:49 604
原创 手势
手势控制图片,对其进行放大,缩小,旋转等操作代码块-(void)viewDidLoad{ // 1.先创建一个图片,要对其进行操作 self.view.backgroundColor=[UIColor whiteColor]; self.imageView=[[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 200,
2015-12-20 14:17:02 336
原创 指针
//// main.m// day7//// Created by dllo on 15/11/19.// Copyright © 2015年 dllo. All rights reserved.//#import int main(int argc,const char * argv[]) {
2015-11-19 21:22:57 232
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人