码迷,mamicode.com
首页 >  
搜索关键字:self    ( 14215个结果
block的循环引用
1、创建block用copy修饰,拷贝到堆上 2、之前一直用这种写法,但会碰到提前释放的状态 __weak typeof(self)wakeself = self; 3、就用弱指针指向self,在block内部对weakSelf产生一个强引用,就解决了提前释放的问题 @weakify(self); ...
分类:其他好文   时间:2017-04-24 17:19:59    阅读次数:134
面向对象之__setattr__,__delattr__,__getattr__
class Foo: x=1 def __init__(self,y): self.y=y def __getattr__(self, item): print('----> from getattr:你找的属性不存在') def __setattr__(self, key, value): pri... ...
分类:其他好文   时间:2017-04-24 17:17:36    阅读次数:155
反射、定制数据类型
Client端: class FtpClient: 'ftp客户端,但是还没有实现具体的功能' def __init__(self,addr): print('正在连接服务器[%s]'% addr) self.addr = addr Server端: from FtpClient import Ft ...
分类:其他好文   时间:2017-04-24 16:30:17    阅读次数:236
@classmethod, @staticmethod和@property这三个装饰器的使用对象是在类中定义的函数。下面的例子展示了它们的用法和行为:
class MyClass(object): def __init__(self): self._some_property = "properties are nice" self._some_other_property = "VERY nice" def normal_method(*args... ...
分类:其他好文   时间:2017-04-24 12:38:39    阅读次数:269
Python面向对象类成员特性
特性的存在就是将方法伪装成字段。property把类方法当做普通字段去调用,即用对象调用的时候后面不用加括号#!/usr/bin/envpython#_*_coding:utf-8_*_classFoo:@propertydefCharacteristic(self):print("类方法的特性")#创建一个对象obj=Foo()#调用类方法的时候方法后面不用加括..
分类:编程语言   时间:2017-04-24 12:31:26    阅读次数:182
busTrace VS HW protocol analyzer - 好东西推荐
最近在找PCIe/NVMe协议分析仪,发现一款软件分析仪:busTRACE,非常不错的工具,对于从事协议开发的同胞们,是个福利,下面把硬件和软件两种分析仪的各自的优势比较了一下(来自busTrace文档),供参考学习: Hardware Analyzer Advantages over busTRA ...
分类:其他好文   时间:2017-04-24 12:08:42    阅读次数:277
Selenium基于Python web自动化基础二 -- 免登录、等待及unittest单元测试框架
2、火狐的profile文件记录信息实现 4、万能验证码、去掉验证码 2、隐形等待 3、显性等待 三、unittest单元测试框架 ...
分类:编程语言   时间:2017-04-24 01:02:24    阅读次数:244
iOS响应事件传递, nextResponder研究
这里,我们考虑以下二种情况。 问题1。 如何调用父view的controller里面的方法? 答案如下:[[self superview ].nextResponder method];[[[self superview ] nextResponder] method];[self.nextResp ...
分类:移动开发   时间:2017-04-24 00:03:28    阅读次数:263
给导航条设置成颜色的背景图像 : UIGraphicsBeginImageContext ...
self.navigationBar.setBackgroundImage(createImageWithColor(UIColor.clear),for:.default)//////////////////////funccreateImageWithColor(_color:UIColor)->UIImage{returncreateImageWithColor(color,size:CGSize(width:1,height:1))}funccreateImageWithColor(_color..
分类:其他好文   时间:2017-04-23 23:16:47    阅读次数:436
iOS uitableView响应事件被拦截
//加入手势,点击屏幕其它区域关闭键盘操作 UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(SEL)]; gesture.numberOfTa ...
分类:移动开发   时间:2017-04-23 18:56:31    阅读次数:343
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!