plist文件的读取

时间:2023-12-29 19:01:26

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"cinemalist" ofType:@"plist"];
    
    NSMutableDictionary *myDic = [NSMutableDictionary dictionaryWithContentsOfFile:filePath];

//读取plist文件
    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"cinemalist" ofType:@"plist"];
    
    NSMutableDictionary *myDic = [NSMutableDictionary dictionaryWithContentsOfFile:filePath];
    
    for (NSDictionary * dic in [[myDic objectForKey:@"result"] objectForKey:@"data"]) {
        
        //所有的title
        NSString * title = [dic objectForKey:@"cinemaName"];
        
        //所有的content
        NSString * content = [dic objectForKey:@"address"];
        
        
        NSLog(@"title = %@",title);
        NSLog(@"content = %@",content);

}