17.MVC

1.基本概念

  1. 使用字典的坏处 : 一般情况下,设置数据和取出数据都使用“字符串类型的key”,编写这些key时,编译器不会有任何友善提示,需要手敲dict[@”name”] = @”Jack”;NSString *name = dict[@”name”] ; 手敲字符串key,key容易写错 , Key如果写错了,编译器不会有任何警告和报错,造成设错数据或者取错数据
  2. 使用模型的好处 , 所谓模型,其实就是数据模型,专门用来存放数据的对象,用它来表示数据会更加专业 , 模型设置数据和取出数据都是通过它的属性,属性名如果写错了,编译器会马上报错,因此,保证了数据的正确性 , 使用模型访问属性时,编译器会提供一系列的提示,提高编码效率 app.name = @”Jack”; NSString *name = app.name;
  3. 字典转模型的过程最好封装在模型内部 , 模型应该提供一个可以传入字典参数的构造方法- (instancetype)initWithDict:(NSDictionary )dict ; + (instancetype)xxxWithDict:(NSDictionary )dict;
  4. instancetype在类型表示上,跟id一样,可以表示任何对象类型
    instancetype只能用在返回值类型上,不能像id一样用在参数类型上
    instancetype比id多一个好处:编译器会检测instancetype的真实类型
  5. Xib文件的使用 : Xib文件可以用来描述某一块局部的UI界面 , Xib文件的两种加载方法 :
    1 ) : NSArray *objs = [[NSBundle mainBundle] loadNibNamed:@”MJAppView” owner:nil options:nil] ; 这个方法会创建xib中的所有对象,并且将对象按顺序放到objs数组中(如果xib如右图所示,那么objs数组中依次会有3个对象:1个UIView、1个UIButton、1个UISwitch)
    2 ) : bundle参数可以为nil,默认就是main bundle
    UINib *nib = [UINib nibWithNibName:@”MJAppView” bundle:[NSBundle mainBundle]];
    NSArray *objs = [nib instantiateWithOwner:nil options:nil];在开发阶段,面向开发者的是xib文件; 当把应用装到手机上时,xib文件就会转为nib文件
  6. Xib和storyboard对比–>1) 共同点:都用来描述软件界面 ; 都用Interface Builder工具来编辑 2 ) 不同点 : Xib是轻量级的,用来描述局部的UI界面 ; Storyboard是重量级的,用来描述整个软件的多个界面,并且能展示多个界面之间的跳转关系
  7. view的封装 : 如果一个view内部的子控件比较多,一般会考虑自定义一个view,把它内部子控件的创建屏蔽起来,不让外界关心 ; 外界可以传入对应的模型数据给view,view拿到模型数据后给内部的子控件设置对应的数据
  8. UIFont代表字体,常见创建方法有以下几个:+ (UIFont )systemFontOfSize:(CGFloat)fontSize ; 系统默认字体 + (UIFont )boldSystemFontOfSize:(CGFloat)fontSize ; 粗体 + (UIFont *)italicSystemFontOfSize:(CGFloat)fontSize ; 斜体 设置按钮的文字字体(需要拿到按钮内部的label来设置)btn.titleLabel.font = [UIFont systemFontOfSize:13];
  9. Xcode自带头文件的路径 : /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/Frameworks/UIKit.framework/Headers
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected end-of-input within/between Object entries; nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected end-of-input within/between Object entries at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 7, column: 17] at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:391) ~[spring-web-5.3.20.jar:5.3.20] at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.read(AbstractJackson2HttpMessageConverter.java:343) ~[spring-web-5.3.20.jar:5.3.20] at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:185) ~[spring-webmvc-5.3.20.jar:5.3.20] at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:160) ~[spring-webmvc-5.3.20.jar:5.3.20] at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:133) ~[spring-webmvc-5.3.20.jar:5.3.20] at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:122) ~[spring-web-5.3.20.jar:5.3.20] at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:179) ~[spring-web-5.3.20.jar:5.3.20] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:146) ~[spring-web-5.3.20.jar:5.3.20] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.20.jar:5.3.20] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.20.jar:5.3.20] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.20.jar:5.3.20] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.20.jar:5.3.20] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067) ~[spring-webmvc-5.3.20.jar:5.3.20] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.20.jar:5.3.20] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) [spring-webmvc-5.3.20.jar:5.3.20] at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) [spring-webmvc-5.3.20.jar:5.3.20] 这个错误啥意思?
07-22

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值