通過遍歷字典裏的key值,來找到對應value值
NSDictionary *dic = @{@"name":@"張三",@"age":@22,@"heigh":@168,@"weigh":@54};
NSLog(@"dic爲%@",dic);
for (NSString *str in dic) {
NSLog(@"key:%@",str);
NSString *str1 = [dic objectForKey:str];
NSLog(@"value:%@",str1);
}
上面的NSLog(@"key : %@",str);將得到所有dic的key對象。
2,Block的聲明,返回值類型不要打括號。
@property (nonatomic, copy) void(^errorHandler)(MyHTTPRequest *,NSError *);
3,協議是掛在接口後面
4,方法實現類型名要括起來,不像C語言。
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
}
5,隱藏底部標籤欄
DetailViewController *detailViewCtrl = [[DetailViewControlleralloc]init];
self.hidesBottomBarWhenPushed=YES;
6,設置HTTPBody
NSString *str = [_paramter URLString];//URLString自己寫的方法[request setHTTPBody:[str dataUsingEncoding:NSUTF8StringEncoding]];