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
override func viewDidLoad() { | |
super.viewDidLoad() | |
let nibName = UINib(nibName: "BLActionCell", bundle:nil) | |
self.tableAction.registerNib(nibName, forCellReuseIdentifier: "blaction.cell") | |
//self.modalPresentationStyle = .OverFullScreen | |
// Do any additional setup after loading the view. | |
} |
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
Detecting AVPlayer video start stop events | |
Here is nice simple avplayer piece of code playing a small collection of videos in a queue. My question. I actually want to pause between videos on my queue. Is it possible? | |
I did note that rate fires twice; status fires just once as does notification. | |
import UIKit | |
import AVKit | |
import AVFoundation | |
class ViewController: UIViewController { |
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. Create the alert controller. | |
var alert = UIAlertController(title: "Report", message: "Nhập nội dung", preferredStyle: .Alert) | |
//2. Add the text field. You can configure it however you need. | |
alert.addTextFieldWithConfigurationHandler({ (textField) -> Void in | |
textField.text = "" | |
// textField.placeholder = "Nhập nội dung..." | |
}) | |
//3. Grab the value from the text field, and print it when the user clicks OK. |
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
AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] init]; | |
AFHTTPRequestOperation *op = [manager GET:requestURLString parameters:parameter success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil]; | |
DDLog(@"%@", dic); | |
block(dic); | |
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { | |
NSLog(@"%@", [error description]); |
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 - UICollectionView | |
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { | |
return 1; | |
} | |
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section | |
{ | |
return 10; | |
} |
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
// Lấy thông tin thiết bị | |
+ (NSString *) platformType | |
{ | |
size_t size; | |
sysctlbyname("hw.machine", NULL, &size, NULL, 0); | |
char *machine = malloc(size); | |
sysctlbyname("hw.machine", machine, &size, NULL, 0); | |
NSString *platform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding]; | |
// NSLog(@"iPhone Device%@",[self platformType:platform]); |
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
// Resize Image | |
+ (UIImage *)ResizeImage:(UIImage*)originalImage scaledToSize:(CGSize)size | |
{ | |
//avoid redundant drawing | |
if (CGSizeEqualToSize(originalImage.size, size)) | |
{ | |
return originalImage; | |
} | |
//create drawing context |
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
+ (void) performBlock:(void(^)())block afterDelay:(NSTimeInterval)delay { | |
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)); | |
dispatch_after(popTime, dispatch_get_main_queue(), block); | |
} |
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
For example you can add a specific domain like: | |
<key>NSAppTransportSecurity</key> | |
<dict> | |
<key>NSExceptionDomains</key> | |
<dict> | |
<key>yourserver.com</key> | |
<dict> | |
<!--Include to allow subdomains--> | |
<key>NSIncludesSubdomains</key> | |
<true/> |