IOS 问题集锦
问题一
Tag: NSUserDefaults NSDictionary NSMutableDictionary You should know: You can only store things like NSArray,NSDictionary, NSString, NSData, NSNumber, and NSDate in `NSUserDefaults.
我将一个用户的信息以NSDictionary形式放在NSUserDefaults。当需要对用户信息进行更新时,首先将NSDictionary转换成NSMutableDictionary,因为NSDictionary是不能更改的对象, 对NSMutableDictionary进行更新,然后将NSMutableDictionary保存到NSUserDefaults。 注意,NSMutableDictionary是NSDictionary的子类,所以也可以保存,保存后就不可修改啦。
NSDictionary * userDic = [self getuser];
NSMutableDictionary *muserDic = [userdic mutablecopy];
[muserdic setvalue:name forkey:@"name"];
[self setuser:muserdic];
问题二
Tag: Segue View Controller Navigation Controller 跳转
segue 跳转 动画效果:上下切换 可跳转对象:navigationcontroller & viewcontroller 跳:; 回:;
view controllers 跳转
-
pushviewcontroller 动画效果:左右切换 原理:往NavigationController里面压入view controller
可跳转对象:viewcontroller 跳:; 回:; 回:; 注意:这里往navigationcontroller里面压viewcontroller,如果压navigationcontroller,则报错 'Pushing a navigation controller is not supported' -
presentViewController 动画效果:上下切换 原理:临时弹出一个navigationcontroller或者viewcontroller收集用户信息 可跳转对象:navigationcontroller & viewcontroller
跳: animated:YES completion:nil]; 回:; -
presentModalViewController 动画效果:左右切换 可跳转对象:navigationcontroller & viewcontroller
跳:; 回:;
问题三: View controllers 之间是如何传递参数 http://www.cnblogs.com/likwo/archive/2011/03/02/1968785.html segue传递参数也很方便
问题四: Http Return Nil Bad URL Error With NSURLRequest http://stackoverflow.com/questions/11362153/bad-url-error-with-nsurlrequest
问题五: iOS中如何实现TextView仅可粘贴不可输入的功能 http://my.oschina.net/u/728866/blog/156763