iOS 2015-3-9笔记
来源:互联网 发布:淘宝搜索词查询在哪里 编辑:程序博客网 时间:2024/05/20 23:33
0x1 = 1 (0001)
0x1 << 1 = 2 (0010)
0x1 << 2 = 4 (0100)
0x1 << 3 = 8 (1000)
typedef enum {
MessageNotificationTypePraise =0x1,
MessageNotificationTypeUpPopular =0x1 <<1,
MessageNotificationTypeFriendAdd =0x1 <<2,
MessageNotificationTypeFriendAdded =0x1 <<3,
MessageNotificationTypeActivityUpdate =0x1 <<4,
MessageNotificationTypeNewFriendActivity =0x1 <<5,
MessageNotificationTypeGerenalFriendWatchTimesRestore =0x1 <<6,
MessageNotificationTypeBeAccept =0x1 <<7,
MessageNotificationTypeTo_evaluate_friend =0x1 <<8,
MessageNotificationTypeCongenial_person =0x1 <<9,
MessageNotificationTypeBeValuate =0x1 <<kMessageNotifityTypeOffsetMax,
MessageNotificationTypeAll =0x7F,
}MessageNotificationType;
优点:左移位一位 做 与或 运算方便!2.hash表做代理列表
@property (nonatomic,strong)NSHashTable *delegateList;
添加:[self.delegateListaddObject:delegate];
回调:- (void)callbackDelegates:(NSHashTable *)delegates withSelector:(SEL)selector withObject:(id)obj withObject:(id)obj1
{
if (delegates.count >0)
{
for (id<MSPushModelManagerDelegate> delegatein delegates)
{
if ([delegate respondsToSelector:selector])
{
void (*callFunction)(id,SEL,id, id) = (void (*)(id,SEL,id, id))objc_msgSend;
callFunction(delegate, selector, obj, obj1);
}
}
}
}
self.contactMainQueue =dispatch_queue_create("com.contact.contactMain",DISPATCH_QUEUE_SERIAL);
注意:apple推荐用倒置域名来命名 方便调试的时候输出#pragma mark - 线程处理
void processToQueue(dispatch_queue_t queue,void(^block)(void))
{
dispatch_async(queue, block);
}
processToQueue(self.contactMainQueue, ^{
NSLog(@"有序");
});
- iOS 2015-3-9笔记
- iOS 9 变化笔记
- iOS笔记9
- IOS学习笔记3
- IOS学习笔记-3
- ios学习笔记3
- iOS笔记3
- iOS笔记 (3)
- iOS笔记3
- ios开发笔记(3)
- iOS 笔记3 TableView
- 9、iOS并发编程笔记
- IOS学习笔记 (3)
- IOS-学习笔记(3)
- iOS面试笔记(3)
- Swift学习笔记(3)iOS 9 中的网络请求
- iOS笔记
- iOS笔记
- java代码中重启服务
- deep learning 开山祖师
- ajax实现省市联动(version 1)
- 看好你的门-验证机制被攻击(9)-不严谨的异常处理
- Linux下修改host文件
- iOS 2015-3-9笔记
- 用C++实现简单的顺序表
- 外观模式Python版--牛市股市还会亏钱?
- Maven的POM.xml详解(五)
- 让那些做面试官的屌丝lead不再抖脚系列(二)---同步异步探讨->线程的一些方法
- VS2010 开发ActiveX控件 设置测试方式 .
- jsp 路径问题
- 看好你的门-验证机制被攻击(10)-不够安全的敏感信息存储
- Java语言的十二大特色