1喜鼓,scrollview發(fā)生位移际乘,不讓scrollview成為第一個(gè)子view坡倔。(也許還可以self.automaticallyAdjustsScrollViewInsets=NO;默認(rèn)yes,如果視圖存在唯一一個(gè)scrollview或子view那么會(huì)自動(dòng)設(shè)置相應(yīng)內(nèi)邊距脖含,這樣可以讓scroll占據(jù)整個(gè)視圖而不讓導(dǎo)航欄遮蓋罪塔。當(dāng)controller上的第一個(gè)子視圖不是scrollview以及其子類的時(shí)會(huì)取消內(nèi)邊距。此時(shí)原本全屏的scrollview設(shè)置的frame(0养葵,0征堪,self.frame.size.width,xx)就會(huì)從狀態(tài)欄開始算起关拒,導(dǎo)航欄就會(huì)遮住視圖的64個(gè)高度
)
2佃蚜,給view加陰影的時(shí)候可以不用view的屬性庸娱,寫一個(gè)layer加載view.layer上(CALayer *layer)。
3谐算,調(diào)用delloc方法熟尉。
-(void)dealloc{ [superdealloc]; }
?-(void)dealloc{NSLog(@"laptop dead"); [_cpu release]; [superdealloc];}
4,tableview第一次加載的時(shí)候洲脂,添加在contentview上的view不顯示斤儿,但是是有數(shù)據(jù)的(問題:未獲取到屏幕寬度)。
5恐锦,正則判斷字符串后面的字符
for(int i =0; i < [s length]-1; i++)
{
NSString * str = [s substringWithRange:NSMakeRange(i,1)];
NSString * str1=[s substringWithRange:NSMakeRange(i+1,1)];
//[a-zA-Z]
if ([str isEqualToString:@","]&&[self inputShouldLetter:str1]) {
[s replaceCharactersInRange:NSMakeRange(i,1) withString:@"^"];
}
}
[s replaceOccurrencesOfString:@"^" withString:@"\",\n? \"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [s length])];
- (BOOL)inputShouldLetter:(NSString *)inputString {
if (inputString.length == 0) return NO;
NSString *regex =@"[a-zA-Z]*";
NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regex];
return [pred evaluateWithObject:inputString];
}
NSDictionary *dic = noticeAry[indexPath.row];
NSString *remainSumStr = [dic objectForKey:@"remainSum"];
double rem= [remainSumStr doubleValue];
rem= rem/10000;
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setPositiveFormat:@"###,##0.00"];
remainSumStr = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:rem]];
NSString *oneStr = [dic objectForKey:@"oneStr"];
NSString *twoStr = [dic objectForKey:@"twoStr"];
NSString *threeStr = [dic objectForKey:@"threeStr"];
NSArray *elementAry = [NSArray arrayWithObjects:oneStr,twoStr,threeStr, nil];
6往果,(自己看的:234?? 加密0。)
7一铅,//1.獲取當(dāng)月的總天數(shù)
NSCalendar*calendar = [NSCalendarcurrentCalendar];
NSRangerange = [calendarrangeOfUnit:NSDayCalendarUnitinUnit:NSMonthCalendarUnitforDate:[NSDatedate]];
NSUIntegernumberOfDaysInMonth = range.length;
NSLog(@"%lu", (unsignedlong)numberOfDaysInMonth);
//2.獲取當(dāng)前年份,月份,號(hào)數(shù)
unsignedunitFlags =NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit;
NSDateComponents*components = [calendarcomponents:unitFlagsfromDate:[NSDatedate]];
NSLog(@"%ld, %ld, %ld", (long)components.year,
(long)components.month, (long)components.day);
//3.獲取當(dāng)前日期星期幾
NSArray*weekdays = [NSArrayarrayWithObjects:@"星期日",@"周一",@"周二",@"周三",@"周四",@"周五",@"周六",nil];
NSTimeZone*timeZone = [[NSTimeZonealloc]initWithName:@"Asia/Shanghai"];
[calendarsetTimeZone: timeZone];
NSDate*date = [NSDatedate];
NSCalendarUnitcalendarUnit =NSWeekdayCalendarUnit;
NSDateComponents*theComponents = [calendarcomponents:calendarUnitfromDate:date];
NSLog(@"%@", [weekdaysobjectAtIndex:theComponents.weekday]);