Android animation Frameanimation (frame animation) AnimationDrawable

2023-01-30  

// One, Dictionary-NSDICTIONARY Key key to find the only value value
        
// Features: 1, can only save objects
// 2, the dictionary is disorderly
// 3, the key value cannot be repeated (if repeated, keep the key value pair before)
// 4, value value can be repeated
// 5, key value and value value must be object
// 6, under normal circumstances, the key value only uses a string
//        
// nsdictionary *dict = [[nsdictionary alloc] initwithobjectsandkeys:@”Xiaoming”,@”Xiaoming corresponding boy”, Xiaoming corresponding boys “, Xiaoming,”
// @”Xiao Cui”, @”Xiao Cui corresponds to girls”, nil];
//        NSLog(@”%@”,dict);
// nsdictionary *dict1 = [nsdictionary dictionarywithobjectsandkeys:@”Xiaoming”,@”corresponding brother”,
// @”Xiao Cui”, @”corresponding sister”, nil];
//        NSLog(@”%@”,dict1);
//        
// // can only write a key value pair, not commonly used
//        NSDictionary *dict2 = [NSDictionary dictionaryWithObject:@”value” forKey:@”key”];
//        NSLog(@”%@”,dict2);
// // grammar candy
//        NSDictionary *dict3 = @{@”key1″: @”value1″,
//                                @”key2″: @”value2″,
//                                @”key3″: @”value3″,
//                                @”key4″: @”value2″};
//        NSLog(@”%@”,dict3);
//        
//        
//        
dictionary operation method (the first four are very important)
      1,cout
//        NSUInteger dictCount = [dict3 count];
//        NSLog(@”%lu”,dictCount);
2, take out all the KEY values of the dictionary
//        NSArray *keys = [dict3 allKeys];
// nslog (@”dict3 all key is %@”, keys);
3, take out all the value values in the dictionary
//        NSArray *values = [dict3 allValues];
// nslog (@”dict3 all values are %@”, value);
//
//        Person *person1 = [[Person alloc]initWithName:@”gxm”];
//        Person *person2 = [[Person alloc]initWithName:@”lh”];
//        NSDictionary *finalDic = @{@”key1″: person1,@”key2″:person2};
//        NSLog(@”%@”,finalDic);
4, take out a certain value value
//        [dict3 objectForKey:@”key1″];
// // grammar sugar to achieve
//         NSString *value = dict3[@”key2″];
//         NSLog(@”aaaa%@”,value);
//        NSLog(@”%@”,dict3[@”key2″]);
5, take out some key values according to Value (this method is not commonly used)
//        NSArray *keysArray = [dict3 allKeysForObject:@”value2″];
//        NSLog(@”bbbb%@”,keysArray);
// 6, traversed dictionary
for (ID object in dict3) {// Print the key value
            NSLog(@”12%@”,object);
        }
for (ID object in dict3) {// Find the value value through the key value
            NSLog(@”21%@”,dict3[object]);
        }
//        NSArray *keysArray1 = [dict3 allKeys];
//        for (NSString *key in keysArray1) {

//            NSLog(@”11111%@”,key);
//        }
//    NSLog(@”1111%@”,keysArray1);
//        
Dictionary other use
1, array and dictionary can be nested with each other
2, if the number is placed in the dictionary, the array is generally used as a value value
        
//
//        
2, NSMUTableDictionary Variable Dictionary ————————————————————————————————–
// // Features: If the key value is repeated, keep the key value pair later
//        //NSMutableDictionary *mutableDic = [[NSMutableDictionary alloc]initWithCapacity:10];
//        NSMutableDictionary *mutableDic1 = [NSMutableDictionary dictionary];
//        //NSLog(@”%@”,mutableDic);
1, add elements to the variable dictionary
//        [mutableDic1 setObject:person1 forKey:@”key1″];
//        [mutableDic1 setObject:person2 forKey:@”key2″];
//        [mutableDic1 setObject:@”value” forKey:@”key1″];
//        NSLog(@”AAAA%@”,mutableDic1);
2, delete the elements in the dictionary
Delete all elements in the dictionary
//        //[mutableDic1 removeAllObjects];
//        //NSLog(@”%@”,mutableDic1);
Delete a certain value
//        [mutableDic1 removeObjectForKey:@”key1″];
//        NSLog(@”%@”,mutableDic1);

//        
//        NSArray *deleteArray = @[@”key1″,@”key2″];
//        [mutableDic1 removeObjectsForKeys:deleteArray];
//

        
        
// Three NSSET collection
// 1, can only be stored in it
// 2, the elements inside cannot be repeated
// 3, the collection is disorderly
//
//
//        NSSet *set = [NSSet setWithObjects:@”ni”,@”hao”,@”shuai”,@”2″, nil];
//        NSLog(@”%@”,set);
//        
Put the elements in the array in the set (the following three -line code to remove duplicate elements)
//        NSArray *array = @[@”1″,@”2″,@”1″];
//        NSSet *set1 = [NSSet setWithArray:array];
//        NSLog(@”%@”,set1);
//        
The method of operating NSSET
1, take out all the elements in the collection
//        NSLog(@”….%@”,set1.allObjects);
// nslog (@”,,,,%lu”, set1.count); // Statistics the number of elements in set
2, take out a set of elements in the collection does not guarantee randomness
//        NSLog(@”—-%@”,[set1 anyObject]);
//        
3, intersection
//    
//        NSLog(@”;;;;%d”, [set1 intersectsSet:set]);
//        
//        
// Four NSMUTableset variable collection
        NSMutableSet *set2 = [NSMutableSet setWithObjects:@”3″,@”2″,@”4″, nil];
        NSMutableSet *set3 = [NSMutableSet setWithObjects:@”1″,@”4″,@”5″, nil];
        
intersection
//        [set2 intersectSet:set3];
//        NSLog(@”%@”, set2);

//        [set2 unionSet:set3];
//        NSLog(@”%@”, set2);
//
        [set2 minusSet:set3];
        NSLog(@”%@”, set2);
//
Five NSCOUNTEDSET set count
//        
// nscountsetset *countset = [nscountset setWithobjects:@”1″,@”3″,@”1″,@”6″, nil];
//        NSLog(@”%@”, countSet);
//

source

Related Posts

python execute timing task LTC

IOS10 adaptation problem

JS DateTime type to the front end iOS is not compatible

笔 笔 笔 1 1: tree -shaped DP

Android animation Frameanimation (frame animation) AnimationDrawable

Random Posts

jacksonUtil工具类b

UNKNOWN HOST ‘DOWNLOADS.Gradle.org‘. You May Need to Adjust The Proxy Settings in Gradle

MVVM’s beginner in Android

POJ1806-Manhattan 2025 (C language implementation) AI

Sample downsample code