第一周因为自身原因原因浪费了几天时间,没有达到要求进度,下周尽量多写追上进度
主界面

网络请求
由于在Model中的数据类型写错了导致申请数据全空,必须要把所有的需要写的类型都写对才能保证不出差错,能请求到数据,
scrollView
需要把请求的图片用 sd_setImageWithURL: placeholderImage:options: 这个方法来设置占位图以及请求到的图片,调用的对象是UIImageView类的对象(需要导入#import "UIImageView+WebCache.h" )
上图还差一个UIPageControl没有写上去,下周完善。
关于线程上的差错
把所有的请求都写好了,但是还是不能把得到的数据给view赋值。 这是因为所写的view在网络请求完成前就加载好了,所以不能得到数据了。
解决方法
经过腾组帮助,用了一段关于线程的代码
mainView.dictionary = [mainViewNowModel toDictionary];
dispatch_async(dispatch_get_main_queue(), ^{
[mainView Init];
});
这样可以保证我得到mainView之前就一定已经得到了数据字典。
但是这样又遗留下来一个新问题,我们设置占位图的意义就不在了,本来应该是网络请求得到结果之前要显示占位图的,现在成了请求得到结果之前什么都显示不出来。。。
希望下周可以解决这个问题,写在第二周总结上。
左上角时间(NSDate)
使用日期说明符来设置日期格式: EEEE:“星期”的全名(比如Monday)。如需缩写,指定1-3个字符(如E,EE,EEE代表Mon)。 MMMM:“月份”的全名(比如October)。如需缩写,指定1-3个字符(如M,MM,MMM代表Oct)。 dd:某月的第几天(例如,09或15) yyyy:四位字符串表示“年”(例如2015) HH:两位字符串表示“小时”(例如08或19) mm:两位字符串表示“分钟”(例如05或54) ss:两位字符串表示“秒” zzz:三位字符串表示“时区”(例如GMT)。缩写Z GGG:公元前BC或公元后AD
- (void) LayoutDate {
NSDate* date = [NSDate date];
NSDateFormatter* formatterMonth = [[NSDateFormatter alloc]init];
NSDateFormatter* formatterDay = [[NSDateFormatter alloc]init];
[formatterMonth setDateFormat:@"MM"];
[formatterDay setDateFormat:@"dd"];
NSString* MonthString = [formatterMonth stringFromDate:date];
NSString* DayString = [formatterDay stringFromDate:date];
UILabel* labelDay = [[UILabel alloc]initWithFrame:CGRectMake(Width*0.05, Height*0.04, Width*0.1, Height*0.045)];
labelDay.text = DayString;
labelDay.font = [UIFont systemFontOfSize:23];
labelDay.textAlignment = NSTextAlignmentCenter;
[self addSubview:labelDay];
NSArray* monthArray = [NSArray arrayWithObjects:@"一月", @"二月", @"三月", @"四月", @"五月", @"六月", @"七月", @"八月", @"九月", @"十月", @"十一月", @"十二月", nil];
UILabel* labelMonth = [[UILabel alloc]initWithFrame:CGRectMake(Width*0.05, Height*0.07, Width*0.1, Height*0.045)];
NSString* ChineseMonth = [NSString stringWithFormat:@"%@", monthArray[[MonthString integerValue] - 1] ];
labelMonth.text = ChineseMonth;
labelMonth.font = [UIFont systemFontOfSize:13];
labelMonth.textAlignment = NSTextAlignmentCenter;
[self addSubview:labelMonth];
}
关于左上角月份的汉字的显示
如上代码,用NSArray初始化把“一月”“二月”“三月”…“十二月”存到数组里面。 然后通过MonthString的数字索引到NSArray的月份字符串(NSString经过了integerValue方法转成NSInteger),然后就可以愉快的显示到导航栏上了。
|