This file contains 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
Objective-C | |
- (void)getListAvailableFontNames { | |
for (NSString *familyName in [UIFont familyNames]){ | |
NSLog(@"Family name: %@", familyName); | |
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) { | |
NSLog(@"--Font name: %@", fontName); | |
} | |
} | |
} |
This file contains 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
- (NSString *)md5:(NSString *)string { | |
// Create pointer to the string as UTF8 | |
const char *ptr = [string UTF8String]; | |
// Create byte array of unsigned chars | |
unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH]; | |
// Create 16 byte MD5 hash value, store in buffer | |
CC_MD5(ptr, strlen(ptr), md5Buffer ); // This is the md5 call |
This file contains 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
1. Set navigation bar style to black | |
[self.navigationController.navigationBar setBarStyle:UIBarStyleDefault]; | |
2. Set directly | |
- Set the UIViewControllerBasedStatusBarAppearance to YES in the .plist file. | |
- In the viewDidLoad do a | |
[self setNeedsStatusBarAppearanceUpdate]; | |
- Add the following method: |
This file contains 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
// | |
// UIColor+AppName.h | |
// AppName | |
// | |
// Created by Thinh Phan on 4/10/15. | |
// Copyright (c) 2015 Gennova. All rights reserved. | |
// | |
// See http://blog.alexedge.co.uk/speeding-up-uicolor-categories/ | |
#define AGEColorDefine(COLOR_NAME) \ |
This file contains 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
#pragma mark - Managing Keyboard | |
- (void)registerForKeyboardNotifications | |
{ | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(keyboardWillShow:) | |
name:UIKeyboardWillShowNotification | |
object:nil]; | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(keyboardWillBeHidden:) |
This file contains 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
// A compile-time check is what you need in the case of Xcode 5 | |
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 | |
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) { | |
// use registerUserNotificationSettings | |
// Register for Push Notitications - iOS 8 Notifications | |
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | | |
UIUserNotificationTypeBadge | | |
UIUserNotificationTypeSound); | |
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes |
This file contains 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
// Reference links: | |
// https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/TechniquesforReadingandWritingCustomFiles/TechniquesforReadingandWritingCustomFiles.html | |
// http://stackoverflow.com/questions/7651632/how-to-speed-up-saving-a-uiimagepickercontroller-image-from-the-camera-to-the-fi | |
// http://www.codedisqus.com/0zJVUVqgPj/objectivec-uiimagewritetosavedphotosalbum-asynchronous-problems.html | |
// http://stackoverflow.com/questions/14411369/when-i-am-using-uiimagepngrepresentation-or-uiimagejpegrepresentation-for-conver?rq=1 | |
// Save multi files async for saving time | |
- (void)saveUploadImages:(NSMutableArray *)images { | |
NSMutableArray *imagePaths = [[NSMutableArray alloc] init]; |
This file contains 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
// Ref: http://stackoverflow.com/questions/11251340/convert-image-to-base64-string-in-ios-swift | |
// iOS7 > version for Objective-C | |
// You can use NSData's base64EncodedStringWithOptions | |
// Now encode as: | |
- (NSString *)encodeToBase64String:(UIImage *)image { | |
return [UIImagePNGRepresentation(image) base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; | |
} |
This file contains 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
// UIImage+SimpleResize.h | |
// | |
// Created by Robert Ryan on 5/19/11. | |
#import <Foundation/Foundation.h> | |
/** Image resizing category. | |
* | |
* Modified by Robert Ryan on 5/19/11. | |
* |