IOS开发技巧-不定期更新

来源:互联网 发布:数据恢复精灵 注册码 编辑:程序博客网 时间:2024/06/06 09:02

1.检查当前ViewController是present 还是push

- (BOOL)isModalPresent {    return self.presentingViewController.presentedViewController == self            || self.navigationController.presentingViewController.presentedViewController == self.navigationController            || [self.tabBarController.presentingViewController isKindOfClass:[UITabBarController class]];}

2.NSDictionary 和 NSData 转换

NSDictionary -> NSData:NSData *myData = [NSKeyedArchiver archivedDataWithRootObject:myDictionary];NSData -> NSDictionary:NSDictionary *myDictionary = (NSDictionary*) [NSKeyedUnarchiver unarchiveObjectWithData:myData];




0 0