This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CGFloat h = (arc4random() % 128 / 256.0) + 0.5; | |
| CGFloat s = (arc4random() % 128 / 256.0) + 0.5; | |
| CGFloat b = (arc4random() % 128 / 256.0) + 0.5; | |
| UIColor *color = [UIColor colorWithHue:h saturation:s brightness:b alpha:1.0f]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @interface UIColor (Hex) | |
| + (CGFloat)colorComponentFrom:(NSString *)string start:(NSUInteger)start length:(NSUInteger)length; | |
| @end | |
| @implementation UIColor (Hex) | |
| + (UIColor *)colorWithHexString:(NSString *)hex | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static std::string getClassName(JNIEnv *env, jobject entity, jclass clazz) | |
| { | |
| jmethodID mid = env->GetMethodID(clazz, "getClass", "()Ljava/lang/Class;"); | |
| jobject clsObj = env->CallObjectMethod(entity, mid); | |
| jclass clazzz = env->GetObjectClass(clsObj); | |
| mid = env->GetMethodID(clazzz, "getName", "()Ljava/lang/String;"); | |
| jstring strObj = (jstring)env->CallObjectMethod(clsObj, mid); | |
| const char* str = env->GetStringUTFChars(strObj, NULL); | |
| std::string res(str); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| JNIEXPORT void JNICALL method_name | |
| (JNIEnv *env, jobject obj, jstring jstr) | |
| { | |
| const char* ch = env->GetStringUTFChars(jstr, 0); | |
| env->ReleaseStringUTFChars(jstr, ch); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iPhone 6 Plus (@3x) - 75 x 75 | |
| iPhone 6 and iPhone 5 (@2x) - 50 x 50 | |
| iPhone 4s (@2x) - 50 x 50 | |
| iPad and iPad mini (@2x) - 50 x 50 | |
| iPad 2 and iPad mini (@1x) - 25 x 25 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for (NSString* family in [UIFont familyNames]) | |
| { | |
| NSLog(@"%@", family); | |
| for (NSString* name in [UIFont fontNamesForFamilyName:family]) | |
| { | |
| NSLog(@"- %@", name); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSMutableArray *countries = [[NSMutableArray alloc] init]; | |
| NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier: @"en_US"]; | |
| NSArray *countryArray = [NSLocale ISOCountryCodes]; | |
| for (NSString *countryCode in countryArray) | |
| { | |
| NSString *displayName = [locale displayNameForKey:NSLocaleCountryCode value:countryCode]; | |
| [countries addObject:displayName]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Width x Height | |
| iPhone 4: | |
| 320 x 480 - portrait | |
| 480 x 320 - landscape | |
| iPhone 4s (@2x): | |
| 640 x 960 - portrait | |
| 960 x 640 - landscape |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) | |
| { | |
| NSLog(@"iPad"); | |
| } | |
| if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) | |
| { | |
| NSLog(@"iPhone"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int[] intVal = new int[1]; | |
| JNIEXPORT jboolean JNICALL Java_com_test_example_ChIntVal_change_int(JNIEnv* env, jobject cls, jintArray intValArray) | |
| { | |
| int testVal = -1; | |
| jint *exTypeVal = env->GetIntArrayElements(intValArray, 0); | |
| exTypeVal[0] = testVal; | |
| env->ReleaseIntArrayElements(intValArray, exTypeVal, 0); |
OlderNewer